Skip to contentSkip to conversation

multipath-tools: add 'void' for no arguments functions

PATCH New Xose Vazquez Perez 1 participant 5 messages Aug 3, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/5 multipath-tools: add 'void' for no arguments functions

Found by checkpatch - ERROR: Bad function definition

Cc Christophe Varoqui <[email protected]>
Cc device-mapper development <[email protected]>
---
 libmpathpersist/mpath_pr_ioctl.c | 2 +-
 mpathpersist/main.c              | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
libmpathpersist/mpath_pr_ioctl.c +1 -1
index cf7141a..48d36e9 100644
@@ -466,7 +466,7 @@ int mpath_translate_response (char * dev, struct sg_io_hdr io_hdr,
 	return MPATH_PR_SUCCESS;
 }
 
-int mpath_isLittleEndian()
+int mpath_isLittleEndian(void)
 {
 	int num = 1;
 	if(*(char *)&num == 1)
mpathpersist/main.c +1 -1
index 6e922a2..5bf0740 100644
@@ -675,7 +675,7 @@ void mpath_print_buf_readfullstat( struct prin_resp *pr_buff)
 	}
 }
 
-static void usage()
+static void usage(void)
 {
 	fprintf(stderr,
 			"Usage: mpathpersist [OPTIONS] [DEVICE]\n"
Signature · 1 line
2.7.4
#1 lore raw

PATCH 2/5 multipath-tools: fix spacing around operators

Found by checkpatch - ERROR: need consistent spacing around "x"

Cc Christophe Varoqui <[email protected]>
Cc device-mapper development <[email protected]>
---
 kpartx/ps3.c                    | 2 +-
 libmpathpersist/mpath_persist.c | 2 +-
 libmultipath/blacklist.c        | 2 +-
 libmultipath/checkers/tur.c     | 2 +-
 mpathpersist/main.c             | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)
kpartx/ps3.c +1 -1
index 2fe868d..8455097 100644
@@ -28,7 +28,7 @@ struct disklabel {
 	u_int64_t d_res2;
 	u_int64_t d_res3;
 	struct d_partition d_partitions[MAX_PARTITIONS];
-	u_int8_t d_pad[0x600 - MAX_PARTITIONS * sizeof(struct d_partition)- 0x30];
+	u_int8_t d_pad[0x600 - MAX_PARTITIONS * sizeof(struct d_partition) - 0x30];
 };
 
 static int
libmpathpersist/mpath_persist.c +1 -1
index 252d6fc..c5be6cd 100644
@@ -514,7 +514,7 @@ int mpath_prout_reg(struct multipath *mpp,int rq_servact, int rq_scope,
 			if (rc){
 				condlog (0, "%s: failed to create thread %d", mpp->wwid, rc);
 			}
-			count = count +1;
+			count = count + 1;
 		}
 	}
 	for( i=0; i < active_pathcount ; i++){
libmultipath/blacklist.c +1 -1
index 2400eda..9687399 100644
@@ -210,7 +210,7 @@ setup_default_blist (struct config * conf)
 			if (alloc_ble_device(conf->blist_device))
 				return 1;
 			ble = VECTOR_SLOT(conf->blist_device,
-					  VECTOR_SIZE(conf->blist_device) -1);
+					  VECTOR_SIZE(conf->blist_device) - 1);
 			if (set_ble_device(conf->blist_device,
 					   STRDUP(hwe->vendor),
 					   STRDUP(hwe->bl_product),
libmultipath/checkers/tur.c +1 -1
index c4ef8a8..b53078f 100644
@@ -345,7 +345,7 @@ libcheck_check (struct checker * c)
 		r = pthread_cond_timedwait(&ct->active, &ct->lock, &tsp);
 		tur_status = ct->state;
 		strncpy(c->message, ct->message,CHECKER_MSG_LEN);
-		c->message[CHECKER_MSG_LEN -1] = '\0';
+		c->message[CHECKER_MSG_LEN - 1] = '\0';
 		pthread_mutex_unlock(&ct->lock);
 		if (ct->thread &&
 		    (tur_status == PATH_PENDING || tur_status == PATH_UNCHECKED)) {
mpathpersist/main.c +1 -1
index 5bf0740..2cf0a9c 100644
@@ -662,7 +662,7 @@ void mpath_print_buf_readfullstat( struct prin_resp *pr_buff)
 
 		if (pr_buff->prin_descriptor.prin_readfd.descriptors[i]->flag & 0x1) {
 			printf("      << Reservation holder >>\n");
-			j = ((pr_buff->prin_descriptor.prin_readfd.descriptors[i]->scope_type>> 4) & 0xf);
+			j = ((pr_buff->prin_descriptor.prin_readfd.descriptors[i]->scope_type >> 4) & 0xf);
 			if (0 == j)
 				printf("      scope: LU_SCOPE, ");
 			else
Signature · 1 line
2.7.4
#2 lore raw

PATCH 3/5 multipath-tools: remove indent from labels

In reply to Xose Vazquez Perez

Found by checkpatch - WARNING: labels should not be indented

Cc Christophe Varoqui <[email protected]>
Cc device-mapper development <[email protected]>
---
 kpartx/devmapper.c       | 4 ++--
 libmultipath/devmapper.c | 8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)
kpartx/devmapper.c +2 -2
index 382f511..474d879 100644
@@ -47,7 +47,7 @@ dm_prereq (char * str, int x, int y, int z)
 		target = (void *) target + target->next;
 	} while (last_target != target);
 
-	out:
+out:
 	dm_task_destroy(dmt);
 	return r;
 }
@@ -85,7 +85,7 @@ dm_simplecmd (int task, const char *name, int no_flush, uint16_t udev_flags) {
 	if (udev_wait_flag)
 			dm_udev_wait(cookie);
 #endif
-	out:
+out:
 	dm_task_destroy(dmt);
 	return r;
 }
libmultipath/devmapper.c +4 -4
index 9b2c706..5eb1713 100644
@@ -243,7 +243,7 @@ dm_simplecmd (int task, const char *name, int no_flush, int need_sync, uint16_t
 
 	if (udev_wait_flag)
 			dm_udev_wait(cookie);
-	out:
+out:
 	dm_task_destroy (dmt);
 	return r;
 }
@@ -327,11 +327,11 @@ dm_addmap (int task, const char *target, struct multipath *mpp,
 
 	if (task == DM_DEVICE_CREATE)
 			dm_udev_wait(cookie);
-	freeout:
+freeout:
 	if (prefixed_uuid)
 		FREE(prefixed_uuid);
 
-	addout:
+addout:
 	dm_task_destroy (dmt);
 
 	return r;
@@ -891,7 +891,7 @@ dm_flush_maps (void)
 		names = (void *) names + next;
 	} while (next);
 
-	out:
+out:
 	dm_task_destroy (dmt);
 	return r;
 }
Signature · 1 line
2.7.4
#3 lore raw

PATCH 4/5 multipath-tools: indent switch and case at the same level

In reply to Xose Vazquez Perez

Found by checkpatch - ERROR: switch and case should be at the same indent

Cc Christophe Varoqui <[email protected]>
Cc device-mapper development <[email protected]>
---
 kpartx/kpartx.c                  |   5 +-
 libmpathpersist/mpath_pr_ioctl.c | 118 +++++++++++++++++++--------------------
 libmultipath/prioritizers/alua.c |  52 ++++++++---------
 mpathpersist/main.c              |  60 ++++++++++----------
 multipathd/main.c                |   2 +-
 5 files changed, 119 insertions(+), 118 deletions(-)
kpartx/kpartx.c +3 -2
index b7b4047..d31fea8 100644
@@ -258,7 +258,8 @@ main(int argc, char **argv){
 		exit(1);
 	}
 
-	while ((arg = getopt(argc, argv, short_opts)) != EOF) switch(arg) {
+	while ((arg = getopt(argc, argv, short_opts)) != EOF)
+		switch(arg) {
 		case 'r':
 			ro=1;
 			break;
@@ -295,7 +296,7 @@ main(int argc, char **argv){
 		default:
 			usage();
 			exit(1);
-	}
+		}
 
 #ifdef LIBDM_API_COOKIE
 	if (!udev_sync)
libmpathpersist/mpath_pr_ioctl.c +59 -59

138 lines not on this page · raw message

libmultipath/prioritizers/alua.c +26 -26

63 lines not on this page · raw message

mpathpersist/main.c +30 -30

67 lines not on this page · raw message

multipathd/main.c +1 -1
index 20589a7..ec3b907 100644
@@ -2536,7 +2536,7 @@ main (int argc, char *argv[])
 	udev = udev_new();
 
 	while ((arg = getopt(argc, argv, ":dsv:k::Bn")) != EOF ) {
-	switch(arg) {
+		switch(arg) {
 		case 'd':
 			foreground = 1;
 			if (logsink > 0)
Signature · 1 line
2.7.4
#4 lore raw

PATCH 5/5 multipath-tools: remove redundant ;

In reply to Xose Vazquez Perez

Found by checkpatch - WARNING: Statements terminations use 1 semicolon

Cc Christophe Varoqui <[email protected]>
Cc device-mapper development <[email protected]>
---
 kpartx/lopart.c                 | 2 +-
 libmpathpersist/mpath_persist.c | 2 +-
 libmultipath/wwids.c            | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
kpartx/lopart.c +1 -1
index 5d20450..0ab1688 100644
@@ -147,7 +147,7 @@ find_loop_by_file (const char * filename)
 extern char *
 find_unused_loop_device (void)
 {
-	char dev[20], *next_loop_dev = NULL;;
+	char dev[20], *next_loop_dev = NULL;
 	int fd, next_loop = 0, somedev = 0, someloop = 0, loop_known = 0;
 	struct stat statbuf;
 	struct loop_info loopinfo;
libmpathpersist/mpath_persist.c +1 -1
index c5be6cd..7501651 100644
@@ -642,7 +642,7 @@ int mpath_prout_rel(struct multipath *mpp,int rq_servact, int rq_scope,
 	struct path *pp = NULL;
 	int active_pathcount = 0;
 	pthread_attr_t attr;
-	int rc, found = 0;;
+	int rc, found = 0;
 	int count = 0;
 	int status = MPATH_PR_SUCCESS;
 	struct prin_resp resp;
libmultipath/wwids.c +1 -1
index a7c3249..babf149 100644
@@ -273,7 +273,7 @@ out:
 int
 should_multipath(struct path *pp1, vector pathvec)
 {
-	int i, ignore_new_devs;;
+	int i, ignore_new_devs;
 	struct path *pp2;
 	struct config *conf;
 
Signature · 1 line
2.7.4