diff options
author | Volker Lendecke <vl@samba.org> | 2012-11-12 13:27:07 +0100 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2012-11-29 18:08:06 +0100 |
commit | 9dd047d67e4b53f1240956e20af986a1d03dce32 (patch) | |
tree | 42293b035fabcc8f4b3406ca3b55aebc17ab52a7 /source3/lib | |
parent | 55d75a3fbe95ea3b95dc83551cca742bcddb6e9b (diff) | |
download | samba-9dd047d67e4b53f1240956e20af986a1d03dce32.tar.gz samba-9dd047d67e4b53f1240956e20af986a1d03dce32.tar.bz2 samba-9dd047d67e4b53f1240956e20af986a1d03dce32.zip |
s3: Factor out db_ctdb_can_use_local_hdr from db_ctdb_can_use_local_copy
Reviewed-by: Michael Adam <obnox@samba.org>
Diffstat (limited to 'source3/lib')
-rw-r--r-- | source3/lib/dbwrap/dbwrap_ctdb.c | 25 |
1 files changed, 14 insertions, 11 deletions
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, |