|
@@ -388,6 +388,7 @@ struct tdb_context *tdb_open(const char *name, int tdb_flags,
|
|
|
struct tdb_header hdr;
|
|
struct tdb_header hdr;
|
|
|
struct tdb_attribute_seed *seed = NULL;
|
|
struct tdb_attribute_seed *seed = NULL;
|
|
|
struct tdb_attribute_tdb1_hashsize *hsize_attr = NULL;
|
|
struct tdb_attribute_tdb1_hashsize *hsize_attr = NULL;
|
|
|
|
|
+ struct tdb_attribute_tdb1_max_dead *maxsize_attr = NULL;
|
|
|
tdb_bool_err berr;
|
|
tdb_bool_err berr;
|
|
|
enum TDB_ERROR ecode;
|
|
enum TDB_ERROR ecode;
|
|
|
int openlock;
|
|
int openlock;
|
|
@@ -433,6 +434,9 @@ struct tdb_context *tdb_open(const char *name, int tdb_flags,
|
|
|
case TDB_ATTRIBUTE_TDB1_HASHSIZE:
|
|
case TDB_ATTRIBUTE_TDB1_HASHSIZE:
|
|
|
hsize_attr = &attr->tdb1_hashsize;
|
|
hsize_attr = &attr->tdb1_hashsize;
|
|
|
break;
|
|
break;
|
|
|
|
|
+ case TDB_ATTRIBUTE_TDB1_MAX_DEAD:
|
|
|
|
|
+ maxsize_attr = &attr->tdb1_max_dead;
|
|
|
|
|
+ break;
|
|
|
default:
|
|
default:
|
|
|
/* These are set as normal. */
|
|
/* These are set as normal. */
|
|
|
ecode = tdb_set_attribute(tdb, attr);
|
|
ecode = tdb_set_attribute(tdb, attr);
|
|
@@ -511,7 +515,7 @@ struct tdb_context *tdb_open(const char *name, int tdb_flags,
|
|
|
}
|
|
}
|
|
|
tdb->file->fd = -1;
|
|
tdb->file->fd = -1;
|
|
|
if (tdb->flags & TDB_VERSION1)
|
|
if (tdb->flags & TDB_VERSION1)
|
|
|
- ecode = tdb1_new_database(tdb, hsize_attr);
|
|
|
|
|
|
|
+ ecode = tdb1_new_database(tdb, hsize_attr, maxsize_attr);
|
|
|
else {
|
|
else {
|
|
|
ecode = tdb_new_database(tdb, seed, &hdr);
|
|
ecode = tdb_new_database(tdb, seed, &hdr);
|
|
|
if (ecode == TDB_SUCCESS) {
|
|
if (ecode == TDB_SUCCESS) {
|
|
@@ -591,7 +595,7 @@ struct tdb_context *tdb_open(const char *name, int tdb_flags,
|
|
|
rlen = pread(tdb->file->fd, &hdr, sizeof(hdr), 0);
|
|
rlen = pread(tdb->file->fd, &hdr, sizeof(hdr), 0);
|
|
|
if (rlen == 0 && (open_flags & O_CREAT)) {
|
|
if (rlen == 0 && (open_flags & O_CREAT)) {
|
|
|
if (tdb->flags & TDB_VERSION1) {
|
|
if (tdb->flags & TDB_VERSION1) {
|
|
|
- ecode = tdb1_new_database(tdb, hsize_attr);
|
|
|
|
|
|
|
+ ecode = tdb1_new_database(tdb, hsize_attr, maxsize_attr);
|
|
|
if (ecode != TDB_SUCCESS)
|
|
if (ecode != TDB_SUCCESS)
|
|
|
goto fail;
|
|
goto fail;
|
|
|
goto finished;
|
|
goto finished;
|
|
@@ -608,7 +612,7 @@ struct tdb_context *tdb_open(const char *name, int tdb_flags,
|
|
|
} else if (rlen < sizeof(hdr)
|
|
} else if (rlen < sizeof(hdr)
|
|
|
|| strcmp(hdr.magic_food, TDB_MAGIC_FOOD) != 0) {
|
|
|| strcmp(hdr.magic_food, TDB_MAGIC_FOOD) != 0) {
|
|
|
if (is_tdb1(&tdb->tdb1.header, &hdr, rlen)) {
|
|
if (is_tdb1(&tdb->tdb1.header, &hdr, rlen)) {
|
|
|
- ecode = tdb1_open(tdb);
|
|
|
|
|
|
|
+ ecode = tdb1_open(tdb, maxsize_attr);
|
|
|
if (!ecode)
|
|
if (!ecode)
|
|
|
goto finished;
|
|
goto finished;
|
|
|
goto fail;
|
|
goto fail;
|
|
@@ -623,7 +627,7 @@ struct tdb_context *tdb_open(const char *name, int tdb_flags,
|
|
|
tdb->flags |= TDB_CONVERT;
|
|
tdb->flags |= TDB_CONVERT;
|
|
|
else {
|
|
else {
|
|
|
if (is_tdb1(&tdb->tdb1.header, &hdr, rlen)) {
|
|
if (is_tdb1(&tdb->tdb1.header, &hdr, rlen)) {
|
|
|
- ecode = tdb1_open(tdb);
|
|
|
|
|
|
|
+ ecode = tdb1_open(tdb, maxsize_attr);
|
|
|
if (!ecode)
|
|
if (!ecode)
|
|
|
goto finished;
|
|
goto finished;
|
|
|
goto fail;
|
|
goto fail;
|