summaryrefslogtreecommitdiffstats
path: root/source3/locking
diff options
context:
space:
mode:
Diffstat (limited to 'source3/locking')
-rw-r--r--source3/locking/brlock.c15
-rw-r--r--source3/locking/locking.c10
2 files changed, 10 insertions, 15 deletions
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);
}
diff --git a/source3/locking/locking.c b/source3/locking/locking.c
index 9753b5ea61..890214f10e 100644
--- a/source3/locking/locking.c
+++ b/source3/locking/locking.c
@@ -465,19 +465,20 @@ BOOL modify_share_mode(files_struct *fsp, int new_mode, uint16 new_oplock)
return mod_share_mode(fsp, modify_share_mode_fn, (void *)&mv);
}
-static void (*traverse_callback)(share_mode_entry *, char *);
/****************************************************************************
traverse the whole database with this function, calling traverse_callback
on each share mode
****************************************************************************/
-static int traverse_fn(TDB_CONTEXT *tdb, TDB_DATA kbuf, TDB_DATA dbuf)
+static int traverse_fn(TDB_CONTEXT *tdb, TDB_DATA kbuf, TDB_DATA dbuf, void* state)
{
struct locking_data *data;
share_mode_entry *shares;
char *name;
int i;
+ SHAREMODE_FN(traverse_callback) = (SHAREMODE_FN_CAST())state;
+
data = (struct locking_data *)dbuf.dptr;
shares = (share_mode_entry *)(dbuf.dptr + sizeof(*data));
name = dbuf.dptr + sizeof(*data) + data->num_share_mode_entries*sizeof(*shares);
@@ -492,9 +493,8 @@ static int traverse_fn(TDB_CONTEXT *tdb, TDB_DATA kbuf, TDB_DATA dbuf)
Call the specified function on each entry under management by the
share mode system.
********************************************************************/
-int share_mode_forall(void (*fn)(share_mode_entry *, char *))
+int share_mode_forall(SHAREMODE_FN(fn))
{
if (!tdb) return 0;
- traverse_callback = fn;
- return tdb_traverse(tdb, traverse_fn);
+ return tdb_traverse(tdb, traverse_fn, (void*)fn);
}