[PATCH] Remove all "if zeros"

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

 



No more random encounters of "if zeros".
Remove all "if 0" code blocks.

Signed-off-by: Mateusz Kusiak <mateusz.kusiak@xxxxxxxxx>
---
 Assemble.c    |  6 -----
 Detail.c      |  7 ------
 super-intel.c | 28 ----------------------
 super1.c      | 20 ----------------
 sysfs.c       | 66 ---------------------------------------------------
 5 files changed, 127 deletions(-)

diff --git a/Assemble.c b/Assemble.c
index 5be58e4066c5..bf3fa291a6e0 100644
--- a/Assemble.c
+++ b/Assemble.c
@@ -1806,12 +1806,6 @@ try_again:
 					       i, mddev, devices[j].devname);
 			}
 		}
-#if 0
-		if (!(super.disks[i].i.disk.state & (1 << MD_DISK_FAULTY))) {
-			pr_err("devices %d of %s is not marked FAULTY in superblock, but cannot be found\n",
-			       i, mddev);
-		}
-#endif
 	}
 	if (c->force && !clean && !is_container(content->array.level) &&
 	    !enough(content->array.level, content->array.raid_disks,
diff --git a/Detail.c b/Detail.c
index 57ac336fc312..aaa3dd6e0ee7 100644
--- a/Detail.c
+++ b/Detail.c
@@ -603,13 +603,6 @@ int Detail(char *dev, struct context *c)
 		}
 
 		if ((st && st->sb) && (info && info->reshape_active)) {
-#if 0
-This is pretty boring
-			printf("     Reshape pos'n : %llu%s\n",
-			       (unsigned long long) info->reshape_progress << 9,
-			       human_size((unsigned long long)
-					  info->reshape_progress << 9));
-#endif
 			if (info->delta_disks != 0)
 				printf("     Delta Devices : %d, (%d->%d)\n",
 				       info->delta_disks,
diff --git a/super-intel.c b/super-intel.c
index 05d3b0562ea3..589031e317d2 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -2976,34 +2976,6 @@ static void uuid_from_super_imsm(struct supertype *st, int uuid[4])
 	memcpy(uuid, buf, 4*4);
 }
 
-#if 0
-static void
-get_imsm_numerical_version(struct imsm_super *mpb, int *m, int *p)
-{
-	__u8 *v = get_imsm_version(mpb);
-	__u8 *end = mpb->sig + MAX_SIGNATURE_LENGTH;
-	char major[] = { 0, 0, 0 };
-	char minor[] = { 0 ,0, 0 };
-	char patch[] = { 0, 0, 0 };
-	char *ver_parse[] = { major, minor, patch };
-	int i, j;
-
-	i = j = 0;
-	while (*v != '\0' && v < end) {
-		if (*v != '.' && j < 2)
-			ver_parse[i][j++] = *v;
-		else {
-			i++;
-			j = 0;
-		}
-		v++;
-	}
-
-	*m = strtol(minor, NULL, 0);
-	*p = strtol(patch, NULL, 0);
-}
-#endif
-
 static __u32 migr_strip_blocks_resync(struct imsm_dev *dev)
 {
 	/* migr_strip_size when repairing or initializing parity */
diff --git a/super1.c b/super1.c
index 1da71b98d29e..dfde4629508b 100644
--- a/super1.c
+++ b/super1.c
@@ -544,26 +544,6 @@ static void examine_super1(struct supertype *st, char *homehost)
 		break;
 	}
 	printf("\n");
-#if 0
-	/* This turns out to just be confusing */
-	printf("    Array Slot : %d (", __le32_to_cpu(sb->dev_number));
-	for (i = __le32_to_cpu(sb->max_dev); i > 0 ; i--)
-		if (__le16_to_cpu(sb->dev_roles[i-1]) != MD_DISK_ROLE_SPARE)
-			break;
-	for (d = 0; d < i; d++) {
-		int role = __le16_to_cpu(sb->dev_roles[d]);
-		if (d)
-			printf(", ");
-		if (role == MD_DISK_ROLE_SPARE)
-			printf("empty");
-		else
-			if(role == MD_DISK_ROLE_FAULTY)
-				printf("failed");
-			else
-				printf("%d", role);
-	}
-	printf(")\n");
-#endif
 	printf("   Device Role : ");
 	role = role_from_sb(sb);
 	if (role >= MD_DISK_ROLE_FAULTY)
diff --git a/sysfs.c b/sysfs.c
index 94d02f53a768..decb02b8d80f 100644
--- a/sysfs.c
+++ b/sysfs.c
@@ -803,72 +803,6 @@ int sysfs_add_disk(struct mdinfo *sra, struct mdinfo *sd, int resume)
 	return rv;
 }
 
-#if 0
-int sysfs_disk_to_sg(int fd)
-{
-	/* from an open block device, try find and open its corresponding
-	 * scsi_generic interface
-	 */
-	struct stat st;
-	char path[256];
-	char sg_path[256];
-	char sg_major_minor[10];
-	char *c;
-	DIR *dir;
-	struct dirent *de;
-	int major, minor, rv;
-
-	if (fstat(fd, &st))
-		return -1;
-
-	snprintf(path, sizeof(path), "/sys/dev/block/%d:%d/device",
-		 major(st.st_rdev), minor(st.st_rdev));
-
-	dir = opendir(path);
-	if (!dir)
-		return -1;
-
-	de = readdir(dir);
-	while (de) {
-		if (strncmp("scsi_generic:", de->d_name,
-			    strlen("scsi_generic:")) == 0)
-			break;
-		de = readdir(dir);
-	}
-	closedir(dir);
-
-	if (!de)
-		return -1;
-
-	snprintf(sg_path, sizeof(sg_path), "%s/%s/dev", path, de->d_name);
-	fd = open(sg_path, O_RDONLY);
-	if (fd < 0)
-		return fd;
-
-	rv = read(fd, sg_major_minor, sizeof(sg_major_minor));
-	close(fd);
-	if (rv < 0 || rv == sizeof(sg_major_minor))
-		return -1;
-	else
-		sg_major_minor[rv - 1] = '\0';
-
-	c = strchr(sg_major_minor, ':');
-	*c = '\0';
-	c++;
-	major = strtol(sg_major_minor, NULL, 10);
-	minor = strtol(c, NULL, 10);
-	snprintf(path, sizeof(path), "/dev/.tmp.md.%d:%d:%d",
-		 (int) getpid(), major, minor);
-	if (mknod(path, S_IFCHR|0600, makedev(major, minor))==0) {
-			fd = open(path, O_RDONLY);
-			unlink(path);
-			return fd;
-	}
-
-	return -1;
-}
-#endif
-
 int sysfs_disk_to_scsi_id(int fd, __u32 *id)
 {
 	/* from an open block device, try to retrieve it scsi_id */
-- 
2.26.2





[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux