Skip to contentSkip to conversation

LVM2 libdm/libdevmapper.h libdm/libdm-common.c ...

PATCH [email protected] 1 participant 1 message Aug 6, 2009

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: prajnoha at sourceware.org 2009-08-06 15:04:30

Modified files:
libdm : libdevmapper.h libdm-common.c
tools : dmsetup.c

Log message:
Add 'udevcomplete_all' command for dmsetup. Export DM_COOKIE_MAGIC in libdevmapper.h.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdevmapper.h.diff?cvsroot=lvm2&r1=1.95&r2=1.96
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdm-common.c.diff?cvsroot=lvm2&r1=1.75&r2=1.76
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/dmsetup.c.diff?cvsroot=lvm2&r1=1.120&r2=1.121

libdm/libdevmapper.h +2 -0
@@ -1014,6 +1014,8 @@
 void dm_report_field_set_value(struct dm_report_field *field, const void *value,
 			       const void *sortvalue);
 
+#define DM_COOKIE_MAGIC 0x0D4D
+
 int dm_cookie_supported(void);
 
 /*
libdm/libdm-common.c +5 -3
@@ -39,7 +39,6 @@
 #endif
 
 #define DEV_DIR "/dev/"
-#define COOKIE_MAGIC 0x0D4D
 
 static char _dm_dir[PATH_MAX] = DEV_DIR DM_DIR;
 
@@ -837,7 +836,7 @@
 
 static int _get_cookie_sem(uint32_t cookie, int *semid)
 {
-	if (!(cookie >> 16 & COOKIE_MAGIC)) {
+	if (cookie >> 16 != DM_COOKIE_MAGIC) {
 		log_error("Could not continue to access notification "
 			  "semaphore identified by cookie value %"
 			  PRIu32 " (0x%x). Incorrect cookie prefix.",
@@ -952,7 +951,7 @@
 			goto bad;
 		}
 
-		gen_cookie = COOKIE_MAGIC << 16 | base_cookie;
+		gen_cookie = DM_COOKIE_MAGIC << 16 | base_cookie;
 
 		if (base_cookie && (gen_semid = semget((key_t) gen_cookie,
 				    1, 0600 | IPC_CREAT | IPC_EXCL)) < 0) {
@@ -1093,6 +1092,9 @@
 	if (semop(semid, &sb, 1) < 0) {
 		if (errno == EINTR)
 			goto repeat_wait;
+		else if (errno == EIDRM)
+			return 1;
+
 		log_error("Could not set wait state for notification semaphore "
 			  "identified by cookie value %" PRIu32 " (0x%x): %s",
 			  cookie, cookie, strerror(errno));
tools/dmsetup.c +91 -0

115 lines not on this page · raw message