summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2009-06-01 16:41:43 -0500
committerDavid Teigland <teigland@redhat.com>2009-06-01 16:41:43 -0500
commite2abfa0ae1114805592853549ab812731e939910 (patch)
tree1f9d640f3a05727d288ffdd97b13962ac64e0248
parent21fc9c73dbeaff75cb4a9b629b6da4aade9a653c (diff)
downloaddct-stuff-e2abfa0ae1114805592853549ab812731e939910.tar.gz
dct-stuff-e2abfa0ae1114805592853549ab812731e939910.tar.xz
dct-stuff-e2abfa0ae1114805592853549ab812731e939910.zip
cpgx: new makefile
deal with lib64 and whitetank differences fix some warnings from -Wall Signed-off-by: David Teigland <teigland@redhat.com>
-rw-r--r--cpgx/Makefile29
-rw-r--r--cpgx/cpgx.c28
2 files changed, 50 insertions, 7 deletions
diff --git a/cpgx/Makefile b/cpgx/Makefile
index 54e3860..031e842 100644
--- a/cpgx/Makefile
+++ b/cpgx/Makefile
@@ -1,4 +1,29 @@
-cpgx: cpgx.c
- gcc -L/usr/lib64 cpgx.c -g -o cpgx -lcpg
+ARCHM=$(shell uname -m)
+
+CFLAGS := -Wall -g
+
+ifdef WHITETANK
+CFLAGS += -DWHITETANK
+ifeq (x86_64,$(ARCHM))
+LDFLAGS += -L/usr/lib64/openais
+else
+LDFLAGS := -L/usr/lib/openais
+endif
+endif
+
+all: cpgx
+
+cpgx: cpgx.o
+ gcc $(LDFLAGS) -o $@ $^ -lcpg
+
+cpgx.o: cpgx.c
+ gcc $(CFLAGS) -c -o $@ $<
+
+clean:
+ rm -f *.o cpgx
+
+install: all
+ install cpgx /usr/bin
+
diff --git a/cpgx/cpgx.c b/cpgx/cpgx.c
index 468df9a..baa9bea 100644
--- a/cpgx/cpgx.c
+++ b/cpgx/cpgx.c
@@ -36,7 +36,13 @@
#include <sys/time.h>
#include <sys/wait.h>
#include <sys/types.h>
+
+#ifdef WHITETANK
+#include <openais/cpg.h>
+#else
#include <corosync/cpg.h>
+#endif
+
#include "list.h"
#define CLIENT_NALLOC 2
@@ -1000,6 +1006,15 @@ static int nodeid_compare(const void *va, const void *vb)
return *a - *b;
}
+#ifdef WHITETANK
+static void confchg_cb(cpg_handle_t handle, struct cpg_name *group_name,
+ struct cpg_address *memb_list,
+ int memb_list_entries,
+ struct cpg_address *left_list,
+ int left_list_entries,
+ struct cpg_address *join_list,
+ int join_list_entries)
+#else
static void confchg_cb(cpg_handle_t handle, const struct cpg_name *group_name,
const struct cpg_address *memb_list,
size_t memb_list_entries,
@@ -1007,6 +1022,7 @@ static void confchg_cb(cpg_handle_t handle, const struct cpg_name *group_name,
size_t left_list_entries,
const struct cpg_address *join_list,
size_t join_list_entries)
+#endif
{
uint8_t memb_sort[8], left_sort[8], join_sort[8];
struct dct_config c;
@@ -1239,8 +1255,13 @@ static void process_message(struct dct_header *hd, int len)
};
}
+#ifdef WHITETANK
+static void deliver_cb(cpg_handle_t handle, struct cpg_name *group_name,
+ uint32_t nodeid, uint32_t pid, void *data, int len)
+#else
static void deliver_cb(cpg_handle_t handle, const struct cpg_name *group_name,
uint32_t nodeid, uint32_t pid, void *data, size_t len)
+#endif
{
struct dct_header *hd = data;
@@ -1248,7 +1269,7 @@ static void deliver_cb(cpg_handle_t handle, const struct cpg_name *group_name,
gettimeofday(&last_dispatch, NULL);
if (len < sizeof(struct dct_header)) {
- log_error("deliver short message %d", len);
+ log_error("deliver short message %u", (unsigned int)len);
log_header(hd, 1);
return;
}
@@ -1303,7 +1324,6 @@ int do_join(void)
cpg_error_t error;
cpg_handle_t h;
int i = 0, fd, ci;
- int unused;
uint32_t nodeid;
sprintf(dct_cpg_name.value, "dct_cpg");
@@ -1513,7 +1533,7 @@ void loop(void)
gettimeofday(&now, NULL);
ms = time_diff_ms(&last_dispatch, &now);
if (ms > 20000)
- log_error("no cpg dispatch in %ul ms", ms);
+ log_error("no cpg dispatch in %lu ms", ms);
if (got_error) {
fflush(stdout);
@@ -1570,8 +1590,6 @@ void loop(void)
exit(2);
}
}
- out:
- return;
}
void print_usage(void)