clean out some more cruft
authorAndrew Tridgell <tridge@samba.org>
Tue, 5 Jun 2007 07:57:07 +0000 (17:57 +1000)
committerAndrew Tridgell <tridge@samba.org>
Tue, 5 Jun 2007 07:57:07 +0000 (17:57 +1000)
16 files changed:
common/ctdb.c
common/ctdb_call.c
common/ctdb_client.c
common/ctdb_control.c
common/ctdb_daemon.c
common/ctdb_message.c
common/ctdb_recover.c
common/ctdb_recoverd.c
common/ctdb_traverse.c
common/ctdb_util.c
common/util.c
direct/ctdbd.c
ib/ibw_ctdb_init.c
include/ctdb.h
include/ctdb_private.h
tcp/tcp_init.c

index 354b0f64ceefb6cefc262f08cccbe6cfc85fd657..01654fe518268583483af4009489e3c43ebf31b7 100644 (file)
@@ -78,14 +78,6 @@ void ctdb_set_flags(struct ctdb_context *ctdb, unsigned flags)
        ctdb->flags |= flags;
 }
 
-/*
-  clear some ctdb flags
-*/
-void ctdb_clear_flags(struct ctdb_context *ctdb, unsigned flags)
-{
-       ctdb->flags &= ~flags;
-}
-
 /*
   set the directory for the local databases
 */
@@ -489,7 +481,7 @@ void ctdb_queue_packet(struct ctdb_context *ctdb, struct ctdb_req_header *hdr)
 
        node = ctdb->nodes[hdr->destnode];
 
-       if (hdr->destnode == ctdb->vnn && !(ctdb->flags & CTDB_FLAG_SELF_CONNECT)) {
+       if (hdr->destnode == ctdb->vnn) {
                ctdb_defer_packet(ctdb, hdr);
        } else {
                node->tx_cnt++;
index 1604b0a91c7bf2045e133c85f6f0dbcaf2ae1e0d..0801e60dd76febb25caf56dd44a27961b332a6a2 100644 (file)
@@ -47,7 +47,7 @@
 /*
   a varient of input packet that can be used in lock requeue
 */
-void ctdb_call_input_pkt(void *p, struct ctdb_req_header *hdr)
+static void ctdb_call_input_pkt(void *p, struct ctdb_req_header *hdr)
 {
        struct ctdb_context *ctdb = talloc_get_type(p, struct ctdb_context);
        ctdb_input_pkt(ctdb, hdr);
index 5662c61720edd975c988bf774814ddc85c42e64b..eb3b67560f84106e08c20baea4dd9719c45af4ba 100644 (file)
@@ -287,8 +287,7 @@ struct ctdb_client_call_state *ctdb_call_send(struct ctdb_db_context *ctdb_db,
 
        ret = ctdb_ltdb_fetch(ctdb_db, call->key, &header, ctdb_db, &data);
 
-       if (ret == 0 &&
-           header.dmaster == ctdb->vnn && !(ctdb->flags & CTDB_FLAG_SELF_CONNECT)) {
+       if (ret == 0 && header.dmaster == ctdb->vnn) {
                state = ctdb_client_call_local_send(ctdb_db, call, &header, &data);
                talloc_free(data.dptr);
                ctdb_ltdb_unlock(ctdb_db, call->key);
@@ -1109,31 +1108,6 @@ int ctdb_ctrl_setdmaster(struct ctdb_context *ctdb, struct timeval timeout, uint
        return 0;
 }
 
-/*
-  delete all records from a tdb
- */
-int ctdb_ctrl_cleardb(struct ctdb_context *ctdb, uint32_t destnode, TALLOC_CTX *mem_ctx, uint32_t dbid)
-{
-       int ret;
-       TDB_DATA indata;
-       int32_t res;
-
-       indata.dsize = sizeof(uint32_t);
-       indata.dptr = (unsigned char *)talloc_array(mem_ctx, uint32_t, 1);
-
-       ((uint32_t *)(&indata.dptr[0]))[0] = dbid;
-
-       ret = ctdb_control(ctdb, destnode, 0, 
-                          CTDB_CONTROL_CLEAR_DB, 0, indata, 
-                          NULL, NULL, &res, NULL, NULL);
-       if (ret != 0 || res != 0) {
-               DEBUG(0,(__location__ " ctdb_control for cleardb failed\n"));
-               return -1;
-       }
-
-       return 0;
-}
-
 /*
   ping a node, return number of clients connected
  */
index 14ea6732fefd52a6089933e69320db1225ced3d3..ac2522131f67b52f0e83a6e75181742d4a4fa95c 100644 (file)
@@ -112,10 +112,6 @@ static int32_t ctdb_control_dispatch(struct ctdb_context *ctdb,
                CHECK_CONTROL_DATA_SIZE(sizeof(struct ctdb_control_set_dmaster));
                return ctdb_control_set_dmaster(ctdb, indata);
 
-       case CTDB_CONTROL_CLEAR_DB: 
-               CHECK_CONTROL_DATA_SIZE(sizeof(uint32_t));
-               return ctdb_control_clear_db(ctdb, indata);
-
        case CTDB_CONTROL_PUSH_DB:
                return ctdb_control_push_db(ctdb, indata);
 
index e9b680bd725bafabf8867154f9e429fbacb26b33..36eebbb9ee3f8d584cb76038dc3e99b7e0c73d1a 100644 (file)
@@ -359,7 +359,7 @@ static void daemon_request_call_from_client(struct ctdb_client *client,
        call->call_data.dsize = c->calldatalen;
        call->flags = c->flags;
 
-       if (header.dmaster == ctdb->vnn && !(ctdb->flags & CTDB_FLAG_SELF_CONNECT)) {
+       if (header.dmaster == ctdb->vnn) {
                state = ctdb_call_local_send(ctdb_db, call, &header, &data);
        } else {
                state = ctdb_daemon_call_send_remote(ctdb_db, call, &header);
index 862bf985bb039ff8064945fb235dc0905c8d40b3..5b03164d3e47c73d915b02df181c43674e55287d 100644 (file)
@@ -115,7 +115,7 @@ int ctdb_daemon_send_message(struct ctdb_context *ctdb, uint32_t vnn,
        int len;
 
        /* see if this is a message to ourselves */
-       if (vnn == ctdb->vnn && !(ctdb->flags & CTDB_FLAG_SELF_CONNECT)) {
+       if (vnn == ctdb->vnn) {
                return ctdb_local_message(ctdb, srvid, data);
        }
 
index e1e48bfb31e81a86e8fc340954dce0be697c7881..a27c51263f78a856bb05685e5fc6f6d688df7f1a 100644 (file)
@@ -392,48 +392,6 @@ int32_t ctdb_control_set_dmaster(struct ctdb_context *ctdb, TDB_DATA indata)
        return 0;
 }
 
-
-static int traverse_cleardb(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data, void *p)
-{
-       int ret;
-
-       ret = tdb_delete(tdb, key);
-       if (ret) {
-               DEBUG(0,(__location__ " failed to delete tdb record\n"));
-               return ret;
-       }
-       return 0;
-}
-
-               
-int32_t ctdb_control_clear_db(struct ctdb_context *ctdb, TDB_DATA indata)
-{
-       uint32_t dbid = *(uint32_t *)indata.dptr;
-       struct ctdb_db_context *ctdb_db;
-
-       if (ctdb->freeze_mode != CTDB_FREEZE_FROZEN) {
-               DEBUG(0,("rejecting ctdb_control_clear_db when not frozen\n"));
-               return -1;
-       }
-
-       ctdb_db = find_ctdb_db(ctdb, dbid);
-       if (!ctdb_db) {
-               DEBUG(0,(__location__ " Unknown db 0x%08x\n",dbid));
-               return -1;
-       }
-
-       if (ctdb_lock_all_databases_mark(ctdb) != 0) {
-               DEBUG(0,(__location__ " Failed to get lock on entired db - failing\n"));
-               return -1;
-       }
-
-       tdb_traverse(ctdb_db->ltdb->tdb, traverse_cleardb, NULL);
-
-       ctdb_lock_all_databases_unmark(ctdb);
-
-       return 0;
-}
-
 struct ctdb_set_recmode_state {
        struct ctdb_req_control *c;
        uint32_t recmode;
index 36ecb9f2390bc76df2f33f5c4c48fea2038b5be1..600beb220532bb35a3343c55cb0e58872fe71297 100644 (file)
@@ -662,7 +662,7 @@ static void force_election(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, uint3
 /*
   the main monitoring loop
  */
-void monitor_cluster(struct ctdb_context *ctdb)
+static void monitor_cluster(struct ctdb_context *ctdb)
 {
        uint32_t vnn, num_active, recmode, recmaster;
        TALLOC_CTX *mem_ctx=NULL;
index 721448631efc9beff489b5abc94fdfece589fcd6..caff809a677ba45c96d2acc6ba90a227c064113d 100644 (file)
@@ -116,9 +116,9 @@ static int ctdb_traverse_local_fn(struct tdb_context *tdb, TDB_DATA key, TDB_DAT
 
   The traverse is finished when the callback is called with tdb_null for key and data
  */
-struct ctdb_traverse_local_handle *ctdb_traverse_local(struct ctdb_db_context *ctdb_db,
-                                                ctdb_traverse_fn_t callback,
-                                                void *private_data)
+static struct ctdb_traverse_local_handle *ctdb_traverse_local(struct ctdb_db_context *ctdb_db,
+                                                             ctdb_traverse_fn_t callback,
+                                                             void *private_data)
 {
        struct ctdb_traverse_local_handle *h;
        int ret;
@@ -217,9 +217,9 @@ static void ctdb_traverse_all_timeout(struct event_context *ev, struct timed_eve
   The traverse is finished when the callback is called with tdb_null
   for key and data
  */
-struct ctdb_traverse_all_handle *ctdb_daemon_traverse_all(struct ctdb_db_context *ctdb_db,
-                                                         ctdb_traverse_fn_t callback,
-                                                         void *private_data)
+static struct ctdb_traverse_all_handle *ctdb_daemon_traverse_all(struct ctdb_db_context *ctdb_db,
+                                                                ctdb_traverse_fn_t callback,
+                                                                void *private_data)
 {
        struct ctdb_traverse_all_handle *state;
        struct ctdb_context *ctdb = ctdb_db->ctdb;
index 3fbf9882e1c840ff2aec6e5b98cfe9e9417c6f92..821ae79b3b74bf291144d82b807aa85a5a707950 100644 (file)
@@ -105,17 +105,6 @@ uint32_t ctdb_hash(const TDB_DATA *key)
        return (1103515243 * value + 12345);  
 }
 
-/*
-  hash function for a string
-*/
-uint32_t ctdb_hash_string(const char *str)
-{
-       TDB_DATA data;
-       data.dptr = (uint8_t *)discard_const(str);
-       data.dsize = strlen(str)+1;
-       return ctdb_hash(&data);
-}
-
 /*
   a type checking varient of idr_find
  */
index 6ccecc80c4e8ce7181396d7d1104b9de7f172884..40bc75c3fa69b891f20b54bf1e87d95c5999db9f 100644 (file)
@@ -47,7 +47,7 @@ double timeval_elapsed(struct timeval *tv)
 /**
   return a timeval struct with the given elements
 */
-struct timeval timeval_set(uint32_t secs, uint32_t usecs)
+_PUBLIC_ struct timeval timeval_set(uint32_t secs, uint32_t usecs)
 {
        struct timeval tv;
        tv.tv_sec = secs;
@@ -55,7 +55,7 @@ struct timeval timeval_set(uint32_t secs, uint32_t usecs)
        return tv;
 }
 
-int timeval_compare(const struct timeval *tv1, const struct timeval *tv2)
+_PUBLIC_ int timeval_compare(const struct timeval *tv1, const struct timeval *tv2)
 {
        if (tv1->tv_sec  > tv2->tv_sec)  return 1;
        if (tv1->tv_sec  < tv2->tv_sec)  return -1;
@@ -64,8 +64,8 @@ int timeval_compare(const struct timeval *tv1, const struct timeval *tv2)
        return 0;
 }
 
-struct timeval timeval_until(const struct timeval *tv1,
-                            const struct timeval *tv2)
+_PUBLIC_ struct timeval timeval_until(const struct timeval *tv1,
+                                     const struct timeval *tv2)
 {
        struct timeval t;
        if (timeval_compare(tv1, tv2) >= 0) {
@@ -81,7 +81,7 @@ struct timeval timeval_until(const struct timeval *tv1,
        return t;
 }
 
-_PUBLIC_ struct timeval timeval_add(const struct timeval *tv,
+static struct timeval timeval_add(const struct timeval *tv,
                           uint32_t secs, uint32_t usecs)
 {
        struct timeval tv2 = *tv;
@@ -100,7 +100,7 @@ _PUBLIC_ struct timeval timeval_current_ofs(uint32_t secs, uint32_t usecs)
        return timeval_add(&tv, secs, usecs);
 }
 
-_PUBLIC_ char *fd_load(int fd, size_t *size, TALLOC_CTX *mem_ctx)
+static char *fd_load(int fd, size_t *size, TALLOC_CTX *mem_ctx)
 {
        struct stat sbuf;
        char *p;
@@ -122,7 +122,7 @@ _PUBLIC_ char *fd_load(int fd, size_t *size, TALLOC_CTX *mem_ctx)
 }
 
 
-_PUBLIC_ char *file_load(const char *fname, size_t *size, TALLOC_CTX *mem_ctx)
+static char *file_load(const char *fname, size_t *size, TALLOC_CTX *mem_ctx)
 {
        int fd;
        char *p;
index 8376d8b8473c62ad0e5581d78cdea4e99aa4f2e2..a2092a697b2ed83d5a93ff0c69eaaa361a32e9d9 100644 (file)
@@ -48,14 +48,12 @@ static struct {
        const char *logfile;
        const char *recovery_lock_file;
        const char *db_dir;
-       int self_connect;
 } options = {
        .nlist = ETCDIR "/ctdb/nodes",
        .transport = "tcp",
        .event_script = ETCDIR "/ctdb/events",
        .logfile = VARDIR "/log/log.ctdb",
        .db_dir = VARDIR "/ctdb",
-       .self_connect = 0,
 };
 
 
@@ -79,7 +77,6 @@ int main(int argc, const char *argv[])
                { "nlist", 0, POPT_ARG_STRING, &options.nlist, 0, "node list file", "filename" },
                { "listen", 0, POPT_ARG_STRING, &options.myaddress, 0, "address to listen on", "address" },
                { "transport", 0, POPT_ARG_STRING, &options.transport, 0, "protocol transport", NULL },
-               { "self-connect", 0, POPT_ARG_NONE, &options.self_connect, 0, "enable self connect", "boolean" },
                { "dbdir", 0, POPT_ARG_STRING, &options.db_dir, 0, "directory for the tdb files", NULL },
                { "reclock", 0, POPT_ARG_STRING, &options.recovery_lock_file, 0, "location of recovery lock file", "filename" },
                POPT_TABLEEND
@@ -125,10 +122,6 @@ int main(int argc, const char *argv[])
                exit(1);
        }
 
-       if (options.self_connect) {
-               ctdb_set_flags(ctdb, CTDB_FLAG_SELF_CONNECT);
-       }
-
        ret = ctdb_set_transport(ctdb, options.transport);
        if (ret == -1) {
                printf("ctdb_set_transport failed - %s\n", ctdb_errstr(ctdb));
index b5e6c5cffb37583b81dd7aa08132b5804bcf9fa6..33d6ecaf7f91ab2cab501462793ed72b4b5a49f9 100644 (file)
@@ -106,10 +106,9 @@ static int ctdb_ibw_start(struct ctdb_context *ctdb)
        /* everything async here */
        for (i=0;i<ctdb->num_nodes;i++) {
                struct ctdb_node *node = ctdb->nodes[i];
-               if (!(ctdb->flags & CTDB_FLAG_SELF_CONNECT) &&
-                       ctdb_same_address(&ctdb->address, &node->address))
-                       continue;
-               ctdb_ibw_node_connect(node);
+               if (!ctdb_same_address(&ctdb->address, &node->address)) {
+                       ctdb_ibw_node_connect(node);
+               }
        }
 
        return 0;
index 74039420fa61f08ffee8d60107641a398e987e01..be283a01bf3b3526b3d2d7f4282a540e6f09b92e 100644 (file)
@@ -49,7 +49,6 @@ struct ctdb_call_info {
 /*
   ctdb flags
 */
-#define CTDB_FLAG_SELF_CONNECT (1<<0)
 #define CTDB_FLAG_TORTURE      (1<<1)
 
 /* 
@@ -102,11 +101,6 @@ int ctdb_set_tdb_dir(struct ctdb_context *ctdb, const char *dir);
 */
 void ctdb_set_flags(struct ctdb_context *ctdb, unsigned flags);
 
-/*
-  clear some flags
-*/
-void ctdb_clear_flags(struct ctdb_context *ctdb, unsigned flags);
-
 /*
   set max acess count before a dmaster migration
 */
@@ -277,11 +271,6 @@ int ctdb_ctrl_setdmaster(struct ctdb_context *ctdb,
        struct timeval timeout, uint32_t destnode, 
        TALLOC_CTX *mem_ctx, uint32_t dbid, uint32_t dmaster);
 
-/*
-  delete all records from a tdb
- */
-int ctdb_ctrl_cleardb(struct ctdb_context *ctdb, uint32_t destnode, TALLOC_CTX *mem_ctx, uint32_t dbid);
-
 /*
   write a record on a specific db (this implicitely updates dmaster of the record to locally be the vnn of the node where the control is executed on)
  */
index 25fb1c685e94cedcc10647c0c8b8dd4393601452..7f7c6412cfd42c8f9b520e23f8fcafcc0cbb93c4 100644 (file)
@@ -369,7 +369,7 @@ enum ctdb_controls {CTDB_CONTROL_PROCESS_EXISTS          = 0,
                    CTDB_CONTROL_GET_DBMAP               = 9,
                    CTDB_CONTROL_GET_NODEMAP             = 10,
                    CTDB_CONTROL_SET_DMASTER             = 11,
-                   CTDB_CONTROL_CLEAR_DB                = 12,
+                   /* #12 removed */
                    CTDB_CONTROL_PULL_DB                 = 13,
                    CTDB_CONTROL_PUSH_DB                 = 14,
                    CTDB_CONTROL_GET_RECMODE             = 15,
@@ -893,7 +893,6 @@ struct ctdb_rec_data *ctdb_marshall_record(TALLOC_CTX *mem_ctx, uint32_t reqid,
 int32_t ctdb_control_pull_db(struct ctdb_context *ctdb, TDB_DATA indata, TDB_DATA *outdata);
 int32_t ctdb_control_push_db(struct ctdb_context *ctdb, TDB_DATA indata);
 int32_t ctdb_control_set_dmaster(struct ctdb_context *ctdb, TDB_DATA indata);
-int32_t ctdb_control_clear_db(struct ctdb_context *ctdb, TDB_DATA indata);
 
 int32_t ctdb_control_set_recmode(struct ctdb_context *ctdb, 
                                 struct ctdb_req_control *c,
index 7e75195302853ee4b4abf75ff61e0237591b0e14..ab1de71ca4abbb383f1fd2df47de92d7a9d5ec3d 100644 (file)
@@ -80,10 +80,10 @@ static int ctdb_tcp_start(struct ctdb_context *ctdb)
                struct ctdb_node *node = *(ctdb->nodes + i);
                struct ctdb_tcp_node *tnode = talloc_get_type(
                        node->private_data, struct ctdb_tcp_node);
-               if (!(ctdb->flags & CTDB_FLAG_SELF_CONNECT) &&
-                   ctdb_same_address(&ctdb->address, &node->address)) continue;
-               event_add_timed(ctdb->ev, tnode, timeval_zero(), 
-                               ctdb_tcp_node_connect, node);
+               if (!ctdb_same_address(&ctdb->address, &node->address)) {
+                       event_add_timed(ctdb->ev, tnode, timeval_zero(), 
+                                       ctdb_tcp_node_connect, node);
+               }
        }
 
        return 0;