Skip to contentSkip to conversation

cmirrord cleanup (take two)

PATCH New Fabio M. Di Nitto 1 participant 4 messages Sep 11, 2009

lore
Share & tools
lore
#0 lore raw

This patchset makes cmirrord build again and merge the configure checks with clvmd.

This second set avoids the hard requirement on pkg-config.

#1 lore raw

PATCH 1/3 cmirror: cleanup build

configure.in:
- Move pkg-config init check into a standalone function.
- Share pkg_config_init between clvmd and cmirror build.
- Enable pkg-config check for libSaCkpt.
- Check for libcpg only if it hasn?t been done before.
- Propagate vars consistently.

daemons/cmirrord/Makefile.in:
- Propagate vars consistently.
- Drop CFLAGS from linking.

---
:100644 100644 cc461cf... d0ab503... M configure.in
:100644 100644 ce13d02... add4d55... M daemons/cmirrord/Makefile.in

 configure.in                 |   43 ++++++++++++++++++++++++++---------------
 daemons/cmirrord/Makefile.in |   12 ++++++++--
 2 files changed, 36 insertions(+), 19 deletions(-)
configure.in +27 -16
index cc461cf..d0ab503 100644
@@ -322,6 +322,17 @@ REALTIME=$enableval)
 AC_MSG_RESULT($REALTIME)
 
 ################################################################################
+dnl -- Init pkg-config with dummy invokation:
+dnl -- this is required because PKG_CHECK_MODULES macro is expanded
+dnl -- to initialize the pkg-config environment only at the first invokation,
+dnl -- that would be conditional in this configure.in.
+pkg_config_init() {
+	PKG_CHECK_MODULES(PKGCONFIGINIT, pkgconfiginit, [],
+		[AC_MSG_RESULT([pkg-config initialized])])
+	PKGCONFIG_INIT=1
+}
+
+################################################################################
 dnl -- Build cluster LVM daemon
 AC_MSG_CHECKING(whether to build cluster LVM daemon)
 AC_ARG_WITH(clvmd,
@@ -345,6 +356,12 @@ if  test x$CLVMD != xnone && test x$CLUSTER = xnone; then
 	CLUSTER=internal
 fi
 
+dnl -- init pkgconfig if required
+if  test x$CLVMD != xnone && test x$PKGCONFIG_INIT != x1; then
+	pkg_config_init
+fi
+
+
 dnl -- define build types
 if [[ `expr x"$CLVMD" : '.*gulm.*'` != 0 ]]; then
 	BUILDGULM=yes
@@ -367,15 +384,6 @@ if test x$BUILDGULM = xyes; then
 	fi
 fi
 
-dnl -- Init pkg-config with dummy invokation:
-dnl -- this is required because PKG_CHECK_MODULES macro is expanded
-dnl -- to initialize the pkg-config environment only at the first invokation,
-dnl -- that would be conditional in this configure.in.
-if  test x$CLVMD != xnone; then
-	PKG_CHECK_MODULES(PKGCONFIGINIT, pkgconfiginit, [],
-		[AC_MSG_RESULT([pkg-config initialized])])
-fi
-
 dnl -- define a soft bailout if we are autodetecting
 soft_bailout() {
 	NOTFOUND=1
@@ -574,13 +582,14 @@ fi
 ################################################################################
 dnl -- Look for corosync libraries if required.
 if [[ "x$BUILD_CMIRRORD" = xyes ]]; then
-#
-#       FIXME: ALSO NEED TO CHECK FOR CHECKPOINT MODULE
-#       FIXME: Merge this with the new clvmd logic
-#
-	PKG_CHECK_MODULES(CPG, libcpg, [],
-		[AC_MSG_RESULT([no pkg for libcpg library, using -lcpg]);
-		CPG_LIBS="-lcpg"])
+	dnl -- init pkgconfig if required
+	if  test x$PKGCONFIG_INIT != x1; then
+		pkg_config_init
+	fi
+	PKG_CHECK_MODULES(SACKPT, libSaCkpt)
+	if test x$HAVE_CPG != xyes; then
+		PKG_CHECK_MODULES(CPG, libcpg)
+	fi
 fi
 
 ################################################################################
@@ -1087,6 +1096,8 @@ AC_SUBST(PKGCONFIG)
 AC_SUBST(POOL)
 AC_SUBST(QUORUM_CFLAGS)
 AC_SUBST(QUORUM_LIBS)
+AC_SUBST(SACKPT_CFLAGS)
+AC_SUBST(SACKPT_LIBS)
 AC_SUBST(SALCK_CFLAGS)
 AC_SUBST(SALCK_LIBS)
 AC_SUBST(SNAPSHOTS)
daemons/cmirrord/Makefile.in +9 -3
index ce13d02..add4d55 100644
@@ -15,17 +15,23 @@ srcdir = @srcdir@
 top_srcdir = @top_srcdir@
 VPATH = @srcdir@
 
+CPG_LIBS = @CPG_LIBS@
+CPG_CFLAGS = @CPG_CFLAGS@
+SACKPT_LIBS = @SACKPT_LIBS@
+SACKPT_CFLAGS = @SACKPT_CFLAGS@
+
 SOURCES = clogd.c cluster.c functions.c link_mon.c local.c logging.c
 
 TARGETS = cmirrord
 
 include $(top_srcdir)/make.tmpl
 
-LDFLAGS += -L$(usrlibdir)/openais
-LIBS += -lcpg -lSaCkpt -ldevmapper
+LIBS += -ldevmapper
+LMLIBS += $(CPG_LIBS) $(SACKPT_LIBS)
+CFLAGS += $(CPG_CFLAGS) $(SACKPT_CFLAGS)
 
 cmirrord: $(OBJECTS) $(top_srcdir)/lib/liblvm-internal.a
-	$(CC) -o cmirrord $(OBJECTS) $(CFLAGS) $(LDFLAGS) \
+	$(CC) -o cmirrord $(OBJECTS) $(LDFLAGS) \
 		$(LVMLIBS) $(LMLIBS) $(LIBS)
 
 install: $(TARGETS)
Signature · 1 line
1.5.4.3
#2 lore raw

PATCH 2/3 cmirror: add missing include

In reply to Fabio M. Di Nitto

otherwise the build fails because the pid file is not defined.

---
:100644 100644 bfb74fa... d277803... M daemons/cmirrord/clogd.c

 daemons/cmirrord/clogd.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
daemons/cmirrord/clogd.c +3 -0
index bfb74fa..d277803 100644
@@ -9,6 +9,9 @@
  * along with this program; if not, write to the Free Software Foundation,
  * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
+
+#include "configure.h"
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdint.h>
Signature · 1 line
1.5.4.3
#3 lore raw

PATCH 3/3 cmirror: port to corosync/cpg api

In reply to Fabio M. Di Nitto

---
:100644 100644 0cfe5a9... 27d6262... M daemons/cmirrord/cluster.c

 daemons/cmirrord/cluster.c |   33 +++++++++++++++++----------------
 1 files changed, 17 insertions(+), 16 deletions(-)
daemons/cmirrord/cluster.c +17 -16
index 0cfe5a9..27d6262 100644
@@ -21,8 +21,9 @@
 #include <sys/un.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
+#include <corosync/corotypes.h>
+#include <corosync/cpg.h>
 #include <openais/saAis.h>
-#include <openais/cpg.h>
 #include <openais/saCkpt.h>
 
 #include "dm-log-userspace.h"
@@ -932,9 +933,9 @@ static int flush_startup_list(struct clog_cpg *entry)
 	return 0;
 }
 
-static void cpg_message_callback(cpg_handle_t handle, struct cpg_name *gname,
+static void cpg_message_callback(cpg_handle_t handle, const struct cpg_name *gname,
 				 uint32_t nodeid, uint32_t pid,
-				 void *msg, int msg_len)
+				 void *msg, size_t msg_len)
 {
 	int i;
 	int r = 0;
@@ -1154,9 +1155,9 @@ out:
 }
 
 static void cpg_join_callback(struct clog_cpg *match,
-			      struct cpg_address *joined,
-			      struct cpg_address *member_list,
-			      int member_list_entries)
+			      const struct cpg_address *joined,
+			      const struct cpg_address *member_list,
+			      size_t member_list_entries)
 {
 	int i;
 	int my_pid = getpid();
@@ -1233,9 +1234,9 @@ out:
 }
 
 static void cpg_leave_callback(struct clog_cpg *match,
-			       struct cpg_address *left,
-			       struct cpg_address *member_list,
-			       int member_list_entries)
+			       const struct cpg_address *left,
+			       const struct cpg_address *member_list,
+			       size_t member_list_entries)
 {
 	int i, j, fd;
 	uint32_t lowest = match->lowest_id;
@@ -1366,13 +1367,13 @@ static void cpg_leave_callback(struct clog_cpg *match,
 	}
 }
 
-static void cpg_config_callback(cpg_handle_t handle, struct cpg_name *gname,
-				struct cpg_address *member_list,
-				int member_list_entries,
-				struct cpg_address *left_list,
-				int left_list_entries,
-				struct cpg_address *joined_list,
-				int joined_list_entries)
+static void cpg_config_callback(cpg_handle_t handle, const struct cpg_name *gname,
+				const struct cpg_address *member_list,
+				size_t member_list_entries,
+				const struct cpg_address *left_list,
+				size_t left_list_entries,
+				const struct cpg_address *joined_list,
+				size_t joined_list_entries)
 {
 	struct clog_cpg *match;
 	int found = 0;
Signature · 1 line
1.5.4.3