+/* Temporart wrapper for transition. */
+struct tdb_context *tdb1_open(const char *name, int tdb1_flags,
+ int open_flags, mode_t mode,
+ union tdb_attribute *attr)
+{
+ struct tdb1_logging_context *log_ctx = NULL, log;
+ tdb1_hash_func hash_fn = NULL;
+ struct tdb_attribute_tdb1_hashsize *hsize = NULL;
+
+ while (attr) {
+ switch (attr->base.attr) {
+ case TDB_ATTRIBUTE_HASH:
+ hash_fn = attr->hash.fn;
+ break;
+ case TDB_ATTRIBUTE_LOG:
+ log.log_fn = attr->log.fn;
+ log.log_private = attr->log.data;
+ log_ctx = &log;
+ break;
+ case TDB_ATTRIBUTE_TDB1_HASHSIZE:
+ hsize = &attr->tdb1_hashsize;
+ break;
+ break;
+ default:
+ abort();
+ }
+ attr = attr->base.next;
+ }
+
+ if (hsize && !(open_flags & O_CREAT)) {
+ if (log_ctx) {
+ log_ctx->log_fn(NULL,
+ TDB_ERR_EINVAL,
+ TDB_LOG_USE_ERROR,
+ "tdb_open: can only use"
+ " TDB_ATTRIBUTE_TDB1_HASHSIZE when"
+ " creating a tdb",
+ log_ctx->log_private);
+ }
+ errno = EINVAL;
+ return NULL;
+ }
+ return tdb1_open_ex(name, hsize ? hsize->hsize : TDB1_DEFAULT_HASH_SIZE,
+ tdb1_flags, open_flags, mode,
+ log_ctx, hash_fn);
+}
+