diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2012-06-22 15:07:43 +0930 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2012-06-22 07:35:17 +0200 |
commit | 431667b47c0eac3069ba1e643996619ab61975e5 (patch) | |
tree | 5599a4411b439b1f87086b6fb0cdc9cca96ee67b /lib/dbwrap/dbwrap.c | |
parent | 9d97bf3f47a591a71e96cad8a87ef13a2b277c9c (diff) | |
download | samba-431667b47c0eac3069ba1e643996619ab61975e5.tar.gz samba-431667b47c0eac3069ba1e643996619ab61975e5.tar.bz2 samba-431667b47c0eac3069ba1e643996619ab61975e5.zip |
dbwrap: add dbwrap_check() function.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'lib/dbwrap/dbwrap.c')
-rw-r--r-- | lib/dbwrap/dbwrap.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/dbwrap/dbwrap.c b/lib/dbwrap/dbwrap.c index a393960428..d46044f0c4 100644 --- a/lib/dbwrap/dbwrap.c +++ b/lib/dbwrap/dbwrap.c @@ -50,6 +50,19 @@ static int dbwrap_fallback_wipe(struct db_context *db) return NT_STATUS_IS_OK(status) ? 0 : -1; } +static int do_nothing(struct db_record *rec, void *unused) +{ + return 0; +} + +/* + * Fallback check operation: just traverse. + */ +static int dbwrap_fallback_check(struct db_context *db) +{ + NTSTATUS status = dbwrap_traverse_read(db, do_nothing, NULL, NULL); + return NT_STATUS_IS_OK(status) ? 0 : -1; +} /* * Wrapper functions for the backend methods @@ -367,6 +380,14 @@ int dbwrap_wipe(struct db_context *db) return db->wipe(db); } +int dbwrap_check(struct db_context *db) +{ + if (db->check == NULL) { + return dbwrap_fallback_check(db); + } + return db->check(db); +} + int dbwrap_get_seqnum(struct db_context *db) { return db->get_seqnum(db); |