Skip to contentSkip to conversation

cmirrord cleanup

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

lore
Share & tools
lore
#0 lore raw

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

The only bit I am not very pleased is the new requirement on pkg-config. This is required to retain the current configure.in format where checks for features are mixed with checks for libraries required to build that feature. It makes more difficult to share common bits in favour of better readability.

Please review.

Thanks
Fabio

#1 lore raw

PATCH 1/3 cmirror: cleanup build

configure.in:
- Check for pkg-config unconditionally since it?s shared by more than one subsystem.
- 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... 2569490... M configure.in
:100644 100644 ce13d02... add4d55... M daemons/cmirrord/Makefile.in

 configure.in                 |   30 ++++++++++++++----------------
 daemons/cmirrord/Makefile.in |   12 +++++++++---
 2 files changed, 23 insertions(+), 19 deletions(-)
configure.in +14 -16
index cc461cf..2569490 100644
@@ -322,6 +322,14 @@ 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_CHECK_MODULES(PKGCONFIGINIT, pkgconfiginit, [],
+	[AC_MSG_RESULT([pkg-config initialized])])
+
+################################################################################
 dnl -- Build cluster LVM daemon
 AC_MSG_CHECKING(whether to build cluster LVM daemon)
 AC_ARG_WITH(clvmd,
@@ -367,15 +375,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 +573,10 @@ 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"])
+	PKG_CHECK_MODULES(SACKPT, libSaCkpt)
+	if test x$HAVE_CPG != xyes; then
+		PKG_CHECK_MODULES(CPG, libcpg)
+	fi
 fi
 
 ################################################################################
@@ -1087,6 +1083,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