summaryrefslogtreecommitdiff
path: root/source3/locking
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2007-05-29 13:26:44 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:22:53 -0500
commitd3ed91d9e1f3ba9f3d5093b3607dd563b37c27ed (patch)
treec4eebf87de5196db0f67caa73137da4b45d8efe4 /source3/locking
parent86f79c402df9fca010719c4f7816ea35c3f42c75 (diff)
downloadsamba-d3ed91d9e1f3ba9f3d5093b3607dd563b37c27ed.tar.gz
samba-d3ed91d9e1f3ba9f3d5093b3607dd563b37c27ed.tar.bz2
samba-d3ed91d9e1f3ba9f3d5093b3607dd563b37c27ed.zip
r23195: Add void *private_data to brl_forall
(This used to be commit c91b2bdc160d76bf0b0770fe7f92cbc7124d6c3c)
Diffstat (limited to 'source3/locking')
-rw-r--r--source3/locking/brlock.c38
1 files changed, 28 insertions, 10 deletions
diff --git a/source3/locking/brlock.c b/source3/locking/brlock.c
index a37afbddd5..b51076bf43 100644
--- a/source3/locking/brlock.c
+++ b/source3/locking/brlock.c
@@ -1447,6 +1447,15 @@ static BOOL validate_lock_entries(unsigned int *pnum_entries, struct lock_struct
return True;
}
+struct brl_forall_cb {
+ void (*fn)(struct file_id id, struct server_id pid,
+ enum brl_type lock_type,
+ enum brl_flavour lock_flav,
+ br_off start, br_off size,
+ void *private_data);
+ void *private_data;
+};
+
/****************************************************************************
Traverse the whole database with this function, calling traverse_callback
on each lock.
@@ -1454,14 +1463,13 @@ static BOOL validate_lock_entries(unsigned int *pnum_entries, struct lock_struct
static int traverse_fn(struct db_record *rec, void *state)
{
+ struct brl_forall_cb *cb = (struct brl_forall_cb *)state;
struct lock_struct *locks;
struct file_id *key;
unsigned int i;
unsigned int num_locks = 0;
unsigned int orig_num_locks = 0;
- BRLOCK_FN(traverse_callback) = (BRLOCK_FN_CAST())state;
-
/* In a traverse function we must make a copy of
dbuf before modifying it. */
@@ -1493,12 +1501,13 @@ static int traverse_fn(struct db_record *rec, void *state)
}
for ( i=0; i<num_locks; i++) {
- traverse_callback(*key,
- locks[i].context.pid,
- locks[i].lock_type,
- locks[i].lock_flav,
- locks[i].start,
- locks[i].size);
+ cb->fn(*key,
+ locks[i].context.pid,
+ locks[i].lock_type,
+ locks[i].lock_flav,
+ locks[i].start,
+ locks[i].size,
+ cb->private_data);
}
SAFE_FREE(locks);
@@ -1509,12 +1518,21 @@ static int traverse_fn(struct db_record *rec, void *state)
Call the specified function on each lock in the database.
********************************************************************/
-int brl_forall(BRLOCK_FN(fn))
+int brl_forall(void (*fn)(struct file_id id, struct server_id pid,
+ enum brl_type lock_type,
+ enum brl_flavour lock_flav,
+ br_off start, br_off size,
+ void *private_data),
+ void *private_data)
{
+ struct brl_forall_cb cb;
+
if (!brlock_db) {
return 0;
}
- return brlock_db->traverse(brlock_db, traverse_fn, (void *)fn);
+ cb.fn = fn;
+ cb.private_data = private_data;
+ return brlock_db->traverse(brlock_db, traverse_fn, &cb);
}
/*******************************************************************