diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2011-09-14 07:20:13 +0930 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2011-09-14 07:20:13 +0930 |
commit | b67acb7e2a7cde01321daa6116c635a565accd27 (patch) | |
tree | 0c8216cd0d20519cb68af1acec43144a5022f5e5 /lib/tdb2/open.c | |
parent | 1664702d2f0755a3caf7ba8dd433e34bb8d340b0 (diff) | |
download | samba-b67acb7e2a7cde01321daa6116c635a565accd27.tar.gz samba-b67acb7e2a7cde01321daa6116c635a565accd27.tar.bz2 samba-b67acb7e2a7cde01321daa6116c635a565accd27.zip |
tdb2: tdb_foreach()
Create an iterator over every open tdb (not internal TDBs). This is
useful for re-establishing the tdb1-style active lock for
CLEAR_IF_FIRST.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit 1a0c636bc38213bd0322db47529f78f2dc22ffdd)
Diffstat (limited to 'lib/tdb2/open.c')
-rw-r--r-- | lib/tdb2/open.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/tdb2/open.c b/lib/tdb2/open.c index 0f29d7a1fb..fc683d8c9b 100644 --- a/lib/tdb2/open.c +++ b/lib/tdb2/open.c @@ -689,3 +689,13 @@ int tdb_close(struct tdb_context *tdb) return ret; } + +void tdb_foreach_(int (*fn)(struct tdb_context *, void *), void *p) +{ + struct tdb_context *i; + + for (i = tdbs; i; i = i->next) { + if (fn(i, p) != 0) + break; + } +} |