summaryrefslogtreecommitdiff
path: root/lib/tdb2/tdb2.h
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2011-09-14 07:47:13 +0930
committerRusty Russell <rusty@rustcorp.com.au>2011-09-14 07:47:13 +0930
commit6e16e29d532d7542c210fd725bf61df1e7a97795 (patch)
tree463f4867fe4ff441d924672b564f508632e57c02 /lib/tdb2/tdb2.h
parentf8dbfad23c9cab9d52b366d56e8491666a90f714 (diff)
downloadsamba-6e16e29d532d7542c210fd725bf61df1e7a97795.tar.gz
samba-6e16e29d532d7542c210fd725bf61df1e7a97795.tar.bz2
samba-6e16e29d532d7542c210fd725bf61df1e7a97795.zip
tdb2: add TDB_ATTRIBUTE_TDB1_HASHSIZE
This replaces the tdb1_open "hash_size" argument. It will only be valid when you call tdb_open() with O_CREAT in open_flags, and TDB_VERSION1 in tdb_flags. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (Imported from CCAN commit 49475d68deecd0b31597ed6094229171d2699b11)
Diffstat (limited to 'lib/tdb2/tdb2.h')
-rw-r--r--lib/tdb2/tdb2.h22
1 files changed, 19 insertions, 3 deletions
diff --git a/lib/tdb2/tdb2.h b/lib/tdb2/tdb2.h
index 3939c4abe9..7967b60f7b 100644
--- a/lib/tdb2/tdb2.h
+++ b/lib/tdb2/tdb2.h
@@ -609,7 +609,8 @@ enum tdb_attribute_type {
TDB_ATTRIBUTE_SEED = 2,
TDB_ATTRIBUTE_STATS = 3,
TDB_ATTRIBUTE_OPENHOOK = 4,
- TDB_ATTRIBUTE_FLOCK = 5
+ TDB_ATTRIBUTE_FLOCK = 5,
+ TDB_ATTRIBUTE_TDB1_HASHSIZE = 128,
};
/**
@@ -633,8 +634,9 @@ enum TDB_ERROR tdb_get_attribute(struct tdb_context *tdb,
* of the same type. It returns TDB_ERR_EINVAL if the attribute is
* unknown or invalid.
*
- * Note that TDB_ATTRIBUTE_HASH, TDB_ATTRIBUTE_SEED and
- * TDB_ATTRIBUTE_OPENHOOK cannot currently be set after tdb_open.
+ * Note that TDB_ATTRIBUTE_HASH, TDB_ATTRIBUTE_SEED,
+ * TDB_ATTRIBUTE_OPENHOOK and TDB_ATTRIBUTE_TDB1_HASHSIZE cannot
+ * currently be set after tdb_open.
*/
enum TDB_ERROR tdb_set_attribute(struct tdb_context *tdb,
const union tdb_attribute *attr);
@@ -841,6 +843,19 @@ struct tdb_attribute_flock {
};
/**
+ * struct tdb_attribute_tdb1_hashsize - tdb1 hashsize
+ *
+ * This attribute allows setting the TDB1 hashsize; it only makes sense with
+ * O_CREAT and TDB_VERSION1.
+ *
+ * Hashsize should generally be a prime, such as 10007.
+ */
+struct tdb_attribute_tdb1_hashsize {
+ struct tdb_attribute_base base; /* .attr = TDB_ATTRIBUTE_TDB1_HASHSIZE */
+ unsigned int hsize;
+};
+
+/**
* union tdb_attribute - tdb attributes.
*
* This represents all the known attributes.
@@ -858,6 +873,7 @@ union tdb_attribute {
struct tdb_attribute_stats stats;
struct tdb_attribute_openhook openhook;
struct tdb_attribute_flock flock;
+ struct tdb_attribute_tdb1_hashsize tdb1_hashsize;
};
#ifdef __cplusplus