From 098048a89c4ce14b17a0151dcb64c7cdf06f4152 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 8 Dec 2011 15:56:35 +0100 Subject: s3-dbwrap: Implement db_ctdb_parse_record in terms of db_ctdb_fetch Signed-off-by: Michael Adam --- source3/lib/dbwrap/dbwrap_ctdb.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'source3/lib') diff --git a/source3/lib/dbwrap/dbwrap_ctdb.c b/source3/lib/dbwrap/dbwrap_ctdb.c index 7262b873fa..6246829400 100644 --- a/source3/lib/dbwrap/dbwrap_ctdb.c +++ b/source3/lib/dbwrap/dbwrap_ctdb.c @@ -1196,6 +1196,24 @@ static NTSTATUS db_ctdb_fetch(struct db_context *db, TALLOC_CTX *mem_ctx, return status; } +static NTSTATUS db_ctdb_parse_record(struct db_context *db, TDB_DATA key, + void (*parser)(TDB_DATA key, + TDB_DATA data, + void *private_data), + void *private_data) +{ + NTSTATUS status; + TDB_DATA data; + + status = db_ctdb_fetch(db, talloc_tos(), key, &data); + if (!NT_STATUS_IS_OK(status)) { + return status; + } + parser(key, data, private_data); + TALLOC_FREE(data.dptr); + return NT_STATUS_OK; +} + struct traverse_state { struct db_context *db; int (*fn)(struct db_record *rec, void *private_data); @@ -1491,6 +1509,7 @@ struct db_context *db_open_ctdb(TALLOC_CTX *mem_ctx, result->private_data = (void *)db_ctdb; result->fetch_locked = db_ctdb_fetch_locked; result->fetch = db_ctdb_fetch; + result->parse_record = db_ctdb_parse_record; result->traverse = db_ctdb_traverse; result->traverse_read = db_ctdb_traverse_read; result->get_seqnum = db_ctdb_get_seqnum; -- cgit