lib: Remove tdb_fetch_compat
authorVolker Lendecke <vl@samba.org>
Thu, 12 Mar 2015 14:23:17 +0000 (14:23 +0000)
committerMichael Adam <obnox@samba.org>
Tue, 17 Mar 2015 10:30:52 +0000 (11:30 +0100)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
13 files changed:
lib/tdb_compat/tdb_compat.h
source3/lib/dbwrap/dbwrap_ctdb.c
source3/lib/eventlog/eventlog.c
source3/libsmb/smb_share_modes.c
source3/nmbd/nmbd_winsserver.c
source3/printing/nt_printing_migrate_internal.c
source3/printing/nt_printing_tdb.c
source3/printing/printing.c
source3/registry/reg_perfcount.c
source3/utils/net_printing.c
source3/winbindd/winbindd_cache.c
source4/dsdb/samdb/ldb_modules/schema_load.c
source4/torture/local/dbspeed.c

index 2397de1342f21b3e2576a5135615ecad6b9da593..da2e1dc3d3536f7925f56bb210af38d761852ec1 100644 (file)
@@ -29,6 +29,4 @@
 #include <ccan/typesafe_cb/typesafe_cb.h>
 #include <tdb.h>
 
-#define tdb_fetch_compat tdb_fetch
-
 #endif /* TDB_COMPAT_H */
index e6dcc0e987c35908e854e97c7a35500f5752a9aa..947a888982d56c6fd35e690af060b3efe68d28f9 100644 (file)
@@ -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
index 34752fd8006979c65f8db0761a74560a6286174b..f9ac0900150fa8e4a55fa1a10c0de4f03ddeea79 100644 (file)
@@ -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",
index fe0bdeafe0c0858a2f3a22618d754b9c8c902216..7a6acc3d798a19126229694a6514942a99c968ff 100644 (file)
@@ -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 ! */
        }
index a56ff45b9810d347f56a6eb765522ec09b49f5cd..bf32dbda43fd69050ff0c511bbae39c7f33a90f5 100644 (file)
@@ -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;
index 1765329dca3bac60689811c64f9846128f39f624..5e48de2764ceadd6c74e6ed1689de64b5ec3b44d 100644 (file)
@@ -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;
                }
index f043575bce9155c6cf029904867a9115d85560d9..ea1e87e4a12bb969f21f2a628af411eb4c5054d0 100644 (file)
@@ -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"));
index 61afa2881f081a31818c5268a979d302df8a792d..7c5798599227fecbb5ef8379da921af75a51dcd9 100644 (file)
@@ -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
index 2e308454d0d35cec7fdffead39a3fc5a160f570d..f78ab44e0a1397699a189152725167e46556263c 100644 (file)
@@ -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));
index d3dcf516d337c6e3124cd202d91069a6f7dc2302..6f805ebac5c59d4983fd7c542912c54e05930abd 100644 (file)
@@ -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;
                }
index 2200e5a923e13327a0d2c90d5cdde61770785fee..90270baf0e9b109e8a4662a8068a7d5b3606b74f 100644 (file)
@@ -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) {
index 5ae6e3c0576fa3d403824377ac071af16a724035..c083da48b9eb945a0172c032e1af8147f7868041 100644 (file)
@@ -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;
index 1800ace04f0aab0036a38e07b8afbd56b065a827..0ef120296f4e1c1688a72c170a637df3d4b24942 100644 (file)
@@ -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);