From f4fe725ff173a173307b364939284b05c3d69a91 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 5 Dec 2007 20:30:53 +0100 Subject: Remove two statics (This used to be commit 8ee502e1e59960fd8db037f0adf1171b2a18cec5) --- source3/locking/posix.c | 56 +++++++++++++++---------------------------------- 1 file changed, 17 insertions(+), 39 deletions(-) (limited to 'source3/locking/posix.c') 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 @@ -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); -- cgit