From 98dbf73cba81cd846f9c706f37edc22e21038cf4 Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Wed, 5 Apr 2017 11:57:30 -0400 Subject: [PATCH] Create: Fixup various whitespace issues Signed-off-by: Jes Sorensen --- Create.c | 50 ++++++++++++++++++++++++-------------------------- 1 file changed, 24 insertions(+), 26 deletions(-) Index: mdadm/Create.c =================================================================== --- mdadm.orig/Create.c +++ mdadm/Create.c @@ -84,12 +84,12 @@ int Create(struct supertype *st, char *m * RUN_ARRAY */ int mdfd; - unsigned long long minsize=0, maxsize=0; + unsigned long long minsize = 0, maxsize = 0; char *mindisc = NULL; char *maxdisc = NULL; int dnum, raid_disk_num; struct mddev_dev *dv; - int fail=0, warn=0; + int fail = 0, warn = 0; struct stat stb; int first_missing = subdevs * 2; int second_missing = subdevs * 2; @@ -260,7 +260,7 @@ int Create(struct supertype *st, char *m &s->chunk, s->size*2, data_offset, NULL, &newsize, s->consistency_policy, - c->verbose>=0)) + c->verbose >= 0)) return 1; if (s->chunk && s->chunk != UnSet) { @@ -291,7 +291,7 @@ int Create(struct supertype *st, char *m info.array.active_disks = 0; info.array.working_disks = 0; dnum = 0; - for (dv = devlist; dv ; dv = dv->next) + for (dv = devlist; dv; dv = dv->next) if (data_offset == VARIABLE_OFFSET) dv->data_offset = INVALID_SECTORS; else @@ -303,7 +303,7 @@ int Create(struct supertype *st, char *m int dfd; char *doff; - if (strcasecmp(dname, "missing")==0) { + if (strcasecmp(dname, "missing") == 0) { if (first_missing > dnum) first_missing = dnum; if (second_missing > dnum && dnum > first_missing) @@ -349,7 +349,7 @@ int Create(struct supertype *st, char *m */ int i; char *name = "default"; - for(i=0; !st && superlist[i]; i++) { + for(i = 0; !st && superlist[i]; i++) { st = superlist[i]->match_metadata_desc(name); if (!st) continue; @@ -445,10 +445,10 @@ int Create(struct supertype *st, char *m skip_size_check: if (c->runstop != 1 || c->verbose >= 0) { int fd = open(dname, O_RDONLY); - if (fd <0 ) { + if (fd < 0) { pr_err("Cannot open %s: %s\n", dname, strerror(errno)); - fail=1; + fail = 1; continue; } warn |= check_ext2(fd, dname); @@ -497,7 +497,7 @@ int Create(struct supertype *st, char *m return 1; } if (s->level > 0 || s->level == LEVEL_MULTIPATH || - s->level == LEVEL_FAULTY || st->ss->external ) { + s->level == LEVEL_FAULTY || st->ss->external) { /* size is meaningful */ if (!st->ss->validate_geometry(st, s->level, s->layout, s->raiddisks, @@ -572,9 +572,9 @@ int Create(struct supertype *st, char *m * as missing, so that a reconstruct happens (faster than re-parity) * FIX: Can we do this for raid6 as well? */ - if (st->ss->external == 0 && - s->assume_clean==0 && c->force == 0 && first_missing >= s->raiddisks) { - switch ( s->level ) { + if (st->ss->external == 0 && s->assume_clean == 0 && + c->force == 0 && first_missing >= s->raiddisks) { + switch (s->level) { case 4: case 5: insert_point = s->raiddisks-1; @@ -649,7 +649,7 @@ int Create(struct supertype *st, char *m * with, but it chooses to trust me instead. Sigh */ info.array.md_minor = 0; - if (fstat(mdfd, &stb)==0) + if (fstat(mdfd, &stb) == 0) info.array.md_minor = minor(stb.st_rdev); info.array.not_persistent = 0; @@ -715,13 +715,11 @@ int Create(struct supertype *st, char *m name = strrchr(mddev, '/'); if (name) { name++; - if (strncmp(name, "md_", 3)==0 && - strlen(name) > 3 && - (name-mddev) == 5 /* /dev/ */) + if (strncmp(name, "md_", 3) == 0 && + strlen(name) > 3 && (name-mddev) == 5 /* /dev/ */) name += 3; - else if (strncmp(name, "md", 2)==0 && - strlen(name) > 2 && - isdigit(name[2]) && + else if (strncmp(name, "md", 2) == 0 && + strlen(name) > 2 && isdigit(name[2]) && (name-mddev) == 5 /* /dev/ */) name += 2; } @@ -769,9 +767,9 @@ int Create(struct supertype *st, char *m #endif } - if (s->bitmap_file && (strcmp(s->bitmap_file, "internal")==0 || - strcmp(s->bitmap_file, "clustered")==0)) { - if ((vers%100) < 2) { + if (s->bitmap_file && (strcmp(s->bitmap_file, "internal") == 0 || + strcmp(s->bitmap_file, "clustered") == 0)) { + if ((vers % 100) < 2) { pr_err("internal bitmaps not supported by this kernel.\n"); goto abort_locked; } @@ -851,11 +849,11 @@ int Create(struct supertype *st, char *m infos = xmalloc(sizeof(*infos) * total_slots); enable_fds(total_slots); - for (pass=1; pass <=2 ; pass++) { + for (pass = 1; pass <= 2; pass++) { struct mddev_dev *moved_disk = NULL; /* the disk that was moved out of the insert point */ - for (dnum=0, raid_disk_num=0, dv = devlist ; dv ; - dv=(dv->next)?(dv->next):moved_disk, dnum++) { + for (dnum = 0, raid_disk_num = 0, dv = devlist; dv; + dv = (dv->next) ? (dv->next) : moved_disk, dnum++) { int fd; struct stat stb; struct mdinfo *inf = &infos[dnum]; @@ -867,7 +865,7 @@ int Create(struct supertype *st, char *m moved_disk = dv; continue; } - if (strcasecmp(dv->devname, "missing")==0) { + if (strcasecmp(dv->devname, "missing") == 0) { raid_disk_num += 1; continue; }