[SCM] Samba Shared Repository - branch master updated
Stefan Metzmacher
metze at samba.org
Fri Dec 21 05:55:03 MST 2012
The branch, master has been updated
via a444bb9 tdb: Add a comment explaining the "check"
via 3109b54 tdb: Make tdb_new_database() follow a more conventional style
via d972e6f tdb: Fix a typo
via c04de8f tdb: Fix a typo
via 24755d7 tdb: Use tdb_lock_covered_by_allrecord_lock in tdb_unlock
via f8dafe5 tdb: Factor out tdb_lock_covered_by_allrecord_lock from tdb_lock_list
via 26b8545 tdb: Simplify logic in tdb_lock_list slightly
via 0f4e7a1 tdb: Slightly simplify tdb_lock_list
via 116ec13 tdb: Fix blank line endings
via 7237fdd tdb: Fix a comment
via d2b852d tdb: Fix a typo
via 2c3fd8a tdb: Fix a missing CONVERT
from 2148d86 Fix bug #9196 - defer_open is triggered multiple times on the same request.
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit a444bb95a270ca5b331041c11a7e785c1e0559b7
Author: Volker Lendecke <vl at samba.org>
Date: Fri Dec 14 16:07:11 2012 +0100
tdb: Add a comment explaining the "check"
I had to ask git blame to find why we have to do it here...
Reviewed-by: Rusty Russell <rusty at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
Autobuild-User(master): Stefan Metzmacher <metze at samba.org>
Autobuild-Date(master): Fri Dec 21 13:54:39 CET 2012 on sn-devel-104
commit 3109b541c9b2f0063e1ccb0cdaec0a8e388b29b4
Author: Volker Lendecke <vl at samba.org>
Date: Fri Dec 14 15:53:08 2012 +0100
tdb: Make tdb_new_database() follow a more conventional style
We usually "goto fail" on every error and then in normal flow set the
return variable to success. This patch removes a comment which from my
point of view is now obsolete. It violates the {} rule from README.Coding
here in favor of the style used in this function.
Reviewed-by: Rusty Russell <rusty at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
commit d972e6fa74b6499403d4c3d3c6a84cbda7eded39
Author: Volker Lendecke <vl at samba.org>
Date: Fri Dec 14 14:50:08 2012 +0100
tdb: Fix a typo
Reviewed-by: Rusty Russell <rusty at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
commit c04de8f3a4deba0062f8cdbcbe74d3735a80b735
Author: Volker Lendecke <vl at samba.org>
Date: Fri Dec 14 14:48:31 2012 +0100
tdb: Fix a typo
Reviewed-by: Rusty Russell <rusty at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
commit 24755d75b0ee7170195bc26cf28bab4ffdb6f752
Author: Volker Lendecke <vl at samba.org>
Date: Fri Dec 14 09:24:06 2012 +0100
tdb: Use tdb_lock_covered_by_allrecord_lock in tdb_unlock
Reviewed-by: Rusty Russell <rusty at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
commit f8dafe5685008671f4f983a4defc90b4a05cf992
Author: Volker Lendecke <vl at samba.org>
Date: Fri Dec 14 09:21:42 2012 +0100
tdb: Factor out tdb_lock_covered_by_allrecord_lock from tdb_lock_list
Reviewed-by: Rusty Russell <rusty at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
commit 26b8545df44df7e60ba0ba7336ffbdda8a14e423
Author: Volker Lendecke <vl at samba.org>
Date: Thu Dec 13 22:14:34 2012 +0100
tdb: Simplify logic in tdb_lock_list slightly
Reviewed-by: Rusty Russell <rusty at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
commit 0f4e7a1401998746a6818b9469ab369d70418ac1
Author: Volker Lendecke <vl at samba.org>
Date: Thu Dec 13 21:58:00 2012 +0100
tdb: Slightly simplify tdb_lock_list
Avoid an else {} branch when we can do an early return
Reviewed-by: Rusty Russell <rusty at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
commit 116ec13bb0718eb1de1ac1f4410d5c33f1db616f
Author: Volker Lendecke <vl at samba.org>
Date: Thu Dec 13 13:31:59 2012 +0100
tdb: Fix blank line endings
Reviewed-by: Rusty Russell <rusty at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
commit 7237fdd4ddc0b9c848b5936431b4f8731ce56dba
Author: Volker Lendecke <vl at samba.org>
Date: Fri Dec 14 08:01:12 2012 +0100
tdb: Fix a comment
Reviewed-by: Rusty Russell <rusty at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
commit d2b852d79bd83754d8952a0e3dece00e513549f2
Author: Volker Lendecke <vl at samba.org>
Date: Thu Dec 13 12:36:29 2012 +0100
tdb: Fix a typo
Reviewed-by: Rusty Russell <rusty at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
commit 2c3fd8a13e7dde23a23404cd88078a04c8b338ea
Author: Volker Lendecke <vl at samba.org>
Date: Tue Dec 11 21:04:58 2012 +0100
tdb: Fix a missing CONVERT
methods->tdb_write expects data in on-disk format. For reading that
record, methods->tdb_read() has taken care of the on-disk to in-memory
representation according to the DOCONV() flag passed down. tdb_rec_write()
is a wrapper around methods->tdb_write just doing the CONVERT() on the
way to disk.
Reviewed-by: Rusty Russell <rusty at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
-----------------------------------------------------------------------
Summary of changes:
lib/tdb/common/dump.c | 10 +++---
lib/tdb/common/error.c | 2 +-
lib/tdb/common/freelist.c | 26 +++++++-------
lib/tdb/common/io.c | 18 +++++-----
lib/tdb/common/lock.c | 78 ++++++++++++++++++++++++++---------------
lib/tdb/common/open.c | 13 ++++---
lib/tdb/common/summary.c | 4 +-
lib/tdb/common/tdb.c | 20 +++++-----
lib/tdb/common/tdb_private.h | 2 +-
lib/tdb/common/transaction.c | 74 ++++++++++++++++++++--------------------
lib/tdb/common/traverse.c | 16 ++++----
11 files changed, 142 insertions(+), 121 deletions(-)
Changeset truncated at 500 lines:
diff --git a/lib/tdb/common/dump.c b/lib/tdb/common/dump.c
index 67de04e..207bb24 100644
--- a/lib/tdb/common/dump.c
+++ b/lib/tdb/common/dump.c
@@ -1,4 +1,4 @@
- /*
+ /*
Unix SMB/CIFS implementation.
trivial database library
@@ -33,7 +33,7 @@ static tdb_off_t tdb_dump_record(struct tdb_context *tdb, int hash,
struct tdb_record rec;
tdb_off_t tailer_ofs, tailer;
- if (tdb->methods->tdb_read(tdb, offset, (char *)&rec,
+ if (tdb->methods->tdb_read(tdb, offset, (char *)&rec,
sizeof(rec), DOCONV()) == -1) {
printf("ERROR: failed to read record at %u\n", offset);
return 0;
@@ -110,7 +110,7 @@ _PUBLIC_ int tdb_printfreelist(struct tdb_context *tdb)
printf("freelist top=[0x%08x]\n", rec_ptr );
while (rec_ptr) {
- if (tdb->methods->tdb_read(tdb, rec_ptr, (char *)&rec,
+ if (tdb->methods->tdb_read(tdb, rec_ptr, (char *)&rec,
sizeof(rec), DOCONV()) == -1) {
tdb_unlock(tdb, -1, F_WRLCK);
return -1;
@@ -122,14 +122,14 @@ _PUBLIC_ int tdb_printfreelist(struct tdb_context *tdb)
return -1;
}
- printf("entry offset=[0x%08x], rec.rec_len = [0x%08x (%d)] (end = 0x%08x)\n",
+ printf("entry offset=[0x%08x], rec.rec_len = [0x%08x (%d)] (end = 0x%08x)\n",
rec_ptr, rec.rec_len, rec.rec_len, rec_ptr + rec.rec_len);
total_free += rec.rec_len;
/* move to the next record */
rec_ptr = rec.next;
}
- printf("total rec_len = [0x%08x (%d)]\n", (int)total_free,
+ printf("total rec_len = [0x%08x (%d)]\n", (int)total_free,
(int)total_free);
return tdb_unlock(tdb, -1, F_WRLCK);
diff --git a/lib/tdb/common/error.c b/lib/tdb/common/error.c
index 2aaaa81..478eb88 100644
--- a/lib/tdb/common/error.c
+++ b/lib/tdb/common/error.c
@@ -1,4 +1,4 @@
- /*
+ /*
Unix SMB/CIFS implementation.
trivial database library
diff --git a/lib/tdb/common/freelist.c b/lib/tdb/common/freelist.c
index 6358f64..0de1fb4 100644
--- a/lib/tdb/common/freelist.c
+++ b/lib/tdb/common/freelist.c
@@ -1,4 +1,4 @@
- /*
+ /*
Unix SMB/CIFS implementation.
trivial database library
@@ -28,7 +28,7 @@
#include "tdb_private.h"
/* 'right' merges can involve O(n^2) cost when combined with a
- traverse, so they are disabled until we find a way to do them in
+ traverse, so they are disabled until we find a way to do them in
O(1) time
*/
#define USE_RIGHT_MERGES 0
@@ -42,17 +42,17 @@ int tdb_rec_free_read(struct tdb_context *tdb, tdb_off_t off, struct tdb_record
if (rec->magic == TDB_MAGIC) {
/* this happens when a app is showdown while deleting a record - we should
not completely fail when this happens */
- TDB_LOG((tdb, TDB_DEBUG_WARNING, "tdb_rec_free_read non-free magic 0x%x at offset=%d - fixing\n",
+ TDB_LOG((tdb, TDB_DEBUG_WARNING, "tdb_rec_free_read non-free magic 0x%x at offset=%d - fixing\n",
rec->magic, off));
rec->magic = TDB_FREE_MAGIC;
- if (tdb->methods->tdb_write(tdb, off, rec, sizeof(*rec)) == -1)
+ if (tdb_rec_write(tdb, off, rec) == -1)
return -1;
}
if (rec->magic != TDB_FREE_MAGIC) {
/* Ensure ecode is set for log fn. */
tdb->ecode = TDB_ERR_CORRUPT;
- TDB_LOG((tdb, TDB_DEBUG_WARNING, "tdb_rec_free_read bad magic 0x%x at offset=%d\n",
+ TDB_LOG((tdb, TDB_DEBUG_WARNING, "tdb_rec_free_read bad magic 0x%x at offset=%d\n",
rec->magic, off));
return -1;
}
@@ -170,7 +170,7 @@ left:
/* If it's free, expand to include it. */
if (l.magic == TDB_FREE_MAGIC) {
- /* we now merge the new record into the left record, rather than the other
+ /* we now merge the new record into the left record, rather than the other
way around. This makes the operation O(1) instead of O(n). This change
prevents traverse from being O(n^2) after a lot of deletes */
l.rec_len += sizeof(*rec) + rec->rec_len;
@@ -210,7 +210,7 @@ update:
-/*
+/*
the core of tdb_allocate - called when we have decided which
free list entry to use
@@ -218,7 +218,7 @@ update:
not the beginning. This is so the left merge in a free is more likely to be
able to free up the record without fragmentation
*/
-static tdb_off_t tdb_allocate_ofs(struct tdb_context *tdb,
+static tdb_off_t tdb_allocate_ofs(struct tdb_context *tdb,
tdb_len_t length, tdb_off_t rec_ptr,
struct tdb_record *rec, tdb_off_t last_ptr)
{
@@ -250,7 +250,7 @@ static tdb_off_t tdb_allocate_ofs(struct tdb_context *tdb,
}
/* and setup the new record */
- rec_ptr += sizeof(*rec) + rec->rec_len;
+ rec_ptr += sizeof(*rec) + rec->rec_len;
memset(rec, '\0', sizeof(*rec));
rec->rec_len = length;
@@ -303,7 +303,7 @@ tdb_off_t tdb_allocate(struct tdb_context *tdb, tdb_len_t length, struct tdb_rec
bestfit.last_ptr = 0;
bestfit.rec_len = 0;
- /*
+ /*
this is a best fit allocation strategy. Originally we used
a first fit strategy, but it suffered from massive fragmentation
issues when faced with a slowly increasing record size.
@@ -347,7 +347,7 @@ tdb_off_t tdb_allocate(struct tdb_context *tdb, tdb_len_t length, struct tdb_rec
goto fail;
}
- newrec_ptr = tdb_allocate_ofs(tdb, length, bestfit.rec_ptr,
+ newrec_ptr = tdb_allocate_ofs(tdb, length, bestfit.rec_ptr,
rec, bestfit.last_ptr);
tdb_unlock(tdb, -1, F_WRLCK);
return newrec_ptr;
@@ -364,8 +364,8 @@ tdb_off_t tdb_allocate(struct tdb_context *tdb, tdb_len_t length, struct tdb_rec
-/*
- return the size of the freelist - used to decide if we should repack
+/*
+ return the size of the freelist - used to decide if we should repack
*/
_PUBLIC_ int tdb_freelist_size(struct tdb_context *tdb)
{
diff --git a/lib/tdb/common/io.c b/lib/tdb/common/io.c
index 25968bf..2e0a206 100644
--- a/lib/tdb/common/io.c
+++ b/lib/tdb/common/io.c
@@ -1,4 +1,4 @@
- /*
+ /*
Unix SMB/CIFS implementation.
trivial database library
@@ -30,7 +30,7 @@
/* check for an out of bounds access - if it is out of bounds then
see if the database has been expanded by someone else and expand
- if necessary
+ if necessary
*/
static int tdb_oob(struct tdb_context *tdb, tdb_off_t off, tdb_len_t len,
int probe)
@@ -100,7 +100,7 @@ static int tdb_oob(struct tdb_context *tdb, tdb_off_t off, tdb_len_t len,
}
/* write a lump of data at a specified offset */
-static int tdb_write(struct tdb_context *tdb, tdb_off_t off,
+static int tdb_write(struct tdb_context *tdb, tdb_off_t off,
const void *buf, tdb_len_t len)
{
if (len == 0) {
@@ -162,7 +162,7 @@ void *tdb_convert(void *buf, uint32_t size)
/* read a lump of data at a specified offset, maybe convert */
-static int tdb_read(struct tdb_context *tdb, tdb_off_t off, void *buf,
+static int tdb_read(struct tdb_context *tdb, tdb_off_t off, void *buf,
tdb_len_t len, int cv)
{
if (tdb->methods->tdb_oob(tdb, off, len, 0) != 0) {
@@ -199,7 +199,7 @@ static int tdb_read(struct tdb_context *tdb, tdb_off_t off, void *buf,
/*
do an unlocked scan of the hash table heads to find the next non-zero head. The value
will then be confirmed with the lock held
-*/
+*/
static void tdb_next_hash_chain(struct tdb_context *tdb, uint32_t *chain)
{
uint32_t h = *chain;
@@ -256,8 +256,8 @@ int tdb_mmap(struct tdb_context *tdb)
#ifdef HAVE_MMAP
if (should_mmap(tdb)) {
- tdb->map_ptr = mmap(NULL, tdb->map_size,
- PROT_READ|(tdb->read_only? 0:PROT_WRITE),
+ tdb->map_ptr = mmap(NULL, tdb->map_size,
+ PROT_READ|(tdb->read_only? 0:PROT_WRITE),
MAP_SHARED|MAP_FILE, tdb->fd, 0);
/*
@@ -266,7 +266,7 @@ int tdb_mmap(struct tdb_context *tdb)
if (tdb->map_ptr == MAP_FAILED) {
tdb->map_ptr = NULL;
- TDB_LOG((tdb, TDB_DEBUG_WARNING, "tdb_mmap failed for size %d (%s)\n",
+ TDB_LOG((tdb, TDB_DEBUG_WARNING, "tdb_mmap failed for size %d (%s)\n",
tdb->map_size, strerror(errno)));
#ifdef HAVE_INCOHERENT_MMAP
tdb->ecode = TDB_ERR_IO;
@@ -305,7 +305,7 @@ static int tdb_expand_file(struct tdb_context *tdb, tdb_off_t size, tdb_off_t ad
errno = ENOSPC;
}
if (written != 1) {
- TDB_LOG((tdb, TDB_DEBUG_FATAL, "expand_file to %d failed (%s)\n",
+ TDB_LOG((tdb, TDB_DEBUG_FATAL, "expand_file to %d failed (%s)\n",
size+addition, strerror(errno)));
return -1;
}
diff --git a/lib/tdb/common/lock.c b/lib/tdb/common/lock.c
index 260fab6..7155a9f 100644
--- a/lib/tdb/common/lock.c
+++ b/lib/tdb/common/lock.c
@@ -1,4 +1,4 @@
- /*
+ /*
Unix SMB/CIFS implementation.
trivial database library
@@ -126,10 +126,10 @@ static tdb_off_t lock_offset(int list)
}
/* a byte range locking function - return 0 on success
- this functions locks/unlocks 1 byte at the specified offset.
+ this functions locks/unlocks "len" byte at the specified offset.
On error, errno is also set so that errors are passed back properly
- through tdb_open().
+ through tdb_open().
note that a len of zero means lock to end of file
*/
@@ -201,7 +201,7 @@ int tdb_brunlock(struct tdb_context *tdb,
upgrade a read lock to a write lock. This needs to be handled in a
special way as some OSes (such as solaris) have too conservative
deadlock detection and claim a deadlock when progress can be
- made. For those OSes we may loop for a while.
+ made. For those OSes we may loop for a while.
*/
int tdb_allrecord_upgrade(struct tdb_context *tdb)
{
@@ -334,34 +334,60 @@ static bool have_data_locks(const struct tdb_context *tdb)
return false;
}
+/*
+ * A allrecord lock allows us to avoid per chain locks. Check if the allrecord
+ * lock is strong enough.
+ */
+static int tdb_lock_covered_by_allrecord_lock(struct tdb_context *tdb,
+ int ltype)
+{
+ if (ltype == F_RDLCK) {
+ /*
+ * The allrecord_lock is equal (F_RDLCK) or stronger
+ * (F_WRLCK). Pass.
+ */
+ return 0;
+ }
+
+ if (tdb->allrecord_lock.ltype == F_RDLCK) {
+ /*
+ * We ask for ltype==F_WRLCK, but the allrecord_lock
+ * is too weak. We can't upgrade here, so fail.
+ */
+ tdb->ecode = TDB_ERR_LOCK;
+ return -1;
+ }
+
+ /*
+ * Asking for F_WRLCK, allrecord is F_WRLCK as well. Pass.
+ */
+ return 0;
+}
+
static int tdb_lock_list(struct tdb_context *tdb, int list, int ltype,
enum tdb_lock_flags waitflag)
{
int ret;
bool check = false;
- /* a allrecord lock allows us to avoid per chain locks */
- if (tdb->allrecord_lock.count &&
- (ltype == tdb->allrecord_lock.ltype || ltype == F_RDLCK)) {
- return 0;
+ if (tdb->allrecord_lock.count) {
+ return tdb_lock_covered_by_allrecord_lock(tdb, ltype);
}
- if (tdb->allrecord_lock.count) {
- tdb->ecode = TDB_ERR_LOCK;
- ret = -1;
- } else {
- /* Only check when we grab first data lock. */
- check = !have_data_locks(tdb);
- ret = tdb_nest_lock(tdb, lock_offset(list), ltype, waitflag);
+ /*
+ * Check for recoveries: Someone might have kill -9'ed a process
+ * during a commit.
+ */
+ check = !have_data_locks(tdb);
+ ret = tdb_nest_lock(tdb, lock_offset(list), ltype, waitflag);
- if (ret == 0 && check && tdb_needs_recovery(tdb)) {
- tdb_nest_unlock(tdb, lock_offset(list), ltype, false);
+ if (ret == 0 && check && tdb_needs_recovery(tdb)) {
+ tdb_nest_unlock(tdb, lock_offset(list), ltype, false);
- if (tdb_lock_and_recover(tdb) == -1) {
- return -1;
- }
- return tdb_lock_list(tdb, list, ltype, waitflag);
+ if (tdb_lock_and_recover(tdb) == -1) {
+ return -1;
}
+ return tdb_lock_list(tdb, list, ltype, waitflag);
}
return ret;
}
@@ -441,21 +467,15 @@ int tdb_nest_unlock(struct tdb_context *tdb, uint32_t offset, int ltype,
}
if (ret)
- TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_unlock: An error occurred unlocking!\n"));
+ TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_unlock: An error occurred unlocking!\n"));
return ret;
}
_PUBLIC_ int tdb_unlock(struct tdb_context *tdb, int list, int ltype)
{
/* a global lock allows us to avoid per chain locks */
- if (tdb->allrecord_lock.count &&
- (ltype == tdb->allrecord_lock.ltype || ltype == F_RDLCK)) {
- return 0;
- }
-
if (tdb->allrecord_lock.count) {
- tdb->ecode = TDB_ERR_LOCK;
- return -1;
+ return tdb_lock_covered_by_allrecord_lock(tdb, ltype);
}
return tdb_nest_unlock(tdb, lock_offset(list), ltype, false);
diff --git a/lib/tdb/common/open.c b/lib/tdb/common/open.c
index d9f76f0..b10f5eb 100644
--- a/lib/tdb/common/open.c
+++ b/lib/tdb/common/open.c
@@ -1,4 +1,4 @@
- /*
+ /*
Unix SMB/CIFS implementation.
trivial database library
@@ -94,10 +94,11 @@ static int tdb_new_database(struct tdb_context *tdb, int hash_size)
memcpy(&tdb->header, newdb, sizeof(tdb->header));
/* Don't endian-convert the magic food! */
memcpy(newdb->magic_food, TDB_MAGIC_FOOD, strlen(TDB_MAGIC_FOOD)+1);
- /* we still have "ret == -1" here */
- if (tdb_write_all(tdb->fd, newdb, size))
- ret = 0;
+ if (!tdb_write_all(tdb->fd, newdb, size))
+ goto fail;
+
+ ret = 0;
fail:
SAFE_FREE(newdb);
return ret;
@@ -119,13 +120,13 @@ static int tdb_already_open(dev_t device,
return 0;
}
-/* open the database, creating it if necessary
+/* open the database, creating it if necessary
The open_flags and mode are passed straight to the open call on the
database file. A flags value of O_WRONLY is invalid. The hash size
is advisory, use zero for a default value.
- Return is NULL on error, in which case errno is also set. Don't
+ Return is NULL on error, in which case errno is also set. Don't
try to call tdb_error or tdb_errname, just do strerror(errno).
@param name may be NULL for internal databases. */
diff --git a/lib/tdb/common/summary.c b/lib/tdb/common/summary.c
index 171a1a2..8257261 100644
--- a/lib/tdb/common/summary.c
+++ b/lib/tdb/common/summary.c
@@ -1,7 +1,7 @@
- /*
+ /*
Trivial Database: human-readable summary code
Copyright (C) Rusty Russell 2010
-
+
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
diff --git a/lib/tdb/common/tdb.c b/lib/tdb/common/tdb.c
index fc1f560..7d1a40e 100644
--- a/lib/tdb/common/tdb.c
+++ b/lib/tdb/common/tdb.c
@@ -1,4 +1,4 @@
- /*
+ /*
Unix SMB/CIFS implementation.
trivial database library
@@ -152,7 +152,7 @@ static int tdb_update_hash(struct tdb_context *tdb, TDB_DATA key, uint32_t hash,
/* it could be an exact duplicate of what is there - this is
* surprisingly common (eg. with a ldb re-index). */
- if (rec.key_len == key.dsize &&
+ if (rec.key_len == key.dsize &&
rec.data_len == dbuf.dsize &&
rec.full_hash == hash &&
tdb_parse_record(tdb, key, tdb_update_hash_cmp, &dbuf) == 0) {
@@ -258,7 +258,7 @@ _PUBLIC_ int tdb_parse_record(struct tdb_context *tdb, TDB_DATA key,
return ret;
}
-/* check if an entry in the database exists
+/* check if an entry in the database exists
note that 1 is returned if the key is found and 0 is returned if not found
this doesn't match the conventions in the rest of this module, but is
@@ -777,7 +777,7 @@ _PUBLIC_ void tdb_enable_seqnum(struct tdb_context *tdb)
/*
- add a region of the file to the freelist. Length is the size of the region in bytes,
+ add a region of the file to the freelist. Length is the size of the region in bytes,
which includes the free list header that needs to be added
*/
static int tdb_free_region(struct tdb_context *tdb, tdb_off_t offset, ssize_t length)
@@ -789,7 +789,7 @@ static int tdb_free_region(struct tdb_context *tdb, tdb_off_t offset, ssize_t le
}
if (length + offset > tdb->map_size) {
TDB_LOG((tdb, TDB_DEBUG_FATAL,"tdb_free_region: adding region beyond end of file\n"));
- return -1;
+ return -1;
}
memset(&rec,'\0',sizeof(rec));
rec.rec_len = length - sizeof(rec);
@@ -835,7 +835,7 @@ _PUBLIC_ int tdb_wipe_all(struct tdb_context *tdb)
if (tdb->methods->tdb_read(tdb, recovery_head, &rec, sizeof(rec), DOCONV()) == -1) {
TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_wipe_all: failed to read recovery record\n"));
return -1;
- }
+ }
recovery_size = rec.rec_len + sizeof(rec);
}
@@ -853,7 +853,7 @@ _PUBLIC_ int tdb_wipe_all(struct tdb_context *tdb)
goto failed;
}
- /* add all the rest of the file to the freelist, possibly leaving a gap
+ /* add all the rest of the file to the freelist, possibly leaving a gap
for the recovery area */
if (recovery_size == 0) {
/* the simple case - the whole file can be used as a freelist */
@@ -863,7 +863,7 @@ _PUBLIC_ int tdb_wipe_all(struct tdb_context *tdb)
}
} else {
/* we need to add two freelist entries - one on either
- side of the recovery area
+ side of the recovery area
Note that we cannot shift the recovery area during
this operation. Only the transaction.c code may
@@ -942,7 +942,7 @@ _PUBLIC_ int tdb_repack(struct tdb_context *tdb)
TDB_LOG((tdb, TDB_DEBUG_FATAL, __location__ " Failed to traverse copying out\n"));
tdb_transaction_cancel(tdb);
--
Samba Shared Repository
More information about the samba-cvs
mailing list