rename ctdb.h to ctdb_protocol.h
[sahlberg/ctdb.git] / server / ctdb_serverids.c
index ca9be264af94f4efdfbdd0b45af5cf35a5e7e1a4..1888c4e3a6e6462d0cdac7a3fc7a696af3d7cb3c 100644 (file)
@@ -17,8 +17,9 @@
    along with this program; if not, see <http://www.gnu.org/licenses/>.
 */
 #include "includes.h"
-#include "../include/ctdb_private.h"
-#include "../common/rb_tree.h"
+#include "include/ctdb_protocol.h"
+#include "include/ctdb_private.h"
+#include "common/rb_tree.h"
 
 
 #define SERVER_ID_KEY_SIZE 3
@@ -62,7 +63,7 @@ int32_t ctdb_control_register_server_id(struct ctdb_context *ctdb,
 
 
        if (client == NULL) {
-               DEBUG(0,(__location__ " Could not find client parent structure. You can not send this control to a remote node\n"));
+               DEBUG(DEBUG_ERR,(__location__ " Could not find client parent structure. You can not send this control to a remote node\n"));
                return 1;
        }
 
@@ -92,9 +93,9 @@ int32_t ctdb_control_check_server_id(struct ctdb_context *ctdb,
 {
        struct ctdb_server_id *server_id = (struct ctdb_server_id *)indata.dptr;
 
-       return (int32_t)trbt_lookuparray32(ctdb->server_ids, 
-                               SERVER_ID_KEY_SIZE,
-                               get_server_id_key(server_id));
+       return trbt_lookuparray32(ctdb->server_ids, 
+                                 SERVER_ID_KEY_SIZE,
+                                 get_server_id_key(server_id)) == NULL? 0 : 1;
 }
 
 /*
@@ -125,7 +126,7 @@ static void server_id_count(void *param, void *data)
                                                struct count_server_ids);
 
        if (svid == NULL) {
-               DEBUG(0, (__location__ " Got null pointer for svid\n"));
+               DEBUG(DEBUG_ERR, (__location__ " Got null pointer for svid\n"));
                return;
        }
 
@@ -140,12 +141,12 @@ static void server_id_store(void *param, void *data)
                                                struct ctdb_server_id);
 
        if (svid == NULL) {
-               DEBUG(0, (__location__ " Got null pointer for svid\n"));
+               DEBUG(DEBUG_ERR, (__location__ " Got null pointer for svid\n"));
                return;
        }
 
        if (svid->count >= svid->list->num) {
-               DEBUG(0, (__location__ " size of server id tree changed during traverse\n"));
+               DEBUG(DEBUG_ERR, (__location__ " size of server id tree changed during traverse\n"));
                return;
        }