ctdb-daemon: Remove struct ctdb_client_notify_deregister
authorAmitay Isaacs <amitay@gmail.com>
Wed, 28 Oct 2015 06:47:03 +0000 (17:47 +1100)
committerMartin Schwenke <martins@samba.org>
Tue, 3 Nov 2015 23:47:15 +0000 (00:47 +0100)
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
ctdb/include/ctdb_protocol.h
ctdb/server/ctdb_control.c
ctdb/server/ctdb_daemon.c
source3/lib/ctdbd_conn.c

index 030c114d6f1f0eddbf3bd1ee4e66c37acea29a1d..c9f0a9d86a1e367a4eb4de1a801095529c523b0b 100644 (file)
@@ -765,10 +765,6 @@ struct ctdb_notify_data_old {
        uint8_t notify_data[1];
 };
 
-struct ctdb_client_notify_deregister {
-       uint64_t srvid;
-};
-
 /* table that contains a list of all dbids on a node
  */
 struct ctdb_dbid_map {
index b86e02e326f531c7e14094337332f9c0e481981d..3cdf4ef28b4b1d71b34caa4b4eebea57ef1d53cb 100644 (file)
@@ -634,7 +634,7 @@ static int32_t ctdb_control_dispatch(struct ctdb_context *ctdb,
                return ctdb_control_register_notify(ctdb, client_id, indata);
 
        case CTDB_CONTROL_DEREGISTER_NOTIFY:
-               CHECK_CONTROL_DATA_SIZE(sizeof(struct ctdb_client_notify_deregister));
+               CHECK_CONTROL_DATA_SIZE(sizeof(uint64_t));
                return ctdb_control_deregister_notify(ctdb, client_id, indata);
 
        case CTDB_CONTROL_GET_LOG:
index 02607ffb5f0a6c0be34671209520573f76d3d080..7d2c186a0f77ea7d67d43629549c6160107cfa4b 100644 (file)
@@ -1720,11 +1720,11 @@ int32_t ctdb_control_register_notify(struct ctdb_context *ctdb, uint32_t client_
 
 int32_t ctdb_control_deregister_notify(struct ctdb_context *ctdb, uint32_t client_id, TDB_DATA indata)
 {
-       struct ctdb_client_notify_deregister *notify = (struct ctdb_client_notify_deregister *)indata.dptr;
+       uint64_t srvid = *(uint64_t *)indata.dptr;
         struct ctdb_client *client = reqid_find(ctdb->idr, client_id, struct ctdb_client);
        struct ctdb_client_notify_list *nl;
 
-       DEBUG(DEBUG_INFO,("Deregister srvid %llu for client %d\n", (unsigned long long)notify->srvid, client_id));
+       DEBUG(DEBUG_INFO,("Deregister srvid %llu for client %d\n", (unsigned long long)srvid, client_id));
 
         if (client == NULL) {
                 DEBUG(DEBUG_ERR,(__location__ " Could not find client parent structure. You can not send this control to a remote node\n"));
@@ -1732,12 +1732,12 @@ int32_t ctdb_control_deregister_notify(struct ctdb_context *ctdb, uint32_t clien
         }
 
        for(nl=client->notify; nl; nl=nl->next) {
-               if (nl->srvid == notify->srvid) {
+               if (nl->srvid == srvid) {
                        break;
                }
        }
        if (nl == NULL) {
-                DEBUG(DEBUG_ERR,(__location__ " No notification for srvid:%llu found for this client\n", (unsigned long long)notify->srvid));
+                DEBUG(DEBUG_ERR,(__location__ " No notification for srvid:%llu found for this client\n", (unsigned long long)srvid));
                 return -1;
         }
 
index e67a31d5bc6becce12a345abf3af56b89614b970..92858fce72590b18b75c87b50d23ca9545b40388 100644 (file)
@@ -1276,15 +1276,13 @@ int ctdb_watch_us(struct ctdbd_connection *conn)
 
 int ctdb_unwatch(struct ctdbd_connection *conn)
 {
-       struct ctdb_client_notify_deregister dereg_data;
+       uint64_t srvid = CTDB_SRVID_SAMBA_NOTIFY;
        int ret;
        int cstatus;
 
-       dereg_data.srvid = CTDB_SRVID_SAMBA_NOTIFY;
-
        ret = ctdbd_control_local(
                conn, CTDB_CONTROL_DEREGISTER_NOTIFY, conn->rand_srvid, 0,
-               make_tdb_data((uint8_t *)&dereg_data, sizeof(dereg_data)),
+               make_tdb_data((uint8_t *)&srvid, sizeof(srvid)),
                NULL, NULL, &cstatus);
        if (ret != 0) {
                DEBUG(1, ("ctdbd_control_local failed: %s\n",