X-Git-Url: http://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Ftdb2%2Ftest%2Flayout.c;h=38f79bfc5b250dea614aece8c57475a7aebd1c8e;hp=be54fe977891b8ea6835c8d40516abb5289214bb;hb=c4ca9f54301c0367891be6330f59fdd5dcdd51d1;hpb=5c4a21ab03a428373e7659b9606facf85dcbe17b diff --git a/ccan/tdb2/test/layout.c b/ccan/tdb2/test/layout.c index be54fe97..38f79bfc 100644 --- a/ccan/tdb2/test/layout.c +++ b/ccan/tdb2/test/layout.c @@ -147,10 +147,10 @@ static void add_to_freetable(struct tdb_context *tdb, unsigned ftable, struct tle_freetable *freetable) { - tdb->ftable_off = freetable->base.off; - tdb->ftable = ftable; + tdb->tdb2.ftable_off = freetable->base.off; + tdb->tdb2.ftable = ftable; add_free_record(tdb, eoff, sizeof(struct tdb_used_record) + elen, - TDB_LOCK_WAIT); + TDB_LOCK_WAIT, false); } static tdb_off_t hbucket_off(tdb_off_t group_start, unsigned ingroup) @@ -206,7 +206,7 @@ static void add_to_hashtable(struct tdb_context *tdb, b_off = hbucket_off(group_start, bucket); if (tdb_read_off(tdb, b_off) == 0) { tdb_write_off(tdb, b_off, - encode_offset(eoff, bucket, h)); + encode_offset(eoff, in_group, h)); return; } } @@ -228,7 +228,8 @@ static struct tle_freetable *find_ftable(struct tdb_layout *layout, unsigned num } /* FIXME: Support TDB_CONVERT */ -struct tdb_context *tdb_layout_get(struct tdb_layout *layout) +struct tdb_context *tdb_layout_get(struct tdb_layout *layout, + union tdb_attribute *attr) { unsigned int i; tdb_off_t off, len, last_ftable; @@ -264,7 +265,7 @@ struct tdb_context *tdb_layout_get(struct tdb_layout *layout) /* Fill with some weird pattern. */ memset(mem, 0x99, off); /* Now populate our header, cribbing from a real TDB header. */ - tdb = tdb_open(NULL, TDB_INTERNAL, O_RDWR, 0, &tap_log_attr); + tdb = tdb_open(NULL, TDB_INTERNAL, O_RDWR, 0, attr); memcpy(mem, tdb->file->map_ptr, sizeof(struct tdb_header)); /* Mug the tdb we have to make it use this. */ @@ -312,7 +313,7 @@ struct tdb_context *tdb_layout_get(struct tdb_layout *layout) } } - tdb->ftable_off = find_ftable(layout, 0)->base.off; + tdb->tdb2.ftable_off = find_ftable(layout, 0)->base.off; /* Get physical if they asked for it. */ if (layout->filename) {