Change the ctdb_getpnn*() functions to take a destination node parameter so we can...
authorRonnie Sahlberg <ronniesahlberg@gmail.com>
Thu, 13 May 2010 02:00:22 +0000 (12:00 +1000)
committerRonnie Sahlberg <ronniesahlberg@gmail.com>
Thu, 13 May 2010 02:00:22 +0000 (12:00 +1000)
move the special addresses like CTDB_CURRENT_NODE from ctdb_protocol.h to ctdb.h

include/ctdb.h
include/ctdb_protocol.h
libctdb/libctdb.c
libctdb/tst.c

index 03f2e2641884ae971108a2e575e5aa029fe15f8d..b074876179dce50aa19e83b0b231232d45f7035a 100644 (file)
@@ -42,6 +42,21 @@ int ctdb_which_events(struct ctdb_context *ctdb);
 int ctdb_service(struct ctdb_context *ctdb);
 
 
+/*
+ * Special node addresses :
+ */
+/* used on the domain socket, send a pdu to the local daemon */
+#define CTDB_CURRENT_NODE     0xF0000001
+/* send a broadcast to all nodes in the cluster, active or not */
+#define CTDB_BROADCAST_ALL    0xF0000002
+/* send a broadcast to all nodes in the current vnn map */
+#define CTDB_BROADCAST_VNNMAP 0xF0000003
+/* send a broadcast to all connected nodes */
+#define CTDB_BROADCAST_CONNECTED 0xF0000004
+
+
+
+
 
 typedef void ctdb_handle;
 
@@ -103,12 +118,14 @@ typedef void (*ctdb_getpnn_cb)(int32_t status, int32_t pnn, void *private_data);
 
 ctdb_handle *
 ctdb_getpnn_send(struct ctdb_context *ctdb,
+                uint32_t destnode,
                 ctdb_getpnn_cb callback,
                 void *private_data);
 int ctdb_getpnn_recv(struct ctdb_context *ctdb,
                     ctdb_handle *handle,
                     uint32_t *pnn);
 int ctdb_getpnn(struct ctdb_context *ctdb,
+               uint32_t destnode,
                uint32_t *pnn);
 
 
index e1d2e4e5cd5b4057ab7c9c20a4c392cb38ec39ed..22ea63d5de9eaca13f975c22d072206552069ab6 100644 (file)
@@ -121,14 +121,6 @@ struct ctdb_call_info {
  */
 #define CTDB_SRVID_SAMBA_NOTIFY  0xFE00000000000000LL
 
-/* used on the domain socket, send a pdu to the local daemon */
-#define CTDB_CURRENT_NODE     0xF0000001
-/* send a broadcast to all nodes in the cluster, active or not */
-#define CTDB_BROADCAST_ALL    0xF0000002
-/* send a broadcast to all nodes in the current vnn map */
-#define CTDB_BROADCAST_VNNMAP 0xF0000003
-/* send a broadcast to all connected nodes */
-#define CTDB_BROADCAST_CONNECTED 0xF0000004
 
 /* the key used for transaction locking on persistent databases */
 #define CTDB_TRANSACTION_LOCK_KEY "__transaction_lock__"
index 73bbb9f3668ef704cf227a7ed723301cda087509..19ec8cea427dcd35961c7a1824bfc15ee16b1a38 100644 (file)
@@ -162,13 +162,14 @@ ctdb_getpnn_recv_cb(struct ctdb_client_control_state *state)
 
 ctdb_handle *
 ctdb_getpnn_send(struct ctdb_context *ctdb,
+                       uint32_t destnode,
                        ctdb_getpnn_cb callback,
                        void *private_data)
 {
        struct ctdb_client_control_state *state;
        struct ctdb_control_cb_data *cb_data;
 
-       state = ctdb_control_send(ctdb, CTDB_CURRENT_NODE, 0, 
+       state = ctdb_control_send(ctdb, destnode, 0, 
                           CTDB_CONTROL_GET_PNN, 0, tdb_null, 
                           ctdb, NULL);
 
@@ -208,11 +209,11 @@ int ctdb_getpnn_recv(struct ctdb_context *ctdb, ctdb_handle *handle, uint32_t *p
        return state->status;
 }
 
-int ctdb_getpnn(struct ctdb_context *ctdb, uint32_t *pnn)
+int ctdb_getpnn(struct ctdb_context *ctdb, uint32_t destnode, uint32_t *pnn)
 {
        struct ctdb_client_control_state *state;
        
-       state = ctdb_getpnn_send(ctdb, NULL, NULL);
+       state = ctdb_getpnn_send(ctdb, destnode, NULL, NULL);
        if (state == NULL) {
                DEBUG(DEBUG_ERR,(__location__ " ctdb_getpnn_send() failed.\n"));
                return -1;
index e47a0eceeeaa7d8f6d00ea3fcd89679dc86c3c95..17d7f6e09ec293dbb4475e7effe3e989dff64b85 100644 (file)
@@ -54,13 +54,13 @@ int main(int argc, char *argv[])
                exit(10);
        }
 
-       handle = ctdb_getpnn_send(ctdb_context, pnn_cb, NULL);
+       handle = ctdb_getpnn_send(ctdb_context, CTDB_CURRENT_NODE, pnn_cb, NULL);
        if (handle == NULL) {
                printf("Failed to send get_pnn control\n");
                exit(10);
        }
 
-       handle = ctdb_getrecmaster_send(ctdb_context, 0, rm_cb, NULL);
+       handle = ctdb_getrecmaster_send(ctdb_context, CTDB_CURRENT_NODE, rm_cb, NULL);
        if (handle == NULL) {
                printf("Failed to send get_recmaster control\n");
                exit(10);