Commit 0aa58f6e authored by Rusty Russell's avatar Rusty Russell

tdb2: remove extraneous whitespace.

Gets us one extra ccanlint point, too.
parent a2083afe
/*
/*
Trivial Database 2: free list/block handling
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
......@@ -277,7 +277,7 @@ static bool check_hash_tree(struct tdb_context *tdb,
if (is_subhash(group[b])) {
uint64_t subprefix;
subprefix = (hprefix
subprefix = (hprefix
<< (group_bits + TDB_HASH_GROUP_BITS))
+ g * (1 << TDB_HASH_GROUP_BITS) + b;
......@@ -449,7 +449,7 @@ static bool check_free(struct tdb_context *tdb,
}
return true;
}
static bool check_free_table(struct tdb_context *tdb,
tdb_off_t ftable_off,
unsigned ftable_num,
......
/*
/*
Trivial Database 2: free list/block handling
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
......
/*
/*
Trivial Database 2: hash handling
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
......@@ -245,7 +245,7 @@ tdb_off_t find_and_lock(struct tdb_context *tdb,
tinfo->toplevel_group = group;
tinfo->num_levels = 1;
tinfo->levels[0].entry = 0;
tinfo->levels[0].hashtable = hashtable
tinfo->levels[0].hashtable = hashtable
+ (group << TDB_HASH_GROUP_BITS) * sizeof(tdb_off_t);
tinfo->levels[0].total_buckets = 1 << TDB_HASH_GROUP_BITS;
}
......@@ -384,7 +384,7 @@ static tdb_off_t encode_offset(tdb_off_t new_off, struct hash_info *h)
<< TDB_OFF_HASH_EXTRA_BIT);
}
/* Simply overwrite the hash entry we found before. */
/* Simply overwrite the hash entry we found before. */
int replace_in_hash(struct tdb_context *tdb,
struct hash_info *h,
tdb_off_t new_off)
......@@ -716,12 +716,12 @@ int next_in_hash(struct tdb_context *tdb, int ltype,
/* They want data as well? */
if (dlen) {
*dlen = rec_data_length(&rec);
kbuf->dptr = tdb_alloc_read(tdb,
kbuf->dptr = tdb_alloc_read(tdb,
off + sizeof(rec),
kbuf->dsize
+ *dlen);
} else {
kbuf->dptr = tdb_alloc_read(tdb,
kbuf->dptr = tdb_alloc_read(tdb,
off + sizeof(rec),
kbuf->dsize);
}
......
/*
/*
Unix SMB/CIFS implementation.
trivial database library
......@@ -64,7 +64,7 @@ void tdb_mmap(struct tdb_context *tdb)
/* 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
note that "len" is the minimum length needed for the db
*/
static int tdb_oob(struct tdb_context *tdb, tdb_off_t len, bool probe)
......@@ -207,7 +207,7 @@ tdb_off_t tdb_read_off(struct tdb_context *tdb, tdb_off_t off)
}
/* 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 (tdb->read_only) {
......@@ -411,7 +411,7 @@ static int tdb_expand_file(struct tdb_context *tdb, tdb_len_t addition)
const void *tdb_access_read(struct tdb_context *tdb,
tdb_off_t off, tdb_len_t len, bool convert)
{
const void *ret = NULL;
const void *ret = NULL;
if (likely(!(tdb->flags & TDB_CONVERT)))
ret = tdb->methods->direct(tdb, off, len, false);
......
/*
/*
Unix SMB/CIFS implementation.
trivial database library
......@@ -198,7 +198,7 @@ static 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)
{
......@@ -502,7 +502,7 @@ again:
tdb_logerr(tdb, tdb->ecode, TDB_DEBUG_ERROR,
"tdb_allrecord_lock freetables failed");
}
tdb_brunlock(tdb, ltype, TDB_HASH_LOCK_START,
tdb_brunlock(tdb, ltype, TDB_HASH_LOCK_START,
TDB_HASH_LOCK_RANGE);
return -1;
}
......@@ -518,7 +518,7 @@ again:
tdb_allrecord_unlock(tdb, ltype);
if (tdb_lock_and_recover(tdb) == -1) {
return -1;
}
}
goto again;
}
......
#ifndef TDB_PRIVATE_H
#define TDB_PRIVATE_H
/*
/*
Trivial Database 2: private types and prototypes
Copyright (C) Rusty Russell 2010
......@@ -325,7 +325,7 @@ struct tdb_context {
int mmap_flags;
/* Error code for last tdb error. */
enum TDB_ERROR ecode;
enum TDB_ERROR ecode;
/* the flags passed to tdb_open, for tdb_reopen. */
uint32_t flags;
......@@ -361,7 +361,7 @@ struct tdb_context {
/* Single list of all TDBs, to avoid multiple opens. */
struct tdb_context *next;
dev_t device;
dev_t device;
ino_t inode;
};
......
/*
/*
Trivial Database 2: 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
......
#ifndef CCAN_TDB2_H
#define CCAN_TDB2_H
/*
/*
Unix SMB/CIFS implementation.
trivial database library
Copyright (C) Andrew Tridgell 1999-2004
** NOTE! The following LGPL license applies to the tdb
** library. This does NOT imply that all of Samba is released
** under the LGPL
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
......@@ -60,7 +60,7 @@ extern "C" {
#define TDB_ALLOW_NESTING 512 /* Allow transactions to nest */
/* error codes */
enum TDB_ERROR {TDB_SUCCESS=0, TDB_ERR_CORRUPT, TDB_ERR_IO, TDB_ERR_LOCK,
enum TDB_ERROR {TDB_SUCCESS=0, TDB_ERR_CORRUPT, TDB_ERR_IO, TDB_ERR_LOCK,
TDB_ERR_OOM, TDB_ERR_EXISTS, TDB_ERR_NOEXIST,
TDB_ERR_EINVAL, TDB_ERR_RDONLY, TDB_ERR_NESTING };
......@@ -68,7 +68,7 @@ enum TDB_ERROR {TDB_SUCCESS=0, TDB_ERR_CORRUPT, TDB_ERR_IO, TDB_ERR_LOCK,
enum tdb_summary_flags { TDB_SUMMARY_HISTOGRAMS = 1 };
/* logging uses one of the following levels */
enum tdb_debug_level {TDB_DEBUG_FATAL = 0, TDB_DEBUG_ERROR,
enum tdb_debug_level {TDB_DEBUG_FATAL = 0, TDB_DEBUG_ERROR,
TDB_DEBUG_WARNING, TDB_DEBUG_TRACE};
typedef struct tdb_data {
......
/*
/*
Trivial Database 2: traverse function.
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
......@@ -74,7 +74,7 @@ TDB_DATA tdb_firstkey(struct tdb_context *tdb)
default:
return tdb_null;
}
}
}
/* We lock twice, not very efficient. We could keep last key & tinfo cached. */
TDB_DATA tdb_nextkey(struct tdb_context *tdb, TDB_DATA key)
......@@ -97,4 +97,4 @@ TDB_DATA tdb_nextkey(struct tdb_context *tdb, TDB_DATA key)
default:
return tdb_null;
}
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment