[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] Cluster Project branch, master, updated. gfs-kernel_0_1_22-91-gf61b789



This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Cluster Project".

http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=f61b7891dfeab418bd1a20a12f084e848df335fc

The branch, master has been updated
       via  f61b7891dfeab418bd1a20a12f084e848df335fc (commit)
      from  3a0c7d3e8b81ca339fbab9fb8d17f76991b1e358 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit f61b7891dfeab418bd1a20a12f084e848df335fc
Author: Fabio M. Di Nitto <fabbione fabbione net>
Date:   Fri Mar 21 05:05:43 2008 +0100

    [CMAN] Drop dependency on libdevmapper
    
    Signed-off-by: Fabio M. Di Nitto <fabbione fabbione net>

-----------------------------------------------------------------------

Summary of changes:
 cman/qdisk/Makefile   |    8 +-----
 cman/qdisk/scandisk.c |   54 +++++++++++++++++++++++++++++++++++++++----------
 2 files changed, 45 insertions(+), 17 deletions(-)

diff --git a/cman/qdisk/Makefile b/cman/qdisk/Makefile
index e587941..4d3634d 100644
--- a/cman/qdisk/Makefile
+++ b/cman/qdisk/Makefile
@@ -30,10 +30,7 @@ CFLAGS += -I$(S)
 CFLAGS += -I${incdir}
 
 EXTRA_LDFLAGS += -L${cmanlibdir} -L${ccslibdir} -lcman -lccs
-#
-# XXX Fabio has a way to clean up the devmapper requirement
-#
-EXTRA_LDFLAGS += -lpthread -ldevmapper
+EXTRA_LDFLAGS += -lpthread
 
 OBJS1=	main.o \
 	score.o \
@@ -54,9 +51,8 @@ SHAREDOBJS= disk.o \
 ${TARGET1}: ${SHAREDOBJS} ${OBJS1}
 	$(CC) -o $@ $^ $(LDFLAGS) $(EXTRA_LDFLAGS)
 
-# XXX Remove $(EXTRA_LDFLAGS) when libdevmapper is no longer required
 ${TARGET2}: ${SHAREDOBJS} ${OBJS2}
-	$(CC) -o $@ $^ $(LDFLAGS) $(EXTRA_LDFLAGS)
+	$(CC) -o $@ $^ $(LDFLAGS)
 
 depends:
 	$(MAKE) -C ../lib all
diff --git a/cman/qdisk/scandisk.c b/cman/qdisk/scandisk.c
index b0bd8a6..f4f7e0d 100644
--- a/cman/qdisk/scandisk.c
+++ b/cman/qdisk/scandisk.c
@@ -19,7 +19,6 @@
 #include <dirent.h>
 #include <sys/sysmacros.h>
 #include <sys/stat.h>
-#include <libdevmapper.h>
 
 #include "scandisk.h"
 
@@ -393,25 +392,58 @@ static int scanmdstat(struct devlisthead *devlisthead)
 	return 1;
 }
 
-/* TODO: add more stuff from devmapper to understand if a maj/min
- * 	 is a slave or a holder. If we have sysfs this is of no use.
- */
-
-/* scanmapper uses libdevmapper to identify devices that are not real
+/* scanmapper parses /proc/devices to identify what maj are associated
+ * with device-mapper
  *
  * ret:
  * can't fail for now
  */
 static int scanmapper(struct devlisthead *devlisthead)
 {
-	struct devnode *startnode = devlisthead->devnode;
+	struct devnode *startnode;
+	FILE *fp;
+	char line[4096];
+	char major[4];
+	char device[64];
+	int maj, start = 0;
+
+	fp = fopen("/proc/devices", "r");
+	if (!fp)
+		return 0;
+
+	while (fgets(line, sizeof(line), fp) != NULL) {
+		memset(major, 0, 4);
+		memset(device, 0, 64);
+
+		if (strlen(line) > 4096)
+			continue;
+
+		if (!strncmp(line, "Block devices:", 13)) {
+			start = 1;
+			continue;
+		}
+
+		if (!start)
+			continue;
+
+		sscanf(line, "%s %s", major, device);
+
+		if (!strncmp(device, "device-mapper", 13)) {
+			maj = atoi(major);
+			startnode = devlisthead->devnode;
+
+			while (startnode) {
+				if (startnode->maj == maj)
+					startnode->mapper = 1;
+
+				startnode = startnode->next;
+			}
+
+		}
 
-	while (startnode) {
-		if (dm_is_dm_major(startnode->maj) > 0)
-			startnode->mapper = 1;
-		startnode = startnode->next;
 	}
 
+	fclose(fp);
 	return 1;
 }
 


hooks/post-receive
--
Cluster Project


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]