]> git.ozlabs.org Git - ccan/blobdiff - ccan/tdb2/tdb1_open.c
tdb2: remove TDB1 TDB_NO_FSYNC environment variable hack.
[ccan] / ccan / tdb2 / tdb1_open.c
index 7b548c1d05da11c43c362f120c5ff66aa3ac66b8..aed4df65585bf8c45f353f1ccbfbda6bb29943aa 100644 (file)
@@ -129,7 +129,7 @@ static int tdb1_already_open(dev_t device,
    try to call tdb1_error or tdb1_errname, just do strerror(errno).
 
    @param name may be NULL for internal databases. */
-_PUBLIC_ struct tdb1_context *tdb1_open(const char *name, int hash_size, int tdb1_flags,
+struct tdb1_context *tdb1_open(const char *name, int hash_size, int tdb1_flags,
                      int open_flags, mode_t mode)
 {
        return tdb1_open_ex(name, hash_size, tdb1_flags, open_flags, mode, NULL, NULL);
@@ -162,7 +162,7 @@ static bool check_header_hash(struct tdb1_context *tdb,
        return check_header_hash(tdb, false, m1, m2);
 }
 
-_PUBLIC_ struct tdb1_context *tdb1_open_ex(const char *name, int hash_size, int tdb1_flags,
+struct tdb1_context *tdb1_open_ex(const char *name, int hash_size, int tdb1_flags,
                                int open_flags, mode_t mode,
                                const struct tdb1_logging_context *log_ctx,
                                tdb1_hash_func hash_fn)
@@ -266,10 +266,6 @@ _PUBLIC_ struct tdb1_context *tdb1_open_ex(const char *name, int hash_size, int
                goto fail;
        }
 
-       if (getenv("TDB_NO_FSYNC")) {
-               tdb->flags |= TDB1_NOSYNC;
-       }
-
        /*
         * TDB1_ALLOW_NESTING is the default behavior.
         * Note: this may change in future versions!
@@ -387,7 +383,7 @@ _PUBLIC_ struct tdb1_context *tdb1_open_ex(const char *name, int hash_size, int
        tdb->inode = st.st_ino;
        tdb1_mmap(tdb);
        if (locked) {
-               if (tdb1_nest_unlock(tdb, TDB1_ACTIVE_LOCK, F_WRLCK, false) == -1) {
+               if (tdb1_nest_unlock(tdb, TDB1_ACTIVE_LOCK, F_WRLCK) == -1) {
                        TDB1_LOG((tdb, TDB1_DEBUG_ERROR, "tdb1_open_ex: "
                                 "failed to release ACTIVE_LOCK on %s: %s\n",
                                 name, strerror(errno)));
@@ -416,7 +412,7 @@ _PUBLIC_ struct tdb1_context *tdb1_open_ex(const char *name, int hash_size, int
        /* Internal (memory-only) databases skip all the code above to
         * do with disk files, and resume here by releasing their
         * open lock and hooking into the active list. */
-       if (tdb1_nest_unlock(tdb, TDB1_OPEN_LOCK, F_WRLCK, false) == -1) {
+       if (tdb1_nest_unlock(tdb, TDB1_OPEN_LOCK, F_WRLCK) == -1) {
                goto fail;
        }
        tdb->next = tdb1s;
@@ -450,7 +446,7 @@ _PUBLIC_ struct tdb1_context *tdb1_open_ex(const char *name, int hash_size, int
  * Set the maximum number of dead records per hash chain
  */
 
-_PUBLIC_ void tdb1_set_max_dead(struct tdb1_context *tdb, int max_dead)
+void tdb1_set_max_dead(struct tdb1_context *tdb, int max_dead)
 {
        tdb->max_dead_records = max_dead;
 }
@@ -460,7 +456,7 @@ _PUBLIC_ void tdb1_set_max_dead(struct tdb1_context *tdb, int max_dead)
  *
  * @returns -1 for error; 0 for success.
  **/
-_PUBLIC_ int tdb1_close(struct tdb1_context *tdb)
+int tdb1_close(struct tdb1_context *tdb)
 {
        struct tdb1_context **i;
        int ret = 0;