diff options
author | Volker Lendecke <vl@sernet.de> | 2007-12-05 20:30:53 +0100 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2007-12-10 12:22:01 +0100 |
commit | f4fe725ff173a173307b364939284b05c3d69a91 (patch) | |
tree | 206773138697ac85a2ee3a9f42140e9d66a53408 /source3/locking | |
parent | a1ceee904cec146c3c904ff69f47312e6c114abe (diff) | |
download | samba-f4fe725ff173a173307b364939284b05c3d69a91.tar.gz samba-f4fe725ff173a173307b364939284b05c3d69a91.tar.bz2 samba-f4fe725ff173a173307b364939284b05c3d69a91.zip |
Remove two statics
(This used to be commit 8ee502e1e59960fd8db037f0adf1171b2a18cec5)
Diffstat (limited to 'source3/locking')
-rw-r--r-- | source3/locking/posix.c | 56 |
1 files changed, 17 insertions, 39 deletions
diff --git a/source3/locking/posix.c b/source3/locking/posix.c index 37cfa04373..7669b140f6 100644 --- a/source3/locking/posix.c +++ b/source3/locking/posix.c @@ -322,34 +322,16 @@ struct lock_ref_count_key { }; /******************************************************************* - 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); |