From 9dd047d67e4b53f1240956e20af986a1d03dce32 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 12 Nov 2012 13:27:07 +0100 Subject: s3: Factor out db_ctdb_can_use_local_hdr from db_ctdb_can_use_local_copy Reviewed-by: Michael Adam --- source3/lib/dbwrap/dbwrap_ctdb.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'source3') diff --git a/source3/lib/dbwrap/dbwrap_ctdb.c b/source3/lib/dbwrap/dbwrap_ctdb.c index f18f2f99a3..6037585230 100644 --- a/source3/lib/dbwrap/dbwrap_ctdb.c +++ b/source3/lib/dbwrap/dbwrap_ctdb.c @@ -970,18 +970,9 @@ static int db_ctdb_record_destr(struct db_record* data) * Check whether we have a valid local copy of the given record, * either for reading or for writing. */ -static bool db_ctdb_can_use_local_copy(TDB_DATA ctdb_data, bool read_only) +static bool db_ctdb_can_use_local_hdr(const struct ctdb_ltdb_header *hdr, + bool read_only) { - struct ctdb_ltdb_header *hdr; - - if (ctdb_data.dptr == NULL) - return false; - - if (ctdb_data.dsize < sizeof(struct ctdb_ltdb_header)) - return false; - - hdr = (struct ctdb_ltdb_header *)ctdb_data.dptr; - #ifdef HAVE_CTDB_WANT_READONLY_DECL if (hdr->dmaster != get_my_vnn()) { /* If we're not dmaster, it must be r/o copy. */ @@ -997,6 +988,18 @@ static bool db_ctdb_can_use_local_copy(TDB_DATA ctdb_data, bool read_only) #endif } +static bool db_ctdb_can_use_local_copy(TDB_DATA ctdb_data, bool read_only) +{ + if (ctdb_data.dptr == NULL) + return false; + + if (ctdb_data.dsize < sizeof(struct ctdb_ltdb_header)) + return false; + + return db_ctdb_can_use_local_hdr( + (struct ctdb_ltdb_header *)ctdb_data.dptr, read_only); +} + static struct db_record *fetch_locked_internal(struct db_ctdb_ctx *ctx, TALLOC_CTX *mem_ctx, TDB_DATA key, -- cgit