From cf368cbdc5f1b6ee1f831e3a90d8d77ef8d317ed Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 12 Mar 2015 14:23:17 +0000 Subject: [PATCH] lib: Remove tdb_fetch_compat Signed-off-by: Volker Lendecke Reviewed-by: Michael Adam --- lib/tdb_compat/tdb_compat.h | 2 -- source3/lib/dbwrap/dbwrap_ctdb.c | 6 +++--- source3/lib/eventlog/eventlog.c | 4 ++-- source3/libsmb/smb_share_modes.c | 10 ++++----- source3/nmbd/nmbd_winsserver.c | 2 +- source3/printing/nt_printing_migrate_internal.c | 4 ++-- source3/printing/nt_printing_tdb.c | 2 +- source3/printing/printing.c | 28 ++++++++++++------------- source3/registry/reg_perfcount.c | 16 +++++++------- source3/utils/net_printing.c | 6 +++--- source3/winbindd/winbindd_cache.c | 10 ++++----- source4/dsdb/samdb/ldb_modules/schema_load.c | 2 +- source4/torture/local/dbspeed.c | 4 ++-- 13 files changed, 47 insertions(+), 49 deletions(-) diff --git a/lib/tdb_compat/tdb_compat.h b/lib/tdb_compat/tdb_compat.h index 2397de1342f..da2e1dc3d35 100644 --- a/lib/tdb_compat/tdb_compat.h +++ b/lib/tdb_compat/tdb_compat.h @@ -29,6 +29,4 @@ #include #include -#define tdb_fetch_compat tdb_fetch - #endif /* TDB_COMPAT_H */ diff --git a/source3/lib/dbwrap/dbwrap_ctdb.c b/source3/lib/dbwrap/dbwrap_ctdb.c index e6dcc0e987c..947a888982d 100644 --- a/source3/lib/dbwrap/dbwrap_ctdb.c +++ b/source3/lib/dbwrap/dbwrap_ctdb.c @@ -498,7 +498,7 @@ static struct db_record *db_ctdb_fetch_locked_transaction(struct db_ctdb_ctx *ct return result; } - ctdb_data = tdb_fetch_compat(ctx->wtdb->tdb, key); + ctdb_data = tdb_fetch(ctx->wtdb->tdb, key); if (ctdb_data.dptr == NULL) { /* create the record */ result->value = tdb_null; @@ -584,7 +584,7 @@ static NTSTATUS db_ctdb_transaction_store(struct db_ctdb_transaction_handle *h, if (!pull_newest_from_marshall_buffer(h->m_write, key, &header, NULL, NULL)) { - rec = tdb_fetch_compat(h->ctx->wtdb->tdb, key); + rec = tdb_fetch(h->ctx->wtdb->tdb, key); if (rec.dptr != NULL) { memcpy(&header, rec.dptr, @@ -1094,7 +1094,7 @@ again: result->delete_rec = db_ctdb_delete; talloc_set_destructor(result, db_ctdb_record_destr); - ctdb_data = tdb_fetch_compat(ctx->wtdb->tdb, key); + ctdb_data = tdb_fetch(ctx->wtdb->tdb, key); /* * See if we have a valid record and we are the dmaster. If so, we can diff --git a/source3/lib/eventlog/eventlog.c b/source3/lib/eventlog/eventlog.c index 34752fd8006..f9ac0900150 100644 --- a/source3/lib/eventlog/eventlog.c +++ b/source3/lib/eventlog/eventlog.c @@ -204,7 +204,7 @@ static bool make_way_for_eventlogs( TDB_CONTEXT * the_tdb, int32_t needed, /* read a record, add the amt to nbytes */ key.dsize = sizeof(int32_t); key.dptr = (unsigned char *)&i; - ret = tdb_fetch_compat( the_tdb, key ); + ret = tdb_fetch( the_tdb, key ); if ( ret.dsize == 0 ) { DEBUG( 8, ( "Can't find a record for the key, record [%d]\n", @@ -687,7 +687,7 @@ struct eventlog_Record_tdb *evlog_pull_record_tdb(TALLOC_CTX *mem_ctx, key.dptr = (unsigned char *)&srecno; key.dsize = sizeof(int32_t); - data = tdb_fetch_compat(tdb, key); + data = tdb_fetch(tdb, key); if (data.dsize == 0) { DEBUG(8,("evlog_pull_record_tdb: " "Can't find a record for the key, record %d\n", diff --git a/source3/libsmb/smb_share_modes.c b/source3/libsmb/smb_share_modes.c index fe0bdeafe0c..7a6acc3d798 100644 --- a/source3/libsmb/smb_share_modes.c +++ b/source3/libsmb/smb_share_modes.c @@ -241,8 +241,8 @@ int smb_get_share_mode_entries(struct smbdb_ctx *db_ctx, *pp_list = NULL; *p_delete_on_close = 0; - db_data = tdb_fetch_compat(db_ctx->smb_tdb, - get_locking_key(&lk, dev, ino, extid)); + db_data = tdb_fetch(db_ctx->smb_tdb, + get_locking_key(&lk, dev, ino, extid)); if (!db_data.dptr) { return 0; } @@ -350,7 +350,7 @@ int smb_create_share_mode_entry_ex(struct smbdb_ctx *db_ctx, return -1; } - db_data = tdb_fetch_compat(db_ctx->smb_tdb, locking_key); + db_data = tdb_fetch(db_ctx->smb_tdb, locking_key); if (!db_data.dptr) { /* We must create the entry. */ db_data.dptr = (uint8 *)malloc( @@ -467,7 +467,7 @@ int smb_delete_share_mode_entry(struct smbdb_ctx *db_ctx, size_t i, num_share_modes; const uint8 *remaining_ptr = NULL; - db_data = tdb_fetch_compat(db_ctx->smb_tdb, locking_key); + db_data = tdb_fetch(db_ctx->smb_tdb, locking_key); if (!db_data.dptr) { return -1; /* Error - missing entry ! */ } @@ -569,7 +569,7 @@ int smb_change_share_mode_entry(struct smbdb_ctx *db_ctx, size_t i; int found_entry = 0; - db_data = tdb_fetch_compat(db_ctx->smb_tdb, locking_key); + db_data = tdb_fetch(db_ctx->smb_tdb, locking_key); if (!db_data.dptr) { return -1; /* Error - missing entry ! */ } diff --git a/source3/nmbd/nmbd_winsserver.c b/source3/nmbd/nmbd_winsserver.c index a56ff45b981..bf32dbda43f 100644 --- a/source3/nmbd/nmbd_winsserver.c +++ b/source3/nmbd/nmbd_winsserver.c @@ -235,7 +235,7 @@ struct name_record *find_name_on_wins_subnet(const struct nmb_name *nmbname, boo } key = name_to_key(nmbname); - data = tdb_fetch_compat(wins_tdb, key); + data = tdb_fetch(wins_tdb, key); if (data.dsize == 0) { return NULL; diff --git a/source3/printing/nt_printing_migrate_internal.c b/source3/printing/nt_printing_migrate_internal.c index 1765329dca3..5e48de2764c 100644 --- a/source3/printing/nt_printing_migrate_internal.c +++ b/source3/printing/nt_printing_migrate_internal.c @@ -90,7 +90,7 @@ static NTSTATUS migrate_internal(TALLOC_CTX *mem_ctx, kbuf.dptr; newkey = tdb_nextkey(tdb, kbuf), free(kbuf.dptr), kbuf = newkey) { - dbuf = tdb_fetch_compat(tdb, kbuf); + dbuf = tdb_fetch(tdb, kbuf); if (!dbuf.dptr) { continue; } @@ -147,7 +147,7 @@ static NTSTATUS migrate_internal(TALLOC_CTX *mem_ctx, kbuf.dptr; newkey = tdb_nextkey(tdb, kbuf), free(kbuf.dptr), kbuf = newkey) { - dbuf = tdb_fetch_compat(tdb, kbuf); + dbuf = tdb_fetch(tdb, kbuf); if (!dbuf.dptr) { continue; } diff --git a/source3/printing/nt_printing_tdb.c b/source3/printing/nt_printing_tdb.c index f043575bce9..ea1e87e4a12 100644 --- a/source3/printing/nt_printing_tdb.c +++ b/source3/printing/nt_printing_tdb.c @@ -95,7 +95,7 @@ static bool upgrade_to_version_3(void) for (kbuf = tdb_firstkey(tdb_drivers); kbuf.dptr; newkey = tdb_nextkey(tdb_drivers, kbuf), free(kbuf.dptr), kbuf=newkey) { - dbuf = tdb_fetch_compat(tdb_drivers, kbuf); + dbuf = tdb_fetch(tdb_drivers, kbuf); if (strncmp((const char *)kbuf.dptr, FORMS_PREFIX, strlen(FORMS_PREFIX)) == 0) { DEBUG(0,("upgrade_to_version_3:moving form\n")); diff --git a/source3/printing/printing.c b/source3/printing/printing.c index 61afa2881f0..7c579859922 100644 --- a/source3/printing/printing.c +++ b/source3/printing/printing.c @@ -92,7 +92,7 @@ uint16 pjobid_to_rap(const char* sharename, uint32 jobid) key.dptr = (uint8 *)&jinfo; key.dsize = sizeof(jinfo); - data = tdb_fetch_compat(rap_tdb, key); + data = tdb_fetch(rap_tdb, key); if (data.dptr && data.dsize == sizeof(uint16)) { rap_jobid = SVAL(data.dptr, 0); SAFE_FREE(data.dptr); @@ -129,7 +129,7 @@ bool rap_to_pjobid(uint16 rap_jobid, fstring sharename, uint32 *pjobid) SSVAL(buf,0,rap_jobid); key.dptr = buf; key.dsize = sizeof(rap_jobid); - data = tdb_fetch_compat(rap_tdb, key); + data = tdb_fetch(rap_tdb, key); if ( data.dptr && data.dsize == sizeof(struct rap_jobid_key) ) { struct rap_jobid_key *jinfo = (struct rap_jobid_key*)data.dptr; @@ -167,7 +167,7 @@ void rap_jobid_delete(const char* sharename, uint32 jobid) key.dptr = (uint8 *)&jinfo; key.dsize = sizeof(jinfo); - data = tdb_fetch_compat(rap_tdb, key); + data = tdb_fetch(rap_tdb, key); if (!data.dptr || (data.dsize != sizeof(uint16))) { DEBUG(10,("rap_jobid_delete: cannot find jobid %u\n", (unsigned int)jobid )); @@ -472,7 +472,7 @@ static struct printjob *print_job_find(TALLOC_CTX *mem_ctx, return NULL; } - ret = tdb_fetch_compat(pdb->tdb, print_key(jobid, &tmp)); + ret = tdb_fetch(pdb->tdb, print_key(jobid, &tmp)); release_print_db(pdb); if (!ret.dptr) { @@ -689,7 +689,7 @@ static bool remove_from_jobs_changed(const char* sharename, uint32_t jobid) gotlock = True; - data = tdb_fetch_compat(pdb->tdb, key); + data = tdb_fetch(pdb->tdb, key); if (data.dptr == NULL || data.dsize == 0 || (data.dsize % 4 != 0)) goto out; @@ -807,7 +807,7 @@ static bool pjob_store(struct tevent_context *ev, /* Get old data */ - old_data = tdb_fetch_compat(pdb->tdb, print_key(jobid, &tmp)); + old_data = tdb_fetch(pdb->tdb, print_key(jobid, &tmp)); /* Doh! Now we have to pack/unpack data since the NT_DEVICEMODE was added */ @@ -1164,7 +1164,7 @@ static pid_t get_updating_pid(const char *sharename) slprintf(keystr, sizeof(keystr)-1, "UPDATING/%s", sharename); key = string_tdb_data(keystr); - data = tdb_fetch_compat(pdb->tdb, key); + data = tdb_fetch(pdb->tdb, key); release_print_db(pdb); if (!data.dptr || data.dsize != sizeof(pid_t)) { SAFE_FREE(data.dptr); @@ -1311,7 +1311,7 @@ static TDB_DATA get_jobs_added_data(struct tdb_print_db *pdb) ZERO_STRUCT(data); - data = tdb_fetch_compat(pdb->tdb, string_tdb_data("INFO/jobs_added")); + data = tdb_fetch(pdb->tdb, string_tdb_data("INFO/jobs_added")); if (data.dptr == NULL || data.dsize == 0 || (data.dsize % 4 != 0)) { SAFE_FREE(data.dptr); ZERO_STRUCT(data); @@ -2108,7 +2108,7 @@ static bool remove_from_jobs_added(const char* sharename, uint32 jobid) gotlock = True; - data = tdb_fetch_compat(pdb->tdb, key); + data = tdb_fetch(pdb->tdb, key); if (data.dptr == NULL || data.dsize == 0 || (data.dsize % 4 != 0)) goto out; @@ -2520,7 +2520,7 @@ static int get_queue_status(const char* sharename, print_status_struct *status) if (status) { fstr_sprintf(keystr, "STATUS/%s", sharename); - data = tdb_fetch_compat(pdb->tdb, string_tdb_data(keystr)); + data = tdb_fetch(pdb->tdb, string_tdb_data(keystr)); if (data.dptr) { if (data.dsize == sizeof(print_status_struct)) /* this memcpy is ok since the status struct was @@ -3101,18 +3101,18 @@ static bool get_stored_queue_info(struct messaging_context *msg_ctx, ZERO_STRUCT(cgdata); /* Get the stored queue data. */ - data = tdb_fetch_compat(pdb->tdb, string_tdb_data("INFO/linear_queue_array")); + data = tdb_fetch(pdb->tdb, string_tdb_data("INFO/linear_queue_array")); if (data.dptr && data.dsize >= sizeof(qcount)) len += tdb_unpack(data.dptr + len, data.dsize - len, "d", &qcount); /* Get the added jobs list. */ - cgdata = tdb_fetch_compat(pdb->tdb, string_tdb_data("INFO/jobs_added")); + cgdata = tdb_fetch(pdb->tdb, string_tdb_data("INFO/jobs_added")); if (cgdata.dptr != NULL && (cgdata.dsize % 4 == 0)) extra_count = cgdata.dsize/4; /* Get the changed jobs list. */ - jcdata = tdb_fetch_compat(pdb->tdb, string_tdb_data("INFO/jobs_changed")); + jcdata = tdb_fetch(pdb->tdb, string_tdb_data("INFO/jobs_changed")); if (jcdata.dptr != NULL && (jcdata.dsize % 4 == 0)) changed_count = jcdata.dsize / 4; @@ -3283,7 +3283,7 @@ int print_queue_status(struct messaging_context *msg_ctx, int snum, slprintf(keystr, sizeof(keystr)-1, "STATUS/%s", sharename); key = string_tdb_data(keystr); - data = tdb_fetch_compat(pdb->tdb, key); + data = tdb_fetch(pdb->tdb, key); if (data.dptr) { if (data.dsize == sizeof(*status)) { /* this memcpy is ok since the status struct was diff --git a/source3/registry/reg_perfcount.c b/source3/registry/reg_perfcount.c index 2e308454d0d..f78ab44e0a1 100644 --- a/source3/registry/reg_perfcount.c +++ b/source3/registry/reg_perfcount.c @@ -108,7 +108,7 @@ uint32 reg_perfcount_get_base_index(void) and so on. So last_counter becomes num_counters*2, and last_help will be last_counter+1 */ kbuf = string_tdb_data(key); - dbuf = tdb_fetch_compat(names, kbuf); + dbuf = tdb_fetch(names, kbuf); if(dbuf.dptr == NULL) { DEBUG(1, ("reg_perfcount_get_base_index: failed to find key \'1\' in [%s].\n", fname)); @@ -175,7 +175,7 @@ static uint32 _reg_perfcount_multi_sz_from_tdb(TDB_CONTEXT *tdb, memset(temp, 0, sizeof(temp)); snprintf(temp, sizeof(temp), "%d", keyval); kbuf = string_tdb_data(temp); - dbuf = tdb_fetch_compat(tdb, kbuf); + dbuf = tdb_fetch(tdb, kbuf); if(dbuf.dptr == NULL) { /* If a key isn't there, just bypass it -- this really shouldn't @@ -382,7 +382,7 @@ static uint32 _reg_perfcount_get_numinst(int objInd, TDB_CONTEXT *names) char buf[PERFCOUNT_MAX_LEN]; _reg_perfcount_make_key(&key, buf, PERFCOUNT_MAX_LEN, objInd, "inst"); - data = tdb_fetch_compat(names, key); + data = tdb_fetch(names, key); if(data.dptr == NULL) return (uint32)PERF_NO_INSTANCES; @@ -462,7 +462,7 @@ static bool _reg_perfcount_get_counter_data(TDB_DATA key, TDB_DATA *data) } TALLOC_FREE(fname); - *data = tdb_fetch_compat(counters, key); + *data = tdb_fetch(counters, key); tdb_close(counters); @@ -529,7 +529,7 @@ static bool _reg_perfcount_get_counter_info(struct PERF_DATA_BLOCK *block, padding = 0; _reg_perfcount_make_key(&key, buf, PERFCOUNT_MAX_LEN, CounterIndex, "type"); - data = tdb_fetch_compat(names, key); + data = tdb_fetch(names, key); if(data.dptr == NULL) { DEBUG(3, ("_reg_perfcount_get_counter_info: No type data for counter [%d].\n", CounterIndex)); @@ -742,7 +742,7 @@ static bool _reg_perfcount_get_instance_info(struct PERF_INSTANCE_DEFINITION *in memset(temp, 0, PERFCOUNT_MAX_LEN); snprintf(temp, PERFCOUNT_MAX_LEN, "i%dname", instId); _reg_perfcount_make_key(&key, buf, PERFCOUNT_MAX_LEN, obj->ObjectNameTitleIndex, temp); - data = tdb_fetch_compat(names, key); + data = tdb_fetch(names, key); if(data.dptr == NULL) { /* Not actually an error, but possibly unintended? -- just logging FYI */ @@ -834,7 +834,7 @@ static int _reg_perfcount_assemble_global(struct PERF_DATA_BLOCK *block, { j = i*2; _reg_perfcount_make_key(&key, keybuf, PERFCOUNT_MAX_LEN, j, "rel"); - data = tdb_fetch_compat(names, key); + data = tdb_fetch(names, key); if(data.dptr != NULL) { if(_reg_perfcount_isparent(data)) @@ -872,7 +872,7 @@ static bool _reg_perfcount_get_64(uint64_t *retval, _reg_perfcount_make_key(&key, buf, PERFCOUNT_MAX_LEN, key_part1, key_part2); - data = tdb_fetch_compat(tdb, key); + data = tdb_fetch(tdb, key); if(data.dptr == NULL) { DEBUG(3,("_reg_perfcount_get_64: No data found for key [%s].\n", key.dptr)); diff --git a/source3/utils/net_printing.c b/source3/utils/net_printing.c index d3dcf516d33..6f805ebac5c 100644 --- a/source3/utils/net_printing.c +++ b/source3/utils/net_printing.c @@ -258,7 +258,7 @@ static int net_printing_dump(struct net_context *c, int argc, kbuf.dptr; newkey = tdb_nextkey(tdb, kbuf), free(kbuf.dptr), kbuf=newkey) { - dbuf = tdb_fetch_compat(tdb, kbuf); + dbuf = tdb_fetch(tdb, kbuf); if (!dbuf.dptr) { continue; } @@ -351,7 +351,7 @@ static NTSTATUS printing_migrate_internal(struct net_context *c, kbuf.dptr; newkey = tdb_nextkey(tdb, kbuf), free(kbuf.dptr), kbuf = newkey) { - dbuf = tdb_fetch_compat(tdb, kbuf); + dbuf = tdb_fetch(tdb, kbuf); if (!dbuf.dptr) { continue; } @@ -394,7 +394,7 @@ static NTSTATUS printing_migrate_internal(struct net_context *c, kbuf.dptr; newkey = tdb_nextkey(tdb, kbuf), free(kbuf.dptr), kbuf = newkey) { - dbuf = tdb_fetch_compat(tdb, kbuf); + dbuf = tdb_fetch(tdb, kbuf); if (!dbuf.dptr) { continue; } diff --git a/source3/winbindd/winbindd_cache.c b/source3/winbindd/winbindd_cache.c index 2200e5a923e..90270baf0e9 100644 --- a/source3/winbindd/winbindd_cache.c +++ b/source3/winbindd/winbindd_cache.c @@ -642,7 +642,7 @@ static struct cache_entry *wcache_fetch_raw(char *kstr) TDB_DATA key; key = string_tdb_data(kstr); - data = tdb_fetch_compat(wcache->tdb, key); + data = tdb_fetch(wcache->tdb, key); if (!data.dptr) { /* a cache miss */ return NULL; @@ -1303,7 +1303,7 @@ NTSTATUS wcache_cached_creds_exist(struct winbindd_domain *domain, const struct fstr_sprintf(key_str, "CRED/%s", sid_to_fstring(tmp, sid)); - data = tdb_fetch_compat(cache->tdb, string_tdb_data(key_str)); + data = tdb_fetch(cache->tdb, string_tdb_data(key_str)); if (!data.dptr) { return NT_STATUS_OBJECT_NAME_NOT_FOUND; } @@ -3504,7 +3504,7 @@ NTSTATUS wcache_remove_oldest_cached_creds(struct winbindd_domain *domain, const TDB_DATA data; time_t t; - data = tdb_fetch_compat(cache->tdb, string_tdb_data(cred->name)); + data = tdb_fetch(cache->tdb, string_tdb_data(cred->name)); if (!data.dptr) { DEBUG(10,("wcache_remove_oldest_cached_creds: entry for [%s] not found\n", cred->name)); @@ -4663,7 +4663,7 @@ bool wcache_tdc_fetch_list( struct winbindd_tdc_domain **domains, size_t *num_do if ( !key.dptr ) return false; - data = tdb_fetch_compat( wcache->tdb, key ); + data = tdb_fetch( wcache->tdb, key ); SAFE_FREE( key.dptr ); @@ -5018,7 +5018,7 @@ bool wcache_fetch_ndr(TALLOC_CTX *mem_ctx, struct winbindd_domain *domain, if (!wcache_ndr_key(talloc_tos(), domain->name, opnum, req, &key)) { return false; } - data = tdb_fetch_compat(wcache->tdb, key); + data = tdb_fetch(wcache->tdb, key); TALLOC_FREE(key.dptr); if (data.dptr == NULL) { diff --git a/source4/dsdb/samdb/ldb_modules/schema_load.c b/source4/dsdb/samdb/ldb_modules/schema_load.c index 5ae6e3c0576..c083da48b9e 100644 --- a/source4/dsdb/samdb/ldb_modules/schema_load.c +++ b/source4/dsdb/samdb/ldb_modules/schema_load.c @@ -130,7 +130,7 @@ static int schema_metadata_get_uint64(struct ldb_module *module, tdb_key.dptr = (uint8_t *)discard_const_p(char, key); tdb_key.dsize = strlen(key); - tdb_data = tdb_fetch_compat(tdb, tdb_key); + tdb_data = tdb_fetch(tdb, tdb_key); if (!tdb_data.dptr) { if (tdb_error(tdb) == TDB_ERR_NOEXIST) { *value = default_value; diff --git a/source4/torture/local/dbspeed.c b/source4/torture/local/dbspeed.c index 1800ace04f0..0ef120296f4 100644 --- a/source4/torture/local/dbspeed.c +++ b/source4/torture/local/dbspeed.c @@ -99,7 +99,7 @@ static bool test_tdb_speed(struct torture_context *torture, const void *_data) i = random() % torture_entries; key.dptr = (uint8_t *)talloc_asprintf(tmp_ctx, "S-1-5-21-53173311-3623041448-2049097239-%u", i); key.dsize = strlen((char *)key.dptr)+1; - data = tdb_fetch_compat(tdbw->tdb, key); + data = tdb_fetch(tdbw->tdb, key); talloc_free(key.dptr); if (data.dptr == NULL) { torture_result(torture, TORTURE_FAIL, "Failed to find SID %d!", i); @@ -108,7 +108,7 @@ static bool test_tdb_speed(struct torture_context *torture, const void *_data) free(data.dptr); key.dptr = (uint8_t *)talloc_asprintf(tmp_ctx, "UID %u", i); key.dsize = strlen((char *)key.dptr)+1; - data = tdb_fetch_compat(tdbw->tdb, key); + data = tdb_fetch(tdbw->tdb, key); talloc_free(key.dptr); if (data.dptr == NULL) { torture_result(torture, TORTURE_FAIL, "Failed to find UID %d!", i); -- 2.11.4.GIT