Remove two statics
authorVolker Lendecke <vl@sernet.de>
Wed, 5 Dec 2007 19:30:53 +0000 (20:30 +0100)
committerVolker Lendecke <vl@samba.org>
Mon, 10 Dec 2007 11:22:01 +0000 (12:22 +0100)
(This used to be commit 8ee502e1e59960fd8db037f0adf1171b2a18cec5)

source3/locking/posix.c

index 37cfa0437395544a2ece3ba0553ac3c3551d0b0a..7669b140f6803801e8b1d9af21e542ce12e5ec0c 100644 (file)
@@ -321,35 +321,17 @@ struct lock_ref_count_key {
        char r;
 }; 
 
-/*******************************************************************
- Form a static locking key for a dev/inode pair for the fd array.
-******************************************************************/
-
-static TDB_DATA fd_array_key(struct file_id id)
-{
-       static struct file_id key;
-       TDB_DATA kbuf;
-       key = id;
-       kbuf.dptr = (uint8 *)&key;
-       kbuf.dsize = sizeof(key);
-       return kbuf;
-}
-
 /*******************************************************************
  Form a static locking key for a dev/inode pair for the lock ref count
 ******************************************************************/
 
-static TDB_DATA locking_ref_count_key(struct file_id id)
+static TDB_DATA locking_ref_count_key_fsp(files_struct *fsp,
+                                         struct lock_ref_count_key *tmp)
 {
-       static struct lock_ref_count_key key;
-       TDB_DATA kbuf;
-
-       memset(&key, '\0', sizeof(key));
-       key.id = id;
-       key.r = 'r';
-       kbuf.dptr = (uint8 *)&key;
-       kbuf.dsize = sizeof(key);
-       return kbuf;
+       ZERO_STRUCTP(tmp);
+       tmp->id = fsp->file_id;
+       tmp->r = 'r';
+       return make_tdb_data((uint8_t *)tmp, sizeof(*tmp));
 }
 
 /*******************************************************************
@@ -358,16 +340,7 @@ static TDB_DATA locking_ref_count_key(struct file_id id)
 
 static TDB_DATA fd_array_key_fsp(files_struct *fsp)
 {
-       return fd_array_key(fsp->file_id);
-}
-
-/*******************************************************************
- Convenience function to get a lock ref count key from an fsp.
-******************************************************************/
-
-static TDB_DATA locking_ref_count_key_fsp(files_struct *fsp)
-{
-       return locking_ref_count_key(fsp->file_id);
+       return make_tdb_data((uint8 *)&fsp->file_id, sizeof(fsp->file_id));
 }
 
 /*******************************************************************
@@ -425,7 +398,8 @@ bool posix_locking_end(void)
 
 static void increment_windows_lock_ref_count(files_struct *fsp)
 {
-       TDB_DATA kbuf = locking_ref_count_key_fsp(fsp);
+       struct lock_ref_count_key tmp;
+       TDB_DATA kbuf = locking_ref_count_key_fsp(fsp, &tmp);
        TDB_DATA dbuf;
        int lock_ref_count;
 
@@ -454,7 +428,8 @@ static void increment_windows_lock_ref_count(files_struct *fsp)
 
 static void decrement_windows_lock_ref_count(files_struct *fsp)
 {
-       TDB_DATA kbuf = locking_ref_count_key_fsp(fsp);
+       struct lock_ref_count_key tmp;
+       TDB_DATA kbuf = locking_ref_count_key_fsp(fsp, &tmp);
        TDB_DATA dbuf;
        int lock_ref_count;
 
@@ -486,7 +461,8 @@ static void decrement_windows_lock_ref_count(files_struct *fsp)
 
 void reduce_windows_lock_ref_count(files_struct *fsp, unsigned int dcount)
 {
-       TDB_DATA kbuf = locking_ref_count_key_fsp(fsp);
+       struct lock_ref_count_key tmp;
+       TDB_DATA kbuf = locking_ref_count_key_fsp(fsp, &tmp);
        TDB_DATA dbuf;
        int lock_ref_count;
 
@@ -518,7 +494,8 @@ void reduce_windows_lock_ref_count(files_struct *fsp, unsigned int dcount)
 
 static int get_windows_lock_ref_count(files_struct *fsp)
 {
-       TDB_DATA kbuf = locking_ref_count_key_fsp(fsp);
+       struct lock_ref_count_key tmp;
+       TDB_DATA kbuf = locking_ref_count_key_fsp(fsp, &tmp);
        TDB_DATA dbuf;
        int lock_ref_count;
 
@@ -541,7 +518,8 @@ static int get_windows_lock_ref_count(files_struct *fsp)
 
 static void delete_windows_lock_ref_count(files_struct *fsp)
 {
-       TDB_DATA kbuf = locking_ref_count_key_fsp(fsp);
+       struct lock_ref_count_key tmp;
+       TDB_DATA kbuf = locking_ref_count_key_fsp(fsp, &tmp);
 
        /* Not a bug if it doesn't exist - no locks were ever granted. */
        tdb_delete(posix_pending_close_tdb, kbuf);