move ctdb_call_recv to libctdb
authorRonnie Sahlberg <ronniesahlberg@gmail.com>
Mon, 17 May 2010 05:55:40 +0000 (15:55 +1000)
committerRonnie Sahlberg <ronniesahlberg@gmail.com>
Mon, 17 May 2010 05:55:40 +0000 (15:55 +1000)
client/ctdb_client.c
libctdb/ctdb_client.c

index 56d8b5a729e746b77bbdcc4726d621bf8bce593f..fd34de6b83644c8b26aee6663da7b0b758ff239f 100644 (file)
@@ -41,41 +41,6 @@ struct ctdb_record_handle {
 };
 
 
-/*
-  make a recv call to the local ctdb daemon - called from client context
-
-  This is called when the program wants to wait for a ctdb_call to complete and get the 
-  results. This call will block unless the call has already completed.
-*/
-int ctdb_call_recv(struct ctdb_client_call_state *state, struct ctdb_call *call)
-{
-       if (state == NULL) {
-               return -1;
-       }
-
-       while (state->state < CTDB_CALL_DONE) {
-               event_loop_once(state->ctdb_db->ctdb->ev);
-       }
-       if (state->state != CTDB_CALL_DONE) {
-               DEBUG(DEBUG_ERR,(__location__ " ctdb_call_recv failed\n"));
-               talloc_free(state);
-               return -1;
-       }
-
-       if (state->call->reply_data.dsize) {
-               call->reply_data.dptr = talloc_memdup(state->ctdb_db,
-                                                     state->call->reply_data.dptr,
-                                                     state->call->reply_data.dsize);
-               call->reply_data.dsize = state->call->reply_data.dsize;
-       } else {
-               call->reply_data.dptr = NULL;
-               call->reply_data.dsize = 0;
-       }
-       call->status = state->call->status;
-       talloc_free(state);
-
-       return 0;
-}
 
 
 
index 864877ce5af73677da4549a69f22a28991a7a687..a0841b5c0e567a82be652565367b3b2073b27933 100644 (file)
@@ -624,6 +624,42 @@ struct ctdb_client_call_state *ctdb_call_send(struct ctdb_db_context *ctdb_db,
        return state;
 }
 
+/*
+  make a recv call to the local ctdb daemon - called from client context
+
+  This is called when the program wants to wait for a ctdb_call to complete and get the 
+  results. This call will block unless the call has already completed.
+*/
+int ctdb_call_recv(struct ctdb_client_call_state *state, struct ctdb_call *call)
+{
+       if (state == NULL) {
+               return -1;
+       }
+
+       while (state->state < CTDB_CALL_DONE) {
+               event_loop_once(state->ctdb_db->ctdb->ev);
+       }
+       if (state->state != CTDB_CALL_DONE) {
+               DEBUG(DEBUG_ERR,(__location__ " ctdb_call_recv failed\n"));
+               talloc_free(state);
+               return -1;
+       }
+
+       if (state->call->reply_data.dsize) {
+               call->reply_data.dptr = talloc_memdup(state->ctdb_db,
+                                                     state->call->reply_data.dptr,
+                                                     state->call->reply_data.dsize);
+               call->reply_data.dsize = state->call->reply_data.dsize;
+       } else {
+               call->reply_data.dptr = NULL;
+               call->reply_data.dsize = 0;
+       }
+       call->status = state->call->status;
+       talloc_free(state);
+
+       return 0;
+}
+
 /*
   send a message - from client context
  */