dbwrap: add a dbwrap_flags argument to db_open_tdb()
authorMichael Adam <obnox@samba.org>
Tue, 28 Jan 2014 11:33:42 +0000 (12:33 +0100)
committerStefan Metzmacher <metze@samba.org>
Fri, 7 Feb 2014 15:06:07 +0000 (16:06 +0100)
...for consistency and in preparation of future flags
that the tdb backend might be aware of.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
lib/dbwrap/dbwrap_local_open.c
lib/dbwrap/dbwrap_tdb.c
lib/dbwrap/dbwrap_tdb.h
source3/smbd/notify_internal.c
source4/ntvfs/posix/python/pyxattr_tdb.c

index 56048afa849ff5c24a18f42319d4dea1303be5e8..650bcb35df2437f8c0b87f927c5f8d32b046bd5d 100644 (file)
@@ -103,7 +103,7 @@ static bool tdb_to_ntdb(TALLOC_CTX *ctx, struct loadparm_context *lp_ctx,
                return false;
        }
        tdb = db_open_tdb(ctx, lp_ctx, tdbname, 0,
-                         TDB_DEFAULT, O_RDONLY, 0, 0);
+                         TDB_DEFAULT, O_RDONLY, 0, 0, DBWRAP_FLAG_NONE);
        if (!tdb) {
                DEBUG(0, ("tdb_to_ntdb: could not open %s: %s\n",
                          tdbname, strerror(errno)));
@@ -213,7 +213,7 @@ struct db_context *dbwrap_local_open(TALLOC_CTX *mem_ctx,
                }
                db = db_open_tdb(mem_ctx, lp_ctx, tdbname, hash_size,
                                 tdb_flags, open_flags, mode,
-                                lock_order);
+                                lock_order, dbwrap_flags);
        }
 out:
        talloc_free(tmp_ctx);
index 3f21192233a3a50b2039e4e10215271498dc5384..1b061e3fdf456440f8a73e698588e58c1134e96f 100644 (file)
@@ -401,7 +401,8 @@ struct db_context *db_open_tdb(TALLOC_CTX *mem_ctx,
                               const char *name,
                               int hash_size, int tdb_flags,
                               int open_flags, mode_t mode,
-                              enum dbwrap_lock_order lock_order)
+                              enum dbwrap_lock_order lock_order,
+                              uint64_t dbrwap_flags)
 {
        struct db_context *result = NULL;
        struct db_tdb_ctx *db_tdb;
index 6a6da45a084f645d9ce37a5fe2b35aca61d65255..93ee09c60576a7bc656a5a2daa93ffe98f2fbc7d 100644 (file)
@@ -29,7 +29,8 @@ struct db_context *db_open_tdb(TALLOC_CTX *mem_ctx,
                               const char *name,
                               int hash_size, int tdb_flags,
                               int open_flags, mode_t mode,
-                              enum dbwrap_lock_order lock_order);
+                              enum dbwrap_lock_order lock_order,
+                              uint64_t dbwrap_flags);
 
 
 #endif /* __DBWRAP_TDB_H__ */
index 0a7e5dea22f390e7d0a7cc1c3d823d5a7deb36a6..4d885651bae89aa189e57b0c4a5c69468125c0dc 100644 (file)
@@ -137,7 +137,7 @@ struct notify_context *notify_init(TALLOC_CTX *mem_ctx,
        notify->db_notify = db_open_tdb(
                notify, lp_ctx, lock_path("notify.tdb"),
                0, TDB_CLEAR_IF_FIRST|TDB_INCOMPATIBLE_HASH,
-               O_RDWR|O_CREAT, 0644, DBWRAP_LOCK_ORDER_2);
+               O_RDWR|O_CREAT, 0644, DBWRAP_LOCK_ORDER_2, DBWRAP_FLAG_NONE);
                talloc_unlink(notify, lp_ctx);
        if (notify->db_notify == NULL) {
                goto fail;
index b5109317dd6dfb75d8859f32c9a37b338387907f..b866d7eea811882f5fc917aa55ca9f6f732b1a77 100644 (file)
@@ -57,7 +57,8 @@ static PyObject *py_wrap_setxattr(PyObject *self, PyObject *args)
        blob.length = blobsize;
        mem_ctx = talloc_new(NULL);
        eadb = db_open_tdb(mem_ctx, py_default_loadparm_context(mem_ctx), tdbname, 50000,
-                          TDB_DEFAULT, O_RDWR|O_CREAT, 0600, DBWRAP_LOCK_ORDER_2);
+                          TDB_DEFAULT, O_RDWR|O_CREAT, 0600, DBWRAP_LOCK_ORDER_2,
+                          DBWRAP_FLAG_NONE);
 
        if (eadb == NULL) {
                PyErr_SetFromErrno(PyExc_IOError);
@@ -104,7 +105,8 @@ static PyObject *py_wrap_getxattr(PyObject *self, PyObject *args)
        mem_ctx = talloc_new(NULL);
 
        eadb = db_open_tdb(mem_ctx, py_default_loadparm_context(mem_ctx), tdbname, 50000,
-                          TDB_DEFAULT, O_RDWR|O_CREAT, 0600, DBWRAP_LOCK_ORDER_2);
+                          TDB_DEFAULT, O_RDWR|O_CREAT, 0600, DBWRAP_LOCK_ORDER_2,
+                          DBWRAP_FLAG_NONE);
 
        if (eadb == NULL) {
                PyErr_SetFromErrno(PyExc_IOError);