From bbe275e95b86bc7af5a641455cbb379974823f84 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Fri, 4 Feb 2000 04:59:31 +0000 Subject: 1) added void* state argument to tdb_traverse. guess what! there were two places i found where it was appropriate to _use_ that third argument, in locking.c and brlock.c! there was a static traverse_function and i removed the static variable, typecast it to a void*, passed it to tdb_traverse and re-cast it back to the traverse_function inside the tdb_traverse function. this makes the use of tdb_traverse() reentrant, which is never going to happen, i know, i just don't like to see statics lying about when there's no need for them. as i had to do in samba-tng, all uses of tdb_traverse modified to take the new void* state argument. 2) disabled rpcclient: referring people to use SAMBA_TNG rpcclient. i don't know how the other samba team members would react if i deleted rpcclient from cvs main. damn, that code's so old, it's unreal. 20 rpcclient commands, instead of about 70 in SAMBA_TNG. (This used to be commit 49d7f0afbc1c5425d53019e234d54ddf205c8e9a) --- source3/locking/brlock.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'source3/locking/brlock.c') diff --git a/source3/locking/brlock.c b/source3/locking/brlock.c index 7e8adf4f86..71fc45854a 100644 --- a/source3/locking/brlock.c +++ b/source3/locking/brlock.c @@ -331,20 +331,18 @@ void brl_close(SMB_DEV_T dev, SMB_INO_T ino, pid_t pid, int tid, int fnum) } -static void (*traverse_callback)(SMB_DEV_T dev, SMB_INO_T ino, int pid, - enum brl_type lock_type, - br_off start, br_off size); - /**************************************************************************** traverse the whole database with this function, calling traverse_callback on each lock ****************************************************************************/ -static int traverse_fn(TDB_CONTEXT *tdb, TDB_DATA kbuf, TDB_DATA dbuf) +static int traverse_fn(TDB_CONTEXT *ttdb, TDB_DATA kbuf, TDB_DATA dbuf, void *state) { struct lock_struct *locks; struct lock_key *key; int i; + BRLOCK_FN(traverse_callback) = (BRLOCK_FN_CAST())state; + locks = (struct lock_struct *)dbuf.dptr; key = (struct lock_key *)kbuf.dptr; @@ -361,11 +359,8 @@ static int traverse_fn(TDB_CONTEXT *tdb, TDB_DATA kbuf, TDB_DATA dbuf) /******************************************************************* Call the specified function on each lock in the database ********************************************************************/ -int brl_forall(void (*fn)(SMB_DEV_T dev, SMB_INO_T ino, int pid, - enum brl_type lock_type, - br_off start, br_off size)) +int brl_forall(BRLOCK_FN(fn)) { if (!tdb) return 0; - traverse_callback = fn; - return tdb_traverse(tdb, traverse_fn); + return tdb_traverse(tdb, traverse_fn, (BRLOCK_FN_CAST())fn); } -- cgit