[SCM] CTDB repository - branch 1.0.112 updated - ctdb-1.0.111-39-g9fa818a
Ronnie Sahlberg
sahlberg at samba.org
Thu Feb 11 18:21:40 MST 2010
The branch, 1.0.112 has been updated
via 9fa818afe0ccc1117a972a603b223f67c87eb00b (commit)
via fb10a98f31303a4620d022d53d282fd9de4ca555 (commit)
via d5c477c92252062d1c27f393ffb93471c00d75b6 (commit)
from 8198e27e5d8dd1f5a927d75aff9ef122d7a5ac15 (commit)
http://gitweb.samba.org/?p=sahlberg/ctdb.git;a=shortlog;h=1.0.112
- Log -----------------------------------------------------------------
commit 9fa818afe0ccc1117a972a603b223f67c87eb00b
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Fri Feb 12 12:17:48 2010 +1100
Change ctdb to use the TDB_NOSEQNUM flag instead of the old/removed
TDB_REPLACE_NOSEQNUM enum
commit fb10a98f31303a4620d022d53d282fd9de4ca555
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Fri Feb 12 12:17:12 2010 +1100
Increase the package version for tdb to reflect the changes/additions to the
API
commit d5c477c92252062d1c27f393ffb93471c00d75b6
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Fri Feb 12 12:05:57 2010 +1100
Suggestion from Tridge.
Change the flags argument in tdb_store()
to take the low 4 bits as an enum describing the opeation
and let the higher order bits be flags that modify the behaviour.
Rename the no-seqnum-update to be a flag called TDB_NOSEQNUM
Strip all the flags off the flags enum before using it in _tdb_store()
-----------------------------------------------------------------------
Summary of changes:
common/ctdb_ltdb.c | 2 +-
lib/tdb/common/tdb.c | 13 ++++++++-----
lib/tdb/configure.ac | 2 +-
lib/tdb/include/tdb.h | 6 ++++--
4 files changed, 14 insertions(+), 9 deletions(-)
Changeset truncated at 500 lines:
diff --git a/common/ctdb_ltdb.c b/common/ctdb_ltdb.c
index d3d1fbc..038c191 100644
--- a/common/ctdb_ltdb.c
+++ b/common/ctdb_ltdb.c
@@ -159,7 +159,7 @@ int ctdb_ltdb_store(struct ctdb_db_context *ctdb_db, TDB_DATA key,
&& !memcmp(old.dptr+sizeof(struct ctdb_ltdb_header),
rec.dptr+sizeof(struct ctdb_ltdb_header),
rec.dsize-sizeof(struct ctdb_ltdb_header)) ) {
- flag = TDB_REPLACE_NOSEQNUM;
+ flag |= TDB_NOSEQNUM;
}
if (old.dptr) free(old.dptr);
}
diff --git a/lib/tdb/common/tdb.c b/lib/tdb/common/tdb.c
index 9287bc0..694c52e 100644
--- a/lib/tdb/common/tdb.c
+++ b/lib/tdb/common/tdb.c
@@ -466,15 +466,18 @@ static tdb_off_t tdb_find_dead(struct tdb_context *tdb, uint32_t hash,
}
static int _tdb_store(struct tdb_context *tdb, TDB_DATA key,
- TDB_DATA dbuf, int flag, uint32_t hash)
+ TDB_DATA dbuf, int flags, uint32_t hash)
{
struct tdb_record rec;
tdb_off_t rec_ptr;
char *p = NULL;
int ret = -1;
+ int op;
+
+ op = flags&TDB_STORE_ENUM_MASK;
/* check for it existing, on insert. */
- if (flag == TDB_INSERT) {
+ if (op == TDB_INSERT) {
if (tdb_exists_hash(tdb, key, hash)) {
tdb->ecode = TDB_ERR_EXISTS;
goto fail;
@@ -485,7 +488,7 @@ static int _tdb_store(struct tdb_context *tdb, TDB_DATA key,
goto done;
}
if (tdb->ecode == TDB_ERR_NOEXIST &&
- flag == TDB_MODIFY) {
+ op == TDB_MODIFY) {
/* if the record doesn't exist and we are in TDB_MODIFY mode then
we should fail the store */
goto fail;
@@ -497,7 +500,7 @@ static int _tdb_store(struct tdb_context *tdb, TDB_DATA key,
/* delete any existing record - if it doesn't exist we don't
care. Doing this first reduces fragmentation, and avoids
coalescing with `allocated' block before it's updated. */
- if (flag != TDB_INSERT)
+ if (op != TDB_INSERT)
tdb_delete_hash(tdb, key, hash);
/* Copy key+value *before* allocating free space in case malloc
@@ -584,7 +587,7 @@ static int _tdb_store(struct tdb_context *tdb, TDB_DATA key,
ret = 0;
fail:
if (ret == 0) {
- if (flag != TDB_REPLACE_NOSEQNUM) {
+ if (!(flags & TDB_NOSEQNUM)) {
tdb_increment_seqnum(tdb);
}
}
diff --git a/lib/tdb/configure.ac b/lib/tdb/configure.ac
index 779f596..ef9a472 100644
--- a/lib/tdb/configure.ac
+++ b/lib/tdb/configure.ac
@@ -2,7 +2,7 @@ AC_PREREQ(2.50)
AC_DEFUN([SMB_MODULE_DEFAULT], [echo -n ""])
AC_DEFUN([SMB_LIBRARY_ENABLE], [echo -n ""])
AC_DEFUN([SMB_ENABLE], [echo -n ""])
-AC_INIT(tdb, 1.2.0)
+AC_INIT(tdb, 1.2.1)
AC_CONFIG_SRCDIR([common/tdb.c])
AC_CONFIG_HEADER(include/config.h)
AC_LIBREPLACE_ALL_CHECKS
diff --git a/lib/tdb/include/tdb.h b/lib/tdb/include/tdb.h
index 13cd6b6..7e72f89 100644
--- a/lib/tdb/include/tdb.h
+++ b/lib/tdb/include/tdb.h
@@ -32,11 +32,13 @@ extern "C" {
#include "signal.h"
-/* flags to tdb_store() */
+/* enums to tdb_store() */
#define TDB_REPLACE 1 /* Unused */
#define TDB_INSERT 2 /* Don't overwrite an existing entry */
#define TDB_MODIFY 3 /* Don't create an existing entry */
-#define TDB_REPLACE_NOSEQNUM 4 /* Replace but dont bump the seqnum */
+#define TDB_STORE_ENUM_MASK 0x0f
+ /* flags to tdb_store */
+#define TDB_NOSEQNUM 0x10 /* Don't bump the seqnum */
/* flags for tdb_open() */
#define TDB_DEFAULT 0 /* just a readability place holder */
--
CTDB repository
More information about the samba-cvs
mailing list