ctdb-client: Only get capabilities from active nodes
[obnox/samba/samba-obnox.git] / ctdb / client / ctdb_client.c
index cc96eb57fd614ccdf1a1b0548135ccd3ba28acfa..6615730b93e8138c329f87027d3183f8486815a3 100644 (file)
 #include "lib/util/debug.h"
 #include "lib/util/samba_util.h"
 
-#include "ctdb_logging.h"
 #include "ctdb_private.h"
 #include "ctdb_client.h"
 
 #include "common/reqid.h"
 #include "common/system.h"
 #include "common/common.h"
+#include "common/logging.h"
 
 /*
   allocate a packet for use in client<->daemon communication
@@ -1014,7 +1014,7 @@ static void ctdb_client_reply_control(struct ctdb_context *ctdb,
                                                 c->errorlen);
        }
 
-       /* state->outdata now uses resources from c so we dont want c
+       /* state->outdata now uses resources from c so we don't want c
           to just dissappear from under us while state is still alive
        */
        talloc_steal(state, c);
@@ -1668,16 +1668,16 @@ struct ctdb_client_control_state *ctdb_ctrl_pulldb_send(
        uint32_t lmaster, TALLOC_CTX *mem_ctx, struct timeval timeout)
 {
        TDB_DATA indata;
-       struct ctdb_control_pulldb *pull;
+       struct ctdb_pulldb *pull;
        struct ctdb_client_control_state *state;
 
-       pull = talloc(mem_ctx, struct ctdb_control_pulldb);
+       pull = talloc(mem_ctx, struct ctdb_pulldb);
        CTDB_NO_MEMORY_NULL(ctdb, pull);
 
        pull->db_id   = dbid;
        pull->lmaster = lmaster;
 
-       indata.dsize = sizeof(struct ctdb_control_pulldb);
+       indata.dsize = sizeof(struct ctdb_pulldb);
        indata.dptr  = (unsigned char *)pull;
 
        state = ctdb_control_send(ctdb, destnode, 0, 
@@ -2693,16 +2693,16 @@ int ctdb_ctrl_set_tunable(struct ctdb_context *ctdb,
                          uint32_t destnode,
                          const char *name, uint32_t value)
 {
-       struct ctdb_control_set_tunable *t;
+       struct ctdb_tunable_old *t;
        TDB_DATA data;
        int32_t res;
        int ret;
 
-       data.dsize = offsetof(struct ctdb_control_set_tunable, name) + strlen(name) + 1;
+       data.dsize = offsetof(struct ctdb_tunable_old, name) + strlen(name) + 1;
        data.dptr  = talloc_size(ctdb, data.dsize);
        CTDB_NO_MEMORY(ctdb, data.dptr);
 
-       t = (struct ctdb_control_set_tunable *)data.dptr;
+       t = (struct ctdb_tunable_old *)data.dptr;
        t->length = strlen(name)+1;
        memcpy(t->name, name, t->length);
        t->value = value;
@@ -2810,13 +2810,13 @@ int ctdb_ctrl_get_public_ip_info(struct ctdb_context *ctdb,
                                 struct timeval timeout, uint32_t destnode,
                                 TALLOC_CTX *mem_ctx,
                                 const ctdb_sock_addr *addr,
-                                struct ctdb_control_public_ip_info **_info)
+                                struct ctdb_public_ip_info_old **_info)
 {
        int ret;
        TDB_DATA indata;
        TDB_DATA outdata;
        int32_t res;
-       struct ctdb_control_public_ip_info *info;
+       struct ctdb_public_ip_info_old *info;
        uint32_t len;
        uint32_t i;
 
@@ -2833,7 +2833,7 @@ int ctdb_ctrl_get_public_ip_info(struct ctdb_context *ctdb,
                return -1;
        }
 
-       len = offsetof(struct ctdb_control_public_ip_info, ifaces);
+       len = offsetof(struct ctdb_public_ip_info_old, ifaces);
        if (len > outdata.dsize) {
                DEBUG(DEBUG_ERR,(__location__ " ctdb_control for get public ip info "
                                "returned invalid data with size %u > %u\n",
@@ -2843,8 +2843,8 @@ int ctdb_ctrl_get_public_ip_info(struct ctdb_context *ctdb,
                return -1;
        }
 
-       info = (struct ctdb_control_public_ip_info *)outdata.dptr;
-       len += info->num*sizeof(struct ctdb_control_iface_info);
+       info = (struct ctdb_public_ip_info_old *)outdata.dptr;
+       len += info->num*sizeof(struct ctdb_iface);
 
        if (len > outdata.dsize) {
                DEBUG(DEBUG_ERR,(__location__ " ctdb_control for get public ip info "
@@ -2860,7 +2860,7 @@ int ctdb_ctrl_get_public_ip_info(struct ctdb_context *ctdb,
                info->ifaces[i].name[CTDB_IFACE_SIZE] = '\0';
        }
 
-       *_info = (struct ctdb_control_public_ip_info *)talloc_memdup(mem_ctx,
+       *_info = (struct ctdb_public_ip_info_old *)talloc_memdup(mem_ctx,
                                                                outdata.dptr,
                                                                outdata.dsize);
        talloc_free(outdata.dptr);
@@ -2877,12 +2877,12 @@ int ctdb_ctrl_get_public_ip_info(struct ctdb_context *ctdb,
 int ctdb_ctrl_get_ifaces(struct ctdb_context *ctdb,
                         struct timeval timeout, uint32_t destnode,
                         TALLOC_CTX *mem_ctx,
-                        struct ctdb_control_get_ifaces **_ifaces)
+                        struct ctdb_iface_list_old **_ifaces)
 {
        int ret;
        TDB_DATA outdata;
        int32_t res;
-       struct ctdb_control_get_ifaces *ifaces;
+       struct ctdb_iface_list_old *ifaces;
        uint32_t len;
        uint32_t i;
 
@@ -2896,7 +2896,7 @@ int ctdb_ctrl_get_ifaces(struct ctdb_context *ctdb,
                return -1;
        }
 
-       len = offsetof(struct ctdb_control_get_ifaces, ifaces);
+       len = offsetof(struct ctdb_iface_list_old, ifaces);
        if (len > outdata.dsize) {
                DEBUG(DEBUG_ERR,(__location__ " ctdb_control for get ifaces "
                                "returned invalid data with size %u > %u\n",
@@ -2906,8 +2906,8 @@ int ctdb_ctrl_get_ifaces(struct ctdb_context *ctdb,
                return -1;
        }
 
-       ifaces = (struct ctdb_control_get_ifaces *)outdata.dptr;
-       len += ifaces->num*sizeof(struct ctdb_control_iface_info);
+       ifaces = (struct ctdb_iface_list_old *)outdata.dptr;
+       len += ifaces->num*sizeof(struct ctdb_iface);
 
        if (len > outdata.dsize) {
                DEBUG(DEBUG_ERR,(__location__ " ctdb_control for get ifaces "
@@ -2923,7 +2923,7 @@ int ctdb_ctrl_get_ifaces(struct ctdb_context *ctdb,
                ifaces->ifaces[i].name[CTDB_IFACE_SIZE] = '\0';
        }
 
-       *_ifaces = (struct ctdb_control_get_ifaces *)talloc_memdup(mem_ctx,
+       *_ifaces = (struct ctdb_iface_list_old *)talloc_memdup(mem_ctx,
                                                                  outdata.dptr,
                                                                  outdata.dsize);
        talloc_free(outdata.dptr);
@@ -2940,7 +2940,7 @@ int ctdb_ctrl_get_ifaces(struct ctdb_context *ctdb,
 int ctdb_ctrl_set_iface_link(struct ctdb_context *ctdb,
                             struct timeval timeout, uint32_t destnode,
                             TALLOC_CTX *mem_ctx,
-                            const struct ctdb_control_iface_info *info)
+                            const struct ctdb_iface *info)
 {
        int ret;
        TDB_DATA indata;
@@ -3030,10 +3030,10 @@ int ctdb_ctrl_modflags(struct ctdb_context *ctdb, struct timeval timeout, uint32
 /*
   get all tunables
  */
-int ctdb_ctrl_get_all_tunables(struct ctdb_context *ctdb, 
-                              struct timeval timeout, 
+int ctdb_ctrl_get_all_tunables(struct ctdb_context *ctdb,
+                              struct timeval timeout,
                               uint32_t destnode,
-                              struct ctdb_tunable *tunables)
+                              struct ctdb_tunable_list *tunables)
 {
        TDB_DATA outdata;
        int ret;
@@ -3049,10 +3049,10 @@ int ctdb_ctrl_get_all_tunables(struct ctdb_context *ctdb,
        if (outdata.dsize != sizeof(*tunables)) {
                DEBUG(DEBUG_ERR,(__location__ " bad data size %u in ctdb_ctrl_get_all_tunables should be %u\n",
                         (unsigned)outdata.dsize, (unsigned)sizeof(*tunables)));
-               return -1;              
+               return -1;
        }
 
-       *tunables = *(struct ctdb_tunable *)outdata.dptr;
+       *tunables = *(struct ctdb_tunable_list *)outdata.dptr;
        talloc_free(outdata.dptr);
        return 0;
 }
@@ -3060,16 +3060,15 @@ int ctdb_ctrl_get_all_tunables(struct ctdb_context *ctdb,
 /*
   add a public address to a node
  */
-int ctdb_ctrl_add_public_ip(struct ctdb_context *ctdb, 
-                     struct timeval timeout, 
-                     uint32_t destnode,
-                     struct ctdb_control_ip_iface *pub)
+int ctdb_ctrl_add_public_ip(struct ctdb_context *ctdb,
+                           struct timeval timeout, uint32_t destnode,
+                           struct ctdb_addr_info_old *pub)
 {
        TDB_DATA data;
        int32_t res;
        int ret;
 
-       data.dsize = offsetof(struct ctdb_control_ip_iface, iface) + pub->len;
+       data.dsize = offsetof(struct ctdb_addr_info_old, iface) + pub->len;
        data.dptr  = (unsigned char *)pub;
 
        ret = ctdb_control(ctdb, destnode, 0, CTDB_CONTROL_ADD_PUBLIC_IP, 0, data, NULL,
@@ -3085,16 +3084,15 @@ int ctdb_ctrl_add_public_ip(struct ctdb_context *ctdb,
 /*
   delete a public address from a node
  */
-int ctdb_ctrl_del_public_ip(struct ctdb_context *ctdb, 
-                     struct timeval timeout, 
-                     uint32_t destnode,
-                     struct ctdb_control_ip_iface *pub)
+int ctdb_ctrl_del_public_ip(struct ctdb_context *ctdb,
+                           struct timeval timeout, uint32_t destnode,
+                           struct ctdb_addr_info_old *pub)
 {
        TDB_DATA data;
        int32_t res;
        int ret;
 
-       data.dsize = offsetof(struct ctdb_control_ip_iface, iface) + pub->len;
+       data.dsize = offsetof(struct ctdb_addr_info_old, iface) + pub->len;
        data.dptr  = (unsigned char *)pub;
 
        ret = ctdb_control(ctdb, destnode, 0, CTDB_CONTROL_DEL_PUBLIC_IP, 0, data, NULL,
@@ -3113,13 +3111,13 @@ int ctdb_ctrl_del_public_ip(struct ctdb_context *ctdb,
 int ctdb_ctrl_killtcp(struct ctdb_context *ctdb, 
                      struct timeval timeout, 
                      uint32_t destnode,
-                     struct ctdb_tcp_connection *killtcp)
+                     struct ctdb_connection *killtcp)
 {
        TDB_DATA data;
        int32_t res;
        int ret;
 
-       data.dsize = sizeof(struct ctdb_tcp_connection);
+       data.dsize = sizeof(struct ctdb_connection);
        data.dptr  = (unsigned char *)killtcp;
 
        ret = ctdb_control(ctdb, destnode, 0, CTDB_CONTROL_KILL_TCP, 0, data, NULL,
@@ -3135,22 +3133,20 @@ int ctdb_ctrl_killtcp(struct ctdb_context *ctdb,
 /*
   send a gratious arp
  */
-int ctdb_ctrl_gratious_arp(struct ctdb_context *ctdb, 
-                     struct timeval timeout, 
-                     uint32_t destnode,
-                     ctdb_sock_addr *addr,
-                     const char *ifname)
+int ctdb_ctrl_gratious_arp(struct ctdb_context *ctdb,
+                          struct timeval timeout, uint32_t destnode,
+                          ctdb_sock_addr *addr, const char *ifname)
 {
        TDB_DATA data;
        int32_t res;
        int ret, len;
-       struct ctdb_control_gratious_arp *gratious_arp;
+       struct ctdb_addr_info_old *gratious_arp;
        TALLOC_CTX *tmp_ctx = talloc_new(ctdb);
 
 
        len = strlen(ifname)+1;
-       gratious_arp = talloc_size(tmp_ctx, 
-               offsetof(struct ctdb_control_gratious_arp, iface) + len);
+       gratious_arp = talloc_size(tmp_ctx,
+               offsetof(struct ctdb_addr_info_old, iface) + len);
        CTDB_NO_MEMORY(ctdb, gratious_arp);
 
        gratious_arp->addr = *addr;
@@ -3158,10 +3154,10 @@ int ctdb_ctrl_gratious_arp(struct ctdb_context *ctdb,
        memcpy(&gratious_arp->iface[0], ifname, len);
 
 
-       data.dsize = offsetof(struct ctdb_control_gratious_arp, iface) + len;
+       data.dsize = offsetof(struct ctdb_addr_info_old, iface) + len;
        data.dptr  = (unsigned char *)gratious_arp;
 
-       ret = ctdb_control(ctdb, destnode, 0, CTDB_CONTROL_SEND_GRATIOUS_ARP, 0, data, NULL,
+       ret = ctdb_control(ctdb, destnode, 0, CTDB_CONTROL_SEND_GRATUITOUS_ARP, 0, data, NULL,
                           NULL, &res, &timeout, NULL);
        if (ret != 0 || res != 0) {
                DEBUG(DEBUG_ERR,(__location__ " ctdb_control for gratious_arp failed\n"));
@@ -3180,7 +3176,7 @@ int ctdb_ctrl_get_tcp_tickles(struct ctdb_context *ctdb,
                              struct timeval timeout, uint32_t destnode, 
                              TALLOC_CTX *mem_ctx, 
                              ctdb_sock_addr *addr,
-                             struct ctdb_control_tcp_tickle_list **list)
+                             struct ctdb_tickle_list_old **list)
 {
        int ret;
        TDB_DATA data, outdata;
@@ -3197,7 +3193,7 @@ int ctdb_ctrl_get_tcp_tickles(struct ctdb_context *ctdb,
                return -1;
        }
 
-       *list = (struct ctdb_control_tcp_tickle_list *)outdata.dptr;
+       *list = (struct ctdb_tickle_list_old *)outdata.dptr;
 
        return status;
 }
@@ -3292,9 +3288,9 @@ int ctdb_ctrl_check_server_id(struct ctdb_context *ctdb,
    get the list of server ids that are registered on a node
 */
 int ctdb_ctrl_get_server_id_list(struct ctdb_context *ctdb,
-               TALLOC_CTX *mem_ctx,
-               struct timeval timeout, uint32_t destnode, 
-               struct ctdb_server_id_list **svid_list)
+                                TALLOC_CTX *mem_ctx,
+                                struct timeval timeout, uint32_t destnode,
+                                struct ctdb_client_id_list_old **svid_list)
 {
        int ret;
        TDB_DATA outdata;
@@ -3308,8 +3304,8 @@ int ctdb_ctrl_get_server_id_list(struct ctdb_context *ctdb,
                return -1;
        }
 
-       *svid_list = (struct ctdb_server_id_list *)talloc_steal(mem_ctx, outdata.dptr);
-                   
+       *svid_list = (struct ctdb_client_id_list_old *)talloc_steal(mem_ctx, outdata.dptr);
+
        return 0;
 }
 
@@ -3781,7 +3777,7 @@ ctdb_get_capabilities(struct ctdb_context *ctdb,
        uint32_t i, res;
        struct ctdb_node_capabilities *ret;
 
-       nodes = list_of_connected_nodes(ctdb, nodemap, mem_ctx, true);
+       nodes = list_of_active_nodes(ctdb, nodemap, mem_ctx, true);
 
        ret = talloc_array(mem_ctx, struct ctdb_node_capabilities,
                           nodemap->num);
@@ -3826,16 +3822,9 @@ bool ctdb_node_has_capabilities(struct ctdb_node_capabilities *caps,
 }
 
 
-struct server_id {
-       uint64_t pid;
-       uint32_t task_id;
-       uint32_t vnn;
-       uint64_t unique_id;
-};
-
-static struct server_id server_id_fetch(struct ctdb_context *ctdb, uint32_t reqid)
+static struct ctdb_server_id server_id_fetch(struct ctdb_context *ctdb, uint32_t reqid)
 {
-       struct server_id id;
+       struct ctdb_server_id id;
 
        id.pid = getpid();
        id.task_id = reqid;
@@ -3849,7 +3838,7 @@ static struct server_id server_id_fetch(struct ctdb_context *ctdb, uint32_t reqi
 /* This is basically a copy from Samba's server_id.*.  However, a
  * dependency chain stops us from using Samba's version, so use a
  * renamed copy until a better solution is found. */
-static bool ctdb_server_id_equal(struct server_id *id1, struct server_id *id2)
+static bool ctdb_server_id_equal(struct ctdb_server_id *id1, struct ctdb_server_id *id2)
 {
        if (id1->pid != id2->pid) {
                return false;
@@ -3870,7 +3859,7 @@ static bool ctdb_server_id_equal(struct server_id *id1, struct server_id *id2)
        return true;
 }
 
-static bool server_id_exists(struct ctdb_context *ctdb, struct server_id *id)
+static bool server_id_exists(struct ctdb_context *ctdb, struct ctdb_server_id *id)
 {
        struct ctdb_client_id sid;
        int ret;
@@ -3894,28 +3883,12 @@ static bool server_id_exists(struct ctdb_context *ctdb, struct server_id *id)
        return false;
 }
 
-
-enum g_lock_type {
-       G_LOCK_READ = 0,
-       G_LOCK_WRITE = 1,
-};
-
-struct g_lock_rec {
-       enum g_lock_type type;
-       struct server_id id;
-};
-
-struct g_lock_recs {
-       unsigned int num;
-       struct g_lock_rec *lock;
-};
-
 static bool g_lock_parse(TALLOC_CTX *mem_ctx, TDB_DATA data,
-                        struct g_lock_recs **locks)
+                        struct ctdb_g_lock_list **locks)
 {
-       struct g_lock_recs *recs;
+       struct ctdb_g_lock_list *recs;
 
-       recs = talloc_zero(mem_ctx, struct g_lock_recs);
+       recs = talloc_zero(mem_ctx, struct ctdb_g_lock_list);
        if (recs == NULL) {
                return false;
        }
@@ -3924,14 +3897,14 @@ static bool g_lock_parse(TALLOC_CTX *mem_ctx, TDB_DATA data,
                goto done;
        }
 
-       if (data.dsize % sizeof(struct g_lock_rec) != 0) {
+       if (data.dsize % sizeof(struct ctdb_g_lock) != 0) {
                DEBUG(DEBUG_ERR, (__location__ "invalid data size %lu in g_lock record\n",
                                  (unsigned long)data.dsize));
                talloc_free(recs);
                return false;
        }
 
-       recs->num = data.dsize / sizeof(struct g_lock_rec);
+       recs->num = data.dsize / sizeof(struct ctdb_g_lock);
        recs->lock = talloc_memdup(mem_ctx, data.dptr, data.dsize);
        if (recs->lock == NULL) {
                talloc_free(recs);
@@ -3953,8 +3926,8 @@ static bool g_lock_lock(TALLOC_CTX *mem_ctx,
 {
        TDB_DATA key, data;
        struct ctdb_record_handle *h;
-       struct g_lock_recs *locks;
-       struct server_id id;
+       struct ctdb_g_lock_list *locks;
+       struct ctdb_server_id id;
        struct timeval t_start;
        int i;
 
@@ -3987,13 +3960,13 @@ again:
 
        i = 0;
        while (i < locks->num) {
-               if (ctdb_server_id_equal(&locks->lock[i].id, &id)) {
+               if (ctdb_server_id_equal(&locks->lock[i].sid, &id)) {
                        /* Internal error */
                        talloc_free(h);
                        return false;
                }
 
-               if (!server_id_exists(ctdb_db->ctdb, &locks->lock[i].id)) {
+               if (!server_id_exists(ctdb_db->ctdb, &locks->lock[i].sid)) {
                        if (i < locks->num-1) {
                                locks->lock[i] = locks->lock[locks->num-1];
                        }
@@ -4011,19 +3984,19 @@ again:
                goto again;
        }
 
-       locks->lock = talloc_realloc(locks, locks->lock, struct g_lock_rec,
+       locks->lock = talloc_realloc(locks, locks->lock, struct ctdb_g_lock,
                                     locks->num+1);
        if (locks->lock == NULL) {
                talloc_free(h);
                return false;
        }
 
-       locks->lock[locks->num].type = G_LOCK_WRITE;
-       locks->lock[locks->num].id = id;
+       locks->lock[locks->num].type = CTDB_G_LOCK_WRITE;
+       locks->lock[locks->num].sid = id;
        locks->num++;
 
        data.dptr = (uint8_t *)locks->lock;
-       data.dsize = locks->num * sizeof(struct g_lock_rec);
+       data.dsize = locks->num * sizeof(struct ctdb_g_lock);
 
        if (ctdb_record_store(h, data) != 0) {
                DEBUG(DEBUG_ERR, ("g_lock: failed to write transaction lock for "
@@ -4051,8 +4024,8 @@ static bool g_lock_unlock(TALLOC_CTX *mem_ctx,
 {
        TDB_DATA key, data;
        struct ctdb_record_handle *h;
-       struct g_lock_recs *locks;
-       struct server_id id;
+       struct ctdb_g_lock_list *locks;
+       struct ctdb_server_id id;
        int i;
        bool found = false;
 
@@ -4075,7 +4048,7 @@ static bool g_lock_unlock(TALLOC_CTX *mem_ctx,
        id = server_id_fetch(ctdb_db->ctdb, reqid);
 
        for (i=0; i<locks->num; i++) {
-               if (ctdb_server_id_equal(&locks->lock[i].id, &id)) {
+               if (ctdb_server_id_equal(&locks->lock[i].sid, &id)) {
                        if (i < locks->num-1) {
                                locks->lock[i] = locks->lock[locks->num-1];
                        }
@@ -4092,7 +4065,7 @@ static bool g_lock_unlock(TALLOC_CTX *mem_ctx,
        }
 
        data.dptr = (uint8_t *)locks->lock;
-       data.dsize = locks->num * sizeof(struct g_lock_rec);
+       data.dsize = locks->num * sizeof(struct ctdb_g_lock);
 
        if (ctdb_record_store(h, data) != 0) {
                talloc_free(h);
@@ -4415,38 +4388,6 @@ int ctdb_ctrl_recd_ping(struct ctdb_context *ctdb)
        return 0;
 }
 
-/* When forking the main daemon and the child process needs to connect
- * back to the daemon as a client process, this function can be used
- * to change the ctdb context from daemon into client mode.  The child
- * process must be created using ctdb_fork() and not fork() -
- * ctdb_fork() does some necessary housekeeping.
- */
-int switch_from_server_to_client(struct ctdb_context *ctdb, const char *fmt, ...)
-{
-       int ret;
-       va_list ap;
-
-       /* Add extra information so we can identify this in the logs */
-       va_start(ap, fmt);
-       debug_extra = talloc_strdup_append(talloc_vasprintf(NULL, fmt, ap), ":");
-       va_end(ap);
-
-       /* get a new event context */
-       ctdb->ev = tevent_context_init(ctdb);
-       tevent_loop_allow_nesting(ctdb->ev);
-
-       /* Connect to main CTDB daemon */
-       ret = ctdb_socket_connect(ctdb);
-       if (ret != 0) {
-               DEBUG(DEBUG_ALERT, (__location__ " Failed to init ctdb client\n"));
-               return -1;
-       }
-
-       ctdb->can_send_controls = true;
-
-       return 0;
-}
-
 /*
   get the status of running the monitor eventscripts: NULL means never run.
  */
@@ -4709,7 +4650,8 @@ int ctdb_ctrl_disablescript(struct ctdb_context *ctdb, struct timeval timeout, u
 }
 
 
-int ctdb_ctrl_set_ban(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, struct ctdb_ban_time *bantime)
+int ctdb_ctrl_set_ban(struct ctdb_context *ctdb, struct timeval timeout,
+                     uint32_t destnode, struct ctdb_ban_state *bantime)
 {
        int ret;
        TDB_DATA data;
@@ -4730,7 +4672,9 @@ int ctdb_ctrl_set_ban(struct ctdb_context *ctdb, struct timeval timeout, uint32_
 }
 
 
-int ctdb_ctrl_get_ban(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, TALLOC_CTX *mem_ctx, struct ctdb_ban_time **bantime)
+int ctdb_ctrl_get_ban(struct ctdb_context *ctdb, struct timeval timeout,
+                     uint32_t destnode, TALLOC_CTX *mem_ctx,
+                     struct ctdb_ban_state **bantime)
 {
        int ret;
        TDB_DATA outdata;
@@ -4746,7 +4690,7 @@ int ctdb_ctrl_get_ban(struct ctdb_context *ctdb, struct timeval timeout, uint32_
                return -1;
        }
 
-       *bantime = (struct ctdb_ban_time *)talloc_steal(mem_ctx, outdata.dptr);
+       *bantime = (struct ctdb_ban_state *)talloc_steal(mem_ctx, outdata.dptr);
        talloc_free(tmp_ctx);
 
        return 0;