public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
* LVM2 daemons/clvmd/clvmd-command.c daemons/clv ...
@ 2008-05-09 19:26 agk
  0 siblings, 0 replies; 4+ messages in thread
From: agk @ 2008-05-09 19:26 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2008-05-09 19:26:58

Modified files:
	daemons/clvmd  : clvmd-command.c lvm-functions.c 
	lib/locking    : file_locking.c locking.h 

Log message:
	more cleanup

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/clvmd-command.c.diff?cvsroot=lvm2&r1=1.23&r2=1.24
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/lvm-functions.c.diff?cvsroot=lvm2&r1=1.41&r2=1.42
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/file_locking.c.diff?cvsroot=lvm2&r1=1.38&r2=1.39
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/locking.h.diff?cvsroot=lvm2&r1=1.40&r2=1.41

--- LVM2/daemons/clvmd/clvmd-command.c	2008/05/09 18:45:14	1.23
+++ LVM2/daemons/clvmd/clvmd-command.c	2008/05/09 19:26:58	1.24
@@ -119,7 +119,7 @@
 		/* Check to see if the VG is in use by LVM1 */
 		status = do_check_lvm1(lockname);
 		/* P_#global causes a full cache refresh */
-		if (!strcmp(lockname, "P_#global"))
+		if (!strcmp(lockname, "P_" VG_GLOBAL))
 			do_refresh_cache();
 		else
 			drop_metadata(lockname + 2);
--- LVM2/daemons/clvmd/lvm-functions.c	2008/05/09 18:45:14	1.41
+++ LVM2/daemons/clvmd/lvm-functions.c	2008/05/09 19:26:58	1.42
@@ -472,8 +472,8 @@
 	    popen
 	    ("lvm pvs  --config 'log{command_names=0 prefix=\"\"}' --nolocking --noheadings -o vg_name", "r");
 
-	sync_unlock("P_#orphans", LCK_EXCL);
-	sync_unlock("P_#global", LCK_EXCL);
+	sync_unlock("P_" VG_ORPHANS, LCK_EXCL);
+	sync_unlock("P_" VG_GLOBAL, LCK_EXCL);
 
 	if (!vgs)
 		return;
--- LVM2/lib/locking/file_locking.c	2008/05/09 18:45:15	1.38
+++ LVM2/lib/locking/file_locking.c	2008/05/09 19:26:58	1.39
@@ -210,10 +210,14 @@
 
 	switch (flags & LCK_SCOPE_MASK) {
 	case LCK_VG:
-		if (flags & LCK_CACHE) {
+		/* Skip cache refresh for VG_GLOBAL - the caller handles it */
+		if (strcmp(resource, VG_GLOBAL))
 			lvmcache_drop_metadata(resource);
+
+		/* LCK_CACHE does not require a real lock */
+		if (flags & LCK_CACHE)
 			break;
-		}
+
 		if (*resource == '#')
 			dm_snprintf(lockfile, sizeof(lockfile),
 				     "%s/P_%s", _lock_dir, resource + 1);
--- LVM2/lib/locking/locking.h	2008/04/15 14:46:19	1.40
+++ LVM2/lib/locking/locking.h	2008/05/09 19:26:58	1.41
@@ -27,9 +27,11 @@
 
 /*
  * LCK_VG:
- *   Lock/unlock on-disk volume group data
- *   Use VG_ORPHANS to lock orphan PVs
- *   char *vol holds volume group name
+ *   Lock/unlock on-disk volume group data.
+ *   Use VG_ORPHANS to lock all orphan PVs.
+ *   Use VG_GLOBAL as a global lock and to wipe the internal cache.
+ *   char *vol holds volume group name.
+ *   Set the LCK_CACHE flag to invalidate 'vol' in the internal cache.
  *
  * LCK_LV:
  *   Lock/unlock an individual logical volume
@@ -38,6 +40,13 @@
 int lock_vol(struct cmd_context *cmd, const char *vol, uint32_t flags);
 
 /*
+ * Internal locking representation.
+ *   LCK_VG: Uses prefix V_ unless the vol begins with # (i.e. #global or #orphans)
+ *           or the LCK_CACHE flag is set when it uses the prefix P_.
+ * If LCK_CACHE is set, we do not take out a real lock.
+ */
+
+/*
  * Does the LVM1 driver have this VG active?
  */
 int check_lvm1_vg_inactive(struct cmd_context *cmd, const char *vgname);
@@ -69,7 +78,7 @@
 #define LCK_HOLD	0x00000020U	/* Hold lock when lock_vol returns? */
 #define LCK_LOCAL	0x00000040U	/* Don't propagate to other nodes */
 #define LCK_CLUSTER_VG	0x00000080U	/* VG is clustered */
-#define LCK_CACHE	0x00000100U	/* Operation on cache using P_ lock */
+#define LCK_CACHE	0x00000100U	/* Operation on cache only using P_ lock */
 
 /*
  * Additional lock bits for cluster communication


^ permalink raw reply	[flat|nested] 4+ messages in thread

* LVM2 daemons/clvmd/clvmd-command.c daemons/clv ...
@ 2012-03-01 21:14 zkabelac
  0 siblings, 0 replies; 4+ messages in thread
From: zkabelac @ 2012-03-01 21:14 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	zkabelac@sourceware.org	2012-03-01 21:14:44

Modified files:
	daemons/clvmd  : clvmd-command.c clvmd.c 
	tools          : lvconvert.c toollib.c 

Log message:
	Correct enum type
	
	Using debug_t and some forgetten alloc_policy_t, force_t from past commit.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/clvmd-command.c.diff?cvsroot=lvm2&r1=1.66&r2=1.67
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/clvmd.c.diff?cvsroot=lvm2&r1=1.130&r2=1.131
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvconvert.c.diff?cvsroot=lvm2&r1=1.187&r2=1.188
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/toollib.c.diff?cvsroot=lvm2&r1=1.244&r2=1.245

--- LVM2/daemons/clvmd/clvmd-command.c	2012/02/27 10:02:17	1.66
+++ LVM2/daemons/clvmd/clvmd-command.c	2012/03/01 21:14:43	1.67
@@ -153,7 +153,7 @@
 		break;
 
 	case CLVMD_CMD_SET_DEBUG:
-		clvmd_set_debug(args[0]);
+		clvmd_set_debug((debug_t) args[0]);
 		break;
 
 	case CLVMD_CMD_RESTART:
--- LVM2/daemons/clvmd/clvmd.c	2012/03/01 21:12:37	1.130
+++ LVM2/daemons/clvmd/clvmd.c	2012/03/01 21:14:43	1.131
@@ -343,7 +343,7 @@
 	int start_timeout = 0;
 	if_type_t cluster_iface = IF_AUTO;
 	sigset_t ss;
-	int debug_opt = 0;
+	debug_t debug_opt = DEBUG_OFF;
 	debug_t debug_arg = DEBUG_OFF;
 	int clusterwide_opt = 0;
 	mode_t old_mask;
@@ -383,8 +383,8 @@
 			break;
 
 		case 'd':
-			debug_opt = 1;
-			debug_arg = optarg ? atoi(optarg) : DEBUG_STDERR;
+			debug_opt = DEBUG_STDERR;
+			debug_arg = optarg ? (debug_t) atoi(optarg) : DEBUG_STDERR;
 			if (debug_arg == DEBUG_STDERR)
 				foreground_mode = 1;
 			break;
--- LVM2/tools/lvconvert.c	2012/02/28 14:24:58	1.187
+++ LVM2/tools/lvconvert.c	2012/03/01 21:14:43	1.188
@@ -203,7 +203,7 @@
 		lp->mirrors_sign = arg_sign_value(cmd, mirrors_ARG, SIGN_NONE);
 	}
 
-	lp->alloc = arg_uint_value(cmd, alloc_ARG, ALLOC_INHERIT);
+	lp->alloc = (alloc_policy_t) arg_uint_value(cmd, alloc_ARG, ALLOC_INHERIT);
 
 	/* There are three types of lvconvert. */
 	if (lp->merge) {	/* Snapshot merge */
@@ -1236,7 +1236,7 @@
 
         if (force && _failed_mirrors_count(lv) == lv_mirror_count(lv)) {
 		log_error("No usable images left in %s.", lv->name);
-		return lv_remove_with_dependencies(cmd, lv, 1, 0);
+		return lv_remove_with_dependencies(cmd, lv, DONT_PROMPT, 0);
         }
 
 	/*
--- LVM2/tools/toollib.c	2012/02/28 18:08:08	1.244
+++ LVM2/tools/toollib.c	2012/03/01 21:14:43	1.245
@@ -1245,7 +1245,7 @@
 					vp_def->max_lv);
 	vp_new->max_pv = arg_uint_value(cmd, maxphysicalvolumes_ARG,
 					vp_def->max_pv);
-	vp_new->alloc = arg_uint_value(cmd, alloc_ARG, vp_def->alloc);
+	vp_new->alloc = (alloc_policy_t) arg_uint_value(cmd, alloc_ARG, vp_def->alloc);
 
 	/* Units of 512-byte sectors */
 	vp_new->extent_size =
@@ -1389,7 +1389,7 @@
 	}
 
 	pp->yes = arg_count(cmd, yes_ARG);
-	pp->force = arg_count(cmd, force_ARG);
+	pp->force = (force_t) arg_count(cmd, force_ARG);
 
 	if (arg_int_value(cmd, labelsector_ARG, 0) >= LABEL_SCAN_SECTORS) {
 		log_error("labelsector must be less than %lu",


^ permalink raw reply	[flat|nested] 4+ messages in thread

* LVM2 daemons/clvmd/clvmd-command.c daemons/clv ...
@ 2008-11-04 15:07 agk
  0 siblings, 0 replies; 4+ messages in thread
From: agk @ 2008-11-04 15:07 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2008-11-04 15:07:45

Modified files:
	daemons/clvmd  : clvmd-command.c clvmd-gulm.c clvmd-openais.c 
	                 clvmd.c lvm-functions.c 
	daemons/dmeventd: dmeventd.c 
	lib/format_pool: disk_rep.c 
	lib/locking    : cluster_locking.c locking.c 
	lib/metadata   : pv_map.c 
	lib/uuid       : uuid.c 
	libdm          : libdevmapper.h libdm-common.c libdm-deptree.c 
	libdm/datastruct: list.c 

Log message:
	more fixes

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/clvmd-command.c.diff?cvsroot=lvm2&r1=1.24&r2=1.25
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/clvmd-gulm.c.diff?cvsroot=lvm2&r1=1.23&r2=1.24
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/clvmd-openais.c.diff?cvsroot=lvm2&r1=1.7&r2=1.8
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/clvmd.c.diff?cvsroot=lvm2&r1=1.49&r2=1.50
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/lvm-functions.c.diff?cvsroot=lvm2&r1=1.46&r2=1.47
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/dmeventd/dmeventd.c.diff?cvsroot=lvm2&r1=1.53&r2=1.54
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_pool/disk_rep.c.diff?cvsroot=lvm2&r1=1.14&r2=1.15
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/cluster_locking.c.diff?cvsroot=lvm2&r1=1.30&r2=1.31
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/locking.c.diff?cvsroot=lvm2&r1=1.52&r2=1.53
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/pv_map.c.diff?cvsroot=lvm2&r1=1.32&r2=1.33
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/uuid/uuid.c.diff?cvsroot=lvm2&r1=1.27&r2=1.28
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdevmapper.h.diff?cvsroot=lvm2&r1=1.85&r2=1.86
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdm-common.c.diff?cvsroot=lvm2&r1=1.62&r2=1.63
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdm-deptree.c.diff?cvsroot=lvm2&r1=1.46&r2=1.47
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/datastruct/list.c.diff?cvsroot=lvm2&r1=1.5&r2=1.6

--- LVM2/daemons/clvmd/clvmd-command.c	2008/05/09 19:26:58	1.24
+++ LVM2/daemons/clvmd/clvmd-command.c	2008/11/04 15:07:44	1.25
@@ -67,7 +67,6 @@
 #include <libdevmapper.h>
 #include <libdlm.h>
 
-#include "list.h"
 #include "locking.h"
 #include "log.h"
 #include "lvm-functions.h"
--- LVM2/daemons/clvmd/clvmd-gulm.c	2008/06/20 10:58:28	1.23
+++ LVM2/daemons/clvmd/clvmd-gulm.c	2008/11/04 15:07:44	1.24
@@ -44,7 +44,6 @@
 #include <ccs.h>
 #include <libgulm.h>
 
-#include "list.h"
 #include "locking.h"
 #include "log.h"
 #include "clvm.h"
--- LVM2/daemons/clvmd/clvmd-openais.c	2008/06/20 12:46:21	1.7
+++ LVM2/daemons/clvmd/clvmd-openais.c	2008/11/04 15:07:44	1.8
@@ -39,7 +39,6 @@
 #include <openais/saLck.h>
 #include <openais/cpg.h>
 
-#include "list.h"
 #include "locking.h"
 #include "log.h"
 #include "clvm.h"
--- LVM2/daemons/clvmd/clvmd.c	2008/11/03 22:14:26	1.49
+++ LVM2/daemons/clvmd/clvmd.c	2008/11/04 15:07:44	1.50
@@ -46,7 +46,6 @@
 #include "version.h"
 #include "clvmd.h"
 #include "refresh_clvmd.h"
-#include "list.h"
 #include "log.h"
 
 #ifndef TRUE
--- LVM2/daemons/clvmd/lvm-functions.c	2008/09/19 15:44:03	1.46
+++ LVM2/daemons/clvmd/lvm-functions.c	2008/11/04 15:07:44	1.47
@@ -33,7 +33,6 @@
 #include <libdevmapper.h>
 #include <libdlm.h>
 
-#include "list.h"
 #include "lvm-types.h"
 #include "clvm.h"
 #include "clvmd-comms.h"
--- LVM2/daemons/dmeventd/dmeventd.c	2008/11/03 23:01:21	1.53
+++ LVM2/daemons/dmeventd/dmeventd.c	2008/11/04 15:07:44	1.54
@@ -22,7 +22,6 @@
 #include "configure.h"
 #include "libdevmapper.h"
 #include "libdevmapper-event.h"
-#include "list.h"
 #include "dmeventd.h"
 //#include "libmultilog.h"
 #include "dm-logging.h"
--- LVM2/lib/format_pool/disk_rep.c	2008/11/03 22:14:28	1.14
+++ LVM2/lib/format_pool/disk_rep.c	2008/11/04 15:07:44	1.15
@@ -19,9 +19,10 @@
 #include "lvmcache.h"
 #include "filter.h"
 #include "xlate.h"
-
 #include "disk_rep.h"
 
+#include <assert.h>
+
 /* FIXME: memcpy might not be portable */
 #define CPIN_8(x, y, z) {memcpy((x), (y), (z));}
 #define CPOUT_8(x, y, z) {memcpy((y), (x), (z));}
--- LVM2/lib/locking/cluster_locking.c	2008/09/19 06:41:58	1.30
+++ LVM2/lib/locking/cluster_locking.c	2008/11/04 15:07:44	1.31
@@ -25,6 +25,7 @@
 #include "locking.h"
 #include "locking_types.h"
 
+#include <assert.h>
 #include <stddef.h>
 #include <sys/socket.h>
 #include <sys/un.h>
--- LVM2/lib/locking/locking.c	2008/11/03 22:14:29	1.52
+++ LVM2/lib/locking/locking.c	2008/11/04 15:07:44	1.53
@@ -23,6 +23,7 @@
 #include "defaults.h"
 #include "lvmcache.h"
 
+#include <assert.h>
 #include <signal.h>
 #include <sys/stat.h>
 #include <limits.h>
--- LVM2/lib/metadata/pv_map.c	2008/11/03 22:14:29	1.32
+++ LVM2/lib/metadata/pv_map.c	2008/11/04 15:07:44	1.33
@@ -17,6 +17,8 @@
 #include "pv_map.h"
 #include "pv_alloc.h"
 
+#include <assert.h>
+
 /*
  * Areas are maintained in size order, largest first.
  *
--- LVM2/lib/uuid/uuid.c	2008/08/29 00:49:46	1.27
+++ LVM2/lib/uuid/uuid.c	2008/11/04 15:07:45	1.28
@@ -16,6 +16,7 @@
 #include "lib.h"
 #include "uuid.h"
 
+#include <assert.h>
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <unistd.h>
--- LVM2/libdm/libdevmapper.h	2008/11/04 14:57:06	1.85
+++ LVM2/libdm/libdevmapper.h	2008/11/04 15:07:45	1.86
@@ -799,7 +799,7 @@
  * The containing structure should be the same type as 'v'.
  * The list should be 'struct dm_list list' within the containing structure.
  */
-#define dm_list_iterate_back_items(v, head) list_iterate_back_items_gen(v, (head), list)
+#define dm_list_iterate_back_items(v, head) dm_list_iterate_back_items_gen(v, (head), list)
 
 /*
  * Return the number of elements in a list by walking it.
--- LVM2/libdm/libdm-common.c	2008/11/03 22:14:29	1.62
+++ LVM2/libdm/libdm-common.c	2008/11/04 15:07:45	1.63
@@ -16,7 +16,6 @@
 #include "dmlib.h"
 #include "libdm-targets.h"
 #include "libdm-common.h"
-#include "list.h"
 #include "kdev_t.h"
 #include "dm-ioctl.h"
 
--- LVM2/libdm/libdm-deptree.c	2008/11/03 22:14:29	1.46
+++ LVM2/libdm/libdm-deptree.c	2008/11/04 15:07:45	1.47
@@ -15,7 +15,6 @@
 #include "dmlib.h"
 #include "libdm-targets.h"
 #include "libdm-common.h"
-#include "list.h"
 #include "kdev_t.h"
 #include "dm-ioctl.h"
 
--- LVM2/libdm/datastruct/list.c	2008/11/03 22:14:30	1.5
+++ LVM2/libdm/datastruct/list.c	2008/11/04 15:07:45	1.6
@@ -14,6 +14,7 @@
  */
 
 #include "lib.h"
+#include <assert.h>
 
 /*
  * Initialise a list before use.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* LVM2 daemons/clvmd/clvmd-command.c daemons/clv ...
@ 2006-12-01 23:10 agk
  0 siblings, 0 replies; 4+ messages in thread
From: agk @ 2006-12-01 23:10 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2006-12-01 23:10:26

Modified files:
	daemons/clvmd  : clvmd-command.c clvmd.c refresh_clvmd.c 
	lib/locking    : cluster_locking.c 

Log message:
	clvmd ia64 alignment fixes etc. (pjc)

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/clvmd-command.c.diff?cvsroot=lvm2&r1=1.12&r2=1.13
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/clvmd.c.diff?cvsroot=lvm2&r1=1.31&r2=1.32
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/refresh_clvmd.c.diff?cvsroot=lvm2&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/cluster_locking.c.diff?cvsroot=lvm2&r1=1.15&r2=1.16

--- LVM2/daemons/clvmd/clvmd-command.c	2006/12/01 22:48:47	1.12
+++ LVM2/daemons/clvmd/clvmd-command.c	2006/12/01 23:10:25	1.13
@@ -200,7 +200,7 @@
 	if (status)
 	    status = errno;
 	else
-	    dm_hash_insert(lock_hash, lockname, (void *)lkid);
+	    dm_hash_insert(lock_hash, lockname, (void *)(long)lkid);
     }
 
     return status;
@@ -224,7 +224,7 @@
 	switch (header->cmd) {
 	case CLVMD_CMD_TEST:
 		status = sync_lock("CLVMD_TEST", LKM_EXMODE, 0, &lockid);
-		client->bits.localsock.private = (void *) lockid;
+		client->bits.localsock.private = (void *)(long)lockid;
 		break;
 
 	case CLVMD_CMD_LOCK_VG:
--- LVM2/daemons/clvmd/clvmd.c	2006/11/30 13:19:42	1.31
+++ LVM2/daemons/clvmd/clvmd.c	2006/12/01 23:10:25	1.32
@@ -325,7 +325,8 @@
 	/* This needs to be started after cluster initialisation
 	   as it may need to take out locks */
 	DEBUGLOG("starting LVM thread\n");
-	pthread_create(&lvm_thread, NULL, lvm_thread_fn, (void *)using_gulm);
+	pthread_create(&lvm_thread, NULL, lvm_thread_fn, 
+			(void *)(long)using_gulm);
 
 	/* Tell the rest of the cluster our version number */
 	/* CMAN can do this immediately, gulm needs to wait until
@@ -412,16 +413,17 @@
 
 	len = read(thisfd->fd, buffer, sizeof(int));
 
-	DEBUGLOG("read on PIPE %d: %d bytes: status: %d\n",
-		 thisfd->fd, len, *(int *) buffer);
-
 	if (len == sizeof(int)) {
-		status = *(int *) buffer;
+		memcpy(&status, buffer, sizeof(int));
 	}
 
+	DEBUGLOG("read on PIPE %d: %d bytes: status: %d\n",
+		 thisfd->fd, len, status);
+
 	/* EOF on pipe or an error, close it */
 	if (len <= 0) {
 		int jstat;
+		void *ret = &status;
 		close(thisfd->fd);
 
 		/* Clear out the cross-link */
@@ -431,9 +433,7 @@
 
 		/* Reap child thread */
 		if (thisfd->bits.pipe.threadid) {
-			jstat =
-			    pthread_join(thisfd->bits.pipe.threadid,
-					 (void **) &status);
+			jstat = pthread_join(thisfd->bits.pipe.threadid, &ret);
 			thisfd->bits.pipe.threadid = 0;
 			if (thisfd->bits.pipe.client != NULL)
 				thisfd->bits.pipe.client->bits.localsock.
@@ -674,7 +674,7 @@
 	close(local_sock);
 }
 
-static void wait_for_child(int c_pipe, int timeout)
+static __attribute__ ((noreturn)) void wait_for_child(int c_pipe, int timeout)
 {
 	int child_status;
 	int sstat;
@@ -1139,8 +1139,8 @@
 }
 
 /* Process a command from a remote node and return the result */
-void process_remote_command(struct clvm_header *msg, int msglen, int fd,
-			    char *csid)
+static void process_remote_command(struct clvm_header *msg, int msglen, int fd,
+			    	   char *csid)
 {
 	char *replyargs;
 	char nodename[max_cluster_member_name_len];
@@ -1164,11 +1164,12 @@
 		    (struct clvm_header *) malloc(msg->arglen +
 						  sizeof(struct clvm_header));
 		if (newmsg) {
-			if (system_lv_read_data
-			    (nodename, (char *) newmsg,
-			     (size_t *) &msglen) == 0) {
+			ssize_t len;
+			if (system_lv_read_data(nodename, (char *) newmsg,
+			     			&len) == 0) {
 				msg = newmsg;
 				msg_malloced = 1;
+				msglen = len;
 			} else {
 				struct clvm_header head;
 				DEBUGLOG("System LV read failed\n");
@@ -1214,8 +1215,11 @@
 	/* Version check is internal - don't bother exposing it in
 	   clvmd-command.c */
 	if (msg->cmd == CLVMD_CMD_VERSION) {
-		int *version_nums = (int *) msg->args;
+		int version_nums[3]; 
 		char node[256];
+
+		memcpy(version_nums, msg->args, sizeof(version_nums));
+
 		clops->name_from_csid(csid, node);
 		DEBUGLOG("Remote node %s is version %d.%d.%d\n",
 			 node,
@@ -1387,7 +1391,7 @@
 }
 
 /* This is the thread that runs the PRE and post commands for a particular connection */
-static void *pre_and_post_thread(void *arg)
+static __attribute__ ((noreturn)) void *pre_and_post_thread(void *arg)
 {
 	struct local_client *client = (struct local_client *) arg;
 	int status;
@@ -1455,7 +1459,6 @@
 	}
 	DEBUGLOG("Subthread finished\n");
 	pthread_exit((void *) 0);
-	return 0;
 }
 
 /* Process a command on the local node and store the result */
@@ -1564,7 +1567,7 @@
 		if (thisreply->status)
 			clientreply->flags |= CLVMD_FLAG_NODEERRS;
 
-		*(int *) ptr = thisreply->status;
+		memcpy(ptr, &thisreply->status, sizeof(int));
 		ptr += sizeof(int);
 
 		if (thisreply->replymsg) {
@@ -1620,19 +1623,22 @@
 {
 	char message[sizeof(struct clvm_header) + sizeof(int) * 3];
 	struct clvm_header *msg = (struct clvm_header *) message;
-	int *version_nums = (int *) msg->args;
+	int version_nums[3];
 
 	msg->cmd = CLVMD_CMD_VERSION;
 	msg->status = 0;
 	msg->flags = 0;
 	msg->clientid = 0;
-	msg->arglen = sizeof(int) * 3;
+	msg->arglen = sizeof(version_nums);
 
 	version_nums[0] = htonl(CLVMD_MAJOR_VERSION);
 	version_nums[1] = htonl(CLVMD_MINOR_VERSION);
 	version_nums[2] = htonl(CLVMD_PATCH_VERSION);
 
+	memcpy(&msg->args, version_nums, sizeof(version_nums));
+
 	hton_clvm(msg);
+
 	clops->cluster_send_message(message, sizeof(message), NULL,
 			     "Error Sending version number");
 }
@@ -1689,11 +1695,11 @@
 /*
  * Routine that runs in the "LVM thread".
  */
-static void *lvm_thread_fn(void *arg)
+static __attribute__ ((noreturn)) void *lvm_thread_fn(void *arg)
 {
 	struct list *cmdl, *tmp;
 	sigset_t ss;
-	int using_gulm = (int)arg;
+	int using_gulm = (int)(long)arg;
 
 	/* Don't let anyone else to do work until we are started */
 	pthread_mutex_lock(&lvm_start_mutex);
@@ -1737,7 +1743,6 @@
 		}
 		pthread_mutex_unlock(&lvm_thread_mutex);
 	}
-	return NULL;
 }
 
 /* Pass down some work to the LVM thread */
--- LVM2/daemons/clvmd/refresh_clvmd.c	2006/10/04 08:22:16	1.1
+++ LVM2/daemons/clvmd/refresh_clvmd.c	2006/12/01 23:10:25	1.2
@@ -183,7 +183,6 @@
 			   lvm_response_t ** response, int *num)
 {
 	char outbuf[sizeof(struct clvm_header) + len + strlen(node) + 1];
-	int *outptr;
 	char *inptr;
 	char *retbuf = NULL;
 	int status;
@@ -223,17 +222,14 @@
 	 * With an extra pair of INTs on the front to sanity
 	 * check the pointer when we are given it back to free
 	 */
-	outptr = dm_malloc(sizeof(lvm_response_t) * num_responses +
+	*response = dm_malloc(sizeof(lvm_response_t) * num_responses +
 			    sizeof(int) * 2);
-	if (!outptr) {
+	if (!*response) {
 		errno = ENOMEM;
 		status = 0;
 		goto out;
 	}
 
-	*response = (lvm_response_t *) (outptr + 2);
-	outptr[0] = LVM_SIGNATURE;
-	outptr[1] = num_responses;
 	rarray = *response;
 
 	/* Unpack the response into an lvm_response_t array */
@@ -252,7 +248,7 @@
 			int j;
 			for (j = 0; j < i; j++)
 				dm_free(rarray[i].response);
-			free(outptr);
+			free(*response);
 			errno = ENOMEM;
 			status = -1;
 			goto out;
@@ -274,25 +270,15 @@
 }
 
 /* Free reply array */
-static int _cluster_free_request(lvm_response_t * response)
+static int _cluster_free_request(lvm_response_t * response, int num)
 {
-	int *ptr = (int *) response - 2;
 	int i;
-	int num;
-
-	/* Check it's ours to free */
-	if (response == NULL || *ptr != LVM_SIGNATURE) {
-		errno = EINVAL;
-		return 0;
-	}
-
-	num = ptr[1];
 
 	for (i = 0; i < num; i++) {
 		dm_free(response[i].response);
 	}
 
-	dm_free(ptr);
+	dm_free(response);
 
 	return 1;
 }
@@ -327,7 +313,7 @@
 	}
 
 	saved_errno = errno;
-	_cluster_free_request(response);
+	_cluster_free_request(response, num_responses);
 	errno = saved_errno;
 
 	return status;
--- LVM2/lib/locking/cluster_locking.c	2006/11/30 23:11:41	1.15
+++ LVM2/lib/locking/cluster_locking.c	2006/12/01 23:10:26	1.16
@@ -196,7 +196,6 @@
 			   lvm_response_t ** response, int *num)
 {
 	char outbuf[sizeof(struct clvm_header) + len + strlen(node) + 1] __attribute((aligned(8)));
-	int *outptr;
 	char *inptr;
 	char *retbuf = NULL;
 	int status;
@@ -236,17 +235,13 @@
 	 * With an extra pair of INTs on the front to sanity
 	 * check the pointer when we are given it back to free
 	 */
-	outptr = dm_malloc(sizeof(lvm_response_t) * num_responses +
-			    sizeof(int) * 2);
-	if (!outptr) {
+	*response = dm_malloc(sizeof(lvm_response_t) * num_responses);
+	if (!*response) {
 		errno = ENOMEM;
 		status = 0;
 		goto out;
 	}
 
-	*response = (lvm_response_t *) (outptr + 2);
-	outptr[0] = LVM_SIGNATURE;
-	outptr[1] = num_responses;
 	rarray = *response;
 
 	/* Unpack the response into an lvm_response_t array */
@@ -265,7 +260,7 @@
 			int j;
 			for (j = 0; j < i; j++)
 				dm_free(rarray[i].response);
-			free(outptr);
+			free(*response);
 			errno = ENOMEM;
 			status = -1;
 			goto out;
@@ -287,25 +282,15 @@
 }
 
 /* Free reply array */
-static int _cluster_free_request(lvm_response_t * response)
+static int _cluster_free_request(lvm_response_t * response, int num)
 {
-	int *ptr = (int *) response - 2;
 	int i;
-	int num;
-
-	/* Check it's ours to free */
-	if (response == NULL || *ptr != LVM_SIGNATURE) {
-		errno = EINVAL;
-		return 0;
-	}
-
-	num = ptr[1];
 
 	for (i = 0; i < num; i++) {
 		dm_free(response[i].response);
 	}
 
-	dm_free(ptr);
+	dm_free(response);
 
 	return 1;
 }
@@ -374,7 +359,7 @@
 	}
 
 	saved_errno = errno;
-	_cluster_free_request(response);
+	_cluster_free_request(response, num_responses);
 	errno = saved_errno;
 
 	return status;


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-03-01 21:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-09 19:26 LVM2 daemons/clvmd/clvmd-command.c daemons/clv agk
  -- strict thread matches above, loose matches on Subject: below --
2012-03-01 21:14 zkabelac
2008-11-04 15:07 agk
2006-12-01 23:10 agk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).