summaryrefslogtreecommitdiff
path: root/lib/tdb
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2012-12-13 13:31:59 +0100
committerStefan Metzmacher <metze@samba.org>2012-12-21 11:54:53 +0100
commit116ec13bb0718eb1de1ac1f4410d5c33f1db616f (patch)
tree7a014c55dd3be8cdec45ac3b91bd7eb229dbaf33 /lib/tdb
parent7237fdd4ddc0b9c848b5936431b4f8731ce56dba (diff)
downloadsamba-116ec13bb0718eb1de1ac1f4410d5c33f1db616f.tar.gz
samba-116ec13bb0718eb1de1ac1f4410d5c33f1db616f.tar.bz2
samba-116ec13bb0718eb1de1ac1f4410d5c33f1db616f.zip
tdb: Fix blank line endings
Reviewed-by: Rusty Russell <rusty@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'lib/tdb')
-rw-r--r--lib/tdb/common/dump.c10
-rw-r--r--lib/tdb/common/error.c2
-rw-r--r--lib/tdb/common/freelist.c24
-rw-r--r--lib/tdb/common/io.c18
-rw-r--r--lib/tdb/common/lock.c8
-rw-r--r--lib/tdb/common/open.c6
-rw-r--r--lib/tdb/common/summary.c4
-rw-r--r--lib/tdb/common/tdb.c20
-rw-r--r--lib/tdb/common/tdb_private.h2
-rw-r--r--lib/tdb/common/transaction.c72
-rw-r--r--lib/tdb/common/traverse.c12
11 files changed, 89 insertions, 89 deletions
diff --git a/lib/tdb/common/dump.c b/lib/tdb/common/dump.c
index 67de04e37c..207bb24d28 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 2aaaa8134e..478eb887ff 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 5312c2a978..0de1fb4ecf 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,7 +42,7 @@ 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_rec_write(tdb, off, rec) == -1)
@@ -52,7 +52,7 @@ int tdb_rec_free_read(struct tdb_context *tdb, tdb_off_t off, struct tdb_record
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 25968bfef2..2e0a206c2c 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 b3299e5500..74ead7be05 100644
--- a/lib/tdb/common/lock.c
+++ b/lib/tdb/common/lock.c
@@ -1,4 +1,4 @@
- /*
+ /*
Unix SMB/CIFS implementation.
trivial database library
@@ -129,7 +129,7 @@ static tdb_off_t lock_offset(int list)
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)
{
@@ -441,7 +441,7 @@ 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;
}
diff --git a/lib/tdb/common/open.c b/lib/tdb/common/open.c
index d9f76f0835..694701f69d 100644
--- a/lib/tdb/common/open.c
+++ b/lib/tdb/common/open.c
@@ -1,4 +1,4 @@
- /*
+ /*
Unix SMB/CIFS implementation.
trivial database library
@@ -119,13 +119,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 171a1a2055..82572616e4 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 fc1f5608fa..7d1a40ea22 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);
tdb_close(tmp_db);
- return -1;
+ return -1;
}
if (state.error) {
@@ -966,7 +966,7 @@ _PUBLIC_ int tdb_repack(struct tdb_context *tdb)
TDB_LOG((tdb, TDB_DEBUG_FATAL, __location__ " Failed to traverse copying back\n"));
tdb_transaction_cancel(tdb);
tdb_close(tmp_db);
- return -1;
+ return -1;
}
if (state.error) {
diff --git a/lib/tdb/common/tdb_private.h b/lib/tdb/common/tdb_private.h
index 0441fb287f..bbe8977bb0 100644
--- a/lib/tdb/common/tdb_private.h
+++ b/lib/tdb/common/tdb_private.h
@@ -1,6 +1,6 @@
#ifndef TDB_PRIVATE_H
#define TDB_PRIVATE_H
- /*
+ /*
Unix SMB/CIFS implementation.
trivial database library - private includes
diff --git a/lib/tdb/common/transaction.c b/lib/tdb/common/transaction.c
index 5cd79501ae..ee9beeb3d3 100644
--- a/lib/tdb/common/transaction.c
+++ b/lib/tdb/common/transaction.c
@@ -1,4 +1,4 @@
- /*
+ /*
Unix SMB/CIFS implementation.
trivial database library
@@ -148,7 +148,7 @@ struct tdb_transaction {
read while in a transaction. We need to check first if the data is in our list
of transaction elements, then if not do a real read
*/
-static int transaction_read(struct tdb_context *tdb, tdb_off_t off, void *buf,
+static int transaction_read(struct tdb_context *tdb, tdb_off_t off, void *buf,
tdb_len_t len, int cv)
{
uint32_t blk;
@@ -205,7 +205,7 @@ fail:
/*
write while in a transaction
*/
-static int transaction_write(struct tdb_context *tdb, tdb_off_t off,
+static int transaction_write(struct tdb_context *tdb, tdb_off_t off,
const void *buf, tdb_len_t len)
{
uint32_t blk;
@@ -261,7 +261,7 @@ static int transaction_write(struct tdb_context *tdb, tdb_off_t off,
tdb->ecode = TDB_ERR_OOM;
goto fail;
}
- memset(&new_blocks[tdb->transaction->num_blocks], 0,
+ memset(&new_blocks[tdb->transaction->num_blocks], 0,
(1+(blk - tdb->transaction->num_blocks))*sizeof(uint8_t *));
tdb->transaction->blocks = new_blocks;
tdb->transaction->num_blocks = blk+1;
@@ -274,23 +274,23 @@ static int transaction_write(struct tdb_context *tdb, tdb_off_t off,
if (tdb->transaction->blocks[blk] == NULL) {
tdb->ecode = TDB_ERR_OOM;
tdb->transaction->transaction_error = 1;
- return -1;
+ return -1;
}
if (tdb->transaction->old_map_size > blk * tdb->transaction->block_size) {
tdb_len_t len2 = tdb->transaction->block_size;
if (len2 + (blk * tdb->transaction->block_size) > tdb->transaction->old_map_size) {
len2 = tdb->transaction->old_map_size - (blk * tdb->transaction->block_size);
}
- if (tdb->transaction->io_methods->tdb_read(tdb, blk * tdb->transaction->block_size,
- tdb->transaction->blocks[blk],
+ if (tdb->transaction->io_methods->tdb_read(tdb, blk * tdb->transaction->block_size,
+ tdb->transaction->blocks[blk],
len2, 0) != 0) {
- SAFE_FREE(tdb->transaction->blocks[blk]);
+ SAFE_FREE(tdb->transaction->blocks[blk]);
tdb->ecode = TDB_ERR_IO;
goto fail;
}
if (blk == tdb->transaction->num_blocks-1) {
tdb->transaction->last_block_size = len2;
- }
+ }
}
}
@@ -309,7 +309,7 @@ static int transaction_write(struct tdb_context *tdb, tdb_off_t off,
return 0;
fail:
- TDB_LOG((tdb, TDB_DEBUG_FATAL, "transaction_write: failed at off=%d len=%d\n",
+ TDB_LOG((tdb, TDB_DEBUG_FATAL, "transaction_write: failed at off=%d len=%d\n",
(blk*tdb->transaction->block_size) + off, len));
tdb->transaction->transaction_error = 1;
return -1;
@@ -320,7 +320,7 @@ fail:
write while in a transaction - this variant never expands the transaction blocks, it only
updates existing blocks. This means it cannot change the recovery size
*/
-static int transaction_write_existing(struct tdb_context *tdb, tdb_off_t off,
+static int transaction_write_existing(struct tdb_context *tdb, tdb_off_t off,
const void *buf, tdb_len_t len)
{
uint32_t blk;
@@ -396,7 +396,7 @@ static int transaction_oob(struct tdb_context *tdb, tdb_off_t off,
/*
transaction version of tdb_expand().
*/
-static int transaction_expand_file(struct tdb_context *tdb, tdb_off_t size,
+static int transaction_expand_file(struct tdb_context *tdb, tdb_off_t size,
tdb_off_t addition)
{
/* add a write to the transaction elements, so subsequent
@@ -440,7 +440,7 @@ static int _tdb_transaction_start(struct tdb_context *tdb,
return -1;
}
tdb->transaction->nesting++;
- TDB_LOG((tdb, TDB_DEBUG_TRACE, "tdb_transaction_start: nesting %d\n",
+ TDB_LOG((tdb, TDB_DEBUG_TRACE, "tdb_transaction_start: nesting %d\n",
tdb->transaction->nesting));
return 0;
}
@@ -545,7 +545,7 @@ _PUBLIC_ int tdb_transaction_start_nonblock(struct tdb_context *tdb)
sync to disk
*/
static int transaction_sync(struct tdb_context *tdb, tdb_off_t offset, tdb_len_t length)
-{
+{
if (tdb->flags & TDB_NOSYNC) {
return 0;
}
@@ -562,7 +562,7 @@ static int transaction_sync(struct tdb_context *tdb, tdb_off_t offset, tdb_len_t
#ifdef HAVE_MMAP
if (tdb->map_ptr) {
tdb_off_t moffset = offset & ~(tdb->page_size-1);
- if (msync(moffset + (char *)tdb->map_ptr,
+ if (msync(moffset + (char *)tdb->map_ptr,
length + (offset - moffset), MS_SYNC) != 0) {
tdb->ecode = TDB_ERR_IO;
TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_transaction: msync failed - %s\n",
@@ -576,7 +576,7 @@ static int transaction_sync(struct tdb_context *tdb, tdb_off_t offset, tdb_len_t
static int _tdb_transaction_cancel(struct tdb_context *tdb)
-{
+{
int i, ret = 0;
if (tdb->transaction == NULL) {
@@ -588,7 +588,7 @@ static int _tdb_transaction_cancel(struct tdb_context *tdb)
tdb->transaction->transaction_error = 1;
tdb->transaction->nesting--;
return 0;
- }
+ }
tdb->map_size = tdb->transaction->old_map_size;
@@ -655,7 +655,7 @@ static tdb_len_t tdb_recovery_size(struct tdb_context *tdb)
} else {
recovery_size += tdb->transaction->block_size;
}
- }
+ }
return recovery_size;
}
@@ -692,7 +692,7 @@ int tdb_recovery_area(struct tdb_context *tdb,
allocate the recovery area, or use an existing recovery area if it is
large enough
*/
-static int tdb_recovery_allocate(struct tdb_context *tdb,
+static int tdb_recovery_allocate(struct tdb_context *tdb,
tdb_len_t *recovery_size,
tdb_off_t *recovery_offset,
tdb_len_t *recovery_max_size)
@@ -752,7 +752,7 @@ static int tdb_recovery_allocate(struct tdb_context *tdb,
new_end = recovery_head + sizeof(rec) + *recovery_max_size;
- if (methods->tdb_expand_file(tdb, tdb->transaction->old_map_size,
+ if (methods->tdb_expand_file(tdb, tdb->transaction->old_map_size,
new_end - tdb->transaction->old_map_size)
== -1) {
TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_recovery_allocate: failed to create recovery area\n"));
@@ -769,7 +769,7 @@ static int tdb_recovery_allocate(struct tdb_context *tdb,
/* write the recovery header offset and sync - we can sync without a race here
as the magic ptr in the recovery record has not been set */
CONVERT(recovery_head);
- if (methods->tdb_write(tdb, TDB_RECOVERY_HEAD,
+ if (methods->tdb_write(tdb, TDB_RECOVERY_HEAD,
&recovery_head, sizeof(tdb_off_t)) == -1) {
TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_recovery_allocate: failed to write recovery head\n"));
return -1;
@@ -786,7 +786,7 @@ static int tdb_recovery_allocate(struct tdb_context *tdb,
/*
setup the recovery data that will be used on a crash during commit
*/
-static int transaction_setup_recovery(struct tdb_context *tdb,
+static int transaction_setup_recovery(struct tdb_context *tdb,
tdb_off_t *magic_offset)
{
tdb_len_t recovery_size;
@@ -801,7 +801,7 @@ static int transaction_setup_recovery(struct tdb_context *tdb,
/*
check that the recovery area has enough space
*/
- if (tdb_recovery_allocate(tdb, &recovery_size,
+ if (tdb_recovery_allocate(tdb, &recovery_size,
&recovery_offset, &recovery_max_size) == -1) {
return -1;
}
@@ -919,7 +919,7 @@ static int transaction_setup_recovery(struct tdb_context *tdb,
}
static int _tdb_transaction_prepare_commit(struct tdb_context *tdb)
-{
+{
const struct tdb_methods *methods;
if (tdb->transaction == NULL) {
@@ -944,7 +944,7 @@ static int _tdb_transaction_prepare_commit(struct tdb_context *tdb)
if (tdb->transaction->nesting != 0) {
return 0;
- }
+ }
/* check for a null transaction */
if (tdb->transaction->blocks == NULL) {
@@ -988,8 +988,8 @@ static int _tdb_transaction_prepare_commit(struct tdb_context *tdb)
/* expand the file to the new size if needed */
if (tdb->map_size != tdb->transaction->old_map_size) {
- if (methods->tdb_expand_file(tdb, tdb->transaction->old_map_size,
- tdb->map_size -
+ if (methods->tdb_expand_file(tdb, tdb->transaction->old_map_size,
+ tdb->map_size -
tdb->transaction->old_map_size) == -1) {
tdb->ecode = TDB_ERR_IO;
TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_transaction_prepare_commit: expansion failed\n"));
@@ -1101,7 +1101,7 @@ _PUBLIC_ int tdb_transaction_commit(struct tdb_context *tdb)
possibly expanded the file, so we need to
run the crash recovery code */
tdb->methods = methods;
- tdb_transaction_recover(tdb);
+ tdb_transaction_recover(tdb);
_tdb_transaction_cancel(tdb);
@@ -1109,7 +1109,7 @@ _PUBLIC_ int tdb_transaction_commit(struct tdb_context *tdb)
return -1;
}
SAFE_FREE(tdb->transaction->blocks[i]);
- }
+ }
/* Do this before we drop lock or blocks. */
if (tdb->transaction->expanded) {
@@ -1176,9 +1176,9 @@ int tdb_transaction_recover(struct tdb_context *tdb)
}
/* read the recovery record */
- if (tdb->methods->tdb_read(tdb, recovery_head, &rec,
+ if (tdb->methods->tdb_read(tdb, recovery_head, &rec,
sizeof(rec), DOCONV()) == -1) {
- TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_transaction_recover: failed to read recovery record\n"));
+ TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_transaction_recover: failed to read recovery record\n"));
tdb->ecode = TDB_ERR_IO;
return -1;
}
@@ -1198,7 +1198,7 @@ int tdb_transaction_recover(struct tdb_context *tdb)
data = (unsigned char *)malloc(rec.data_len);
if (data == NULL) {
- TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_transaction_recover: failed to allocate recovery data\n"));
+ TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_transaction_recover: failed to allocate recovery data\n"));
tdb->ecode = TDB_ERR_OOM;
return -1;
}
@@ -1206,7 +1206,7 @@ int tdb_transaction_recover(struct tdb_context *tdb)
/* read the full recovery data */
if (tdb->methods->tdb_read(tdb, recovery_head + sizeof(rec), data,
rec.data_len, 0) == -1) {
- TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_transaction_recover: failed to read recovery data\n"));
+ TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_transaction_recover: failed to read recovery data\n"));
tdb->ecode = TDB_ERR_IO;
return -1;
}
@@ -1243,7 +1243,7 @@ int tdb_transaction_recover(struct tdb_context *tdb)
if (tdb_ofs_write(tdb, TDB_RECOVERY_HEAD, &zero) == -1) {
TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_transaction_recover: failed to remove recovery head\n"));
tdb->ecode = TDB_ERR_IO;
- return -1;
+ return -1;
}
}
@@ -1252,7 +1252,7 @@ int tdb_transaction_recover(struct tdb_context *tdb)
&zero) == -1) {
TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_transaction_recover: failed to remove recovery magic\n"));
tdb->ecode = TDB_ERR_IO;
- return -1;
+ return -1;
}
if (transaction_sync(tdb, 0, recovery_eof) == -1) {
@@ -1261,7 +1261,7 @@ int tdb_transaction_recover(struct tdb_context *tdb)
return -1;
}
- TDB_LOG((tdb, TDB_DEBUG_TRACE, "tdb_transaction_recover: recovered %d byte database\n",
+ TDB_LOG((tdb, TDB_DEBUG_TRACE, "tdb_transaction_recover: recovered %d byte database\n",
recovery_eof));
/* all done */
diff --git a/lib/tdb/common/traverse.c b/lib/tdb/common/traverse.c
index 517fecb4fc..b171e54357 100644
--- a/lib/tdb/common/traverse.c
+++ b/lib/tdb/common/traverse.c
@@ -1,4 +1,4 @@
- /*
+ /*
Unix SMB/CIFS implementation.
trivial database library
@@ -117,7 +117,7 @@ static tdb_off_t tdb_next_lock(struct tdb_context *tdb, struct tdb_traverse_lock
/* Try to clean dead ones from old traverses */
current = tlock->off;
tlock->off = rec->next;
- if (!(tdb->read_only || tdb->traverse_read) &&
+ if (!(tdb->read_only || tdb->traverse_read) &&
tdb_do_delete(tdb, current, rec) != 0)
goto fail;
}
@@ -140,7 +140,7 @@ static tdb_off_t tdb_next_lock(struct tdb_context *tdb, struct tdb_traverse_lock
if fn is NULL then it is not called
a non-zero return value from fn() indicates that the traversal should stop
*/
-static int tdb_traverse_internal(struct tdb_context *tdb,
+static int tdb_traverse_internal(struct tdb_context *tdb,
tdb_traverse_func fn, void *private_data,
struct tdb_traverse_lock *tl)
{
@@ -165,7 +165,7 @@ static int tdb_traverse_internal(struct tdb_context *tdb,
}
count++;
/* now read the full record */
- key.dptr = tdb_alloc_read(tdb, tl->off + sizeof(rec),
+ key.dptr = tdb_alloc_read(tdb, tl->off + sizeof(rec),
rec.key_len + rec.data_len);
if (!key.dptr) {
ret = -1;
@@ -212,7 +212,7 @@ out:
/*
a write style traverse - temporarily marks the db read only
*/
-_PUBLIC_ int tdb_traverse_read(struct tdb_context *tdb,
+_PUBLIC_ int tdb_traverse_read(struct tdb_context *tdb,
tdb_traverse_func fn, void *private_data)
{
struct tdb_traverse_lock tl = { NULL, 0, 0, F_RDLCK };
@@ -241,7 +241,7 @@ _PUBLIC_ int tdb_traverse_read(struct tdb_context *tdb,
WARNING: The data buffer given to the callback fn does NOT meet the
alignment restrictions malloc gives you.
*/
-_PUBLIC_ int tdb_traverse(struct tdb_context *tdb,
+_PUBLIC_ int tdb_traverse(struct tdb_context *tdb,
tdb_traverse_func fn, void *private_data)
{
struct tdb_traverse_lock tl = { NULL, 0, 0, F_WRLCK };