From aba69144fd44fc261c943b0cec540751cfcd29bd Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Fri, 14 Dec 2007 20:13:43 +1100 Subject: [PATCH] Remove spaces/tabs from ends of lines. --- Assemble.c | 6 ++--- Build.c | 7 +++--- Create.c | 6 ++--- Detail.c | 12 +++++----- Examine.c | 2 +- Grow.c | 8 +++---- Kill.c | 2 +- Manage.c | 12 +++++----- Monitor.c | 18 +++++++-------- Query.c | 13 +++++------ ReadMe.c | 2 +- bitmap.c | 6 ++--- bitmap.h | 4 ++-- config.c | 14 ++++++------ md_p.h | 10 ++++---- md_u.h | 8 +++---- mdadm.c | 28 +++++++++++------------ mdadm.h | 2 +- mdopen.c | 2 +- mdstat.c | 4 ++-- raid5extend.c | 2 +- super0.c | 14 ++++++------ util.c | 63 ++++++++++++++++++++++++--------------------------- 23 files changed, 120 insertions(+), 125 deletions(-) diff --git a/Assemble.c b/Assemble.c index 0450a47e..7f673e06 100644 --- a/Assemble.c +++ b/Assemble.c @@ -230,7 +230,7 @@ int Assemble(struct supertype *st, char *mddev, int mdfd, free(super); super = NULL; } - + dfd = dev_open(devname, O_RDONLY|O_EXCL); if (dfd < 0) { if ((inargv && verbose >= 0) || verbose > 0) @@ -918,7 +918,7 @@ int Assemble(struct supertype *st, char *mddev, int mdfd, fprintf(stderr, Name ": no uptodate device for slot %d of %s\n", i, mddev); } - + if (runstop == 1 || (runstop <= 0 && ( enough(info.array.level, info.array.raid_disks, @@ -1026,7 +1026,7 @@ int Assemble(struct supertype *st, char *mddev, int mdfd, fprintf(stderr, Name ": Cannot start array: %s\n", strerror(errno)); } - + } if (must_close) close(mdfd); return 0; diff --git a/Build.c b/Build.c index 1de35966..d6e20fb8 100644 --- a/Build.c +++ b/Build.c @@ -114,7 +114,7 @@ int Build(char *mddev, int mdfd, int chunk, int level, int layout, vers = md_get_version(mdfd); - + /* looks Ok, go for it */ if (vers >= 9000) { mdu_array_info_t array; @@ -170,7 +170,7 @@ int Build(char *mddev, int mdfd, int chunk, int level, int layout, } fd = open(dv->devname, O_RDONLY|O_EXCL); if (fd < 0) { - fprintf(stderr, Name ": Cannot open %s: %s\n", + fprintf(stderr, Name ": Cannot open %s: %s\n", dv->devname, strerror(errno)); goto abort; } @@ -232,7 +232,7 @@ int Build(char *mddev, int mdfd, int chunk, int level, int layout, bitmap_file); return 1; } - } + } if (bitmap_fd >= 0) { if (ioctl(mdfd, SET_BITMAP_FILE, bitmap_fd) < 0) { fprintf(stderr, Name ": Cannot set bitmap file for %s: %s\n", @@ -273,5 +273,4 @@ int Build(char *mddev, int mdfd, int chunk, int level, int layout, else ioctl(mdfd, STOP_MD, 0); return 1; - } diff --git a/Create.c b/Create.c index 9cb8b78f..fec7567f 100644 --- a/Create.c +++ b/Create.c @@ -298,7 +298,7 @@ int Create(struct supertype *st, char *mddev, int mdfd, if (level > 0 || level == LEVEL_MULTIPATH || level == LEVEL_FAULTY) { /* size is meaningful */ if (minsize > 0x100000000ULL && st->ss->major == 0) { - fprintf(stderr, Name ": devices too large for RAID level %d\n", level); + fprintf(stderr, Name ": devices too large for RAID level %d\n", level); return 1; } size = minsize; @@ -348,7 +348,7 @@ int Create(struct supertype *st, char *mddev, int mdfd, Name ": This level does not support missing devices\n"); return 1; } - + /* Ok, lets try some ioctls */ array.level = level; @@ -467,7 +467,7 @@ int Create(struct supertype *st, char *mddev, int mdfd, inf.major_version = st->ss->major; inf.minor_version = st->minor_version; rv = ioctl(mdfd, SET_ARRAY_INFO, &inf); - } else + } else rv = ioctl(mdfd, SET_ARRAY_INFO, NULL); if (rv) { fprintf(stderr, Name ": SET_ARRAY_INFO failed for %s: %s\n", diff --git a/Detail.c b/Detail.c index 46d8ea01..22f0e5c0 100644 --- a/Detail.c +++ b/Detail.c @@ -233,7 +233,7 @@ int Detail(char *dev, int brief, int export, int test, char *homehost) break; default: break; } - + if (e && e->percent >= 0) { printf(" Re%s Status : %d%% complete\n", (super && info.reshape_active)? "shape":"build", @@ -301,7 +301,7 @@ This is pretty boring } if (disk.major == 0 && disk.minor == 0) continue; - if (disk.raid_disk >= 0 && disk.raid_disk < array.raid_disks) + if (disk.raid_disk >= 0 && disk.raid_disk < array.raid_disks) disks[disk.raid_disk] = disk; else if (next < max_disks) disks[next++] = disk; @@ -319,13 +319,13 @@ This is pretty boring if (!brief) { if (d == array.raid_disks) printf("\n"); if (disk.raid_disk < 0) - printf(" %5d %5d %5d - ", + printf(" %5d %5d %5d - ", disk.number, disk.major, disk.minor); else - printf(" %5d %5d %5d %5d ", + printf(" %5d %5d %5d %5d ", disk.number, disk.major, disk.minor, disk.raid_disk); - if (disk.state & (1<= 0) failed++; diff --git a/Examine.c b/Examine.c index a7bbbdbe..ba00270e 100644 --- a/Examine.c +++ b/Examine.c @@ -55,7 +55,7 @@ int Examine(mddev_dev_t devlist, int brief, int scan, * If (brief) gather devices for same array and just print a mdadm.conf line including devices= * if devlist==NULL, use conf_get_devs() */ - int fd; + int fd; void *super = NULL; int rv = 0; int err = 0; diff --git a/Grow.c b/Grow.c index aec7c56e..82533dee 100644 --- a/Grow.c +++ b/Grow.c @@ -52,7 +52,7 @@ int Grow_Add_device(char *devname, int fd, char *newdev) int nfd, fd2; int d, nd; struct supertype *st = NULL; - + if (ioctl(fd, GET_ARRAY_INFO, &info.array) < 0) { fprintf(stderr, Name ": cannot get array info for %s\n", devname); @@ -115,7 +115,7 @@ int Grow_Add_device(char *devname, int fd, char *newdev) /* Ok, looks good. Lets update the superblock and write it out to * newdev. */ - + info.disk.number = d; info.disk.major = major(stb.st_rdev); info.disk.minor = minor(stb.st_rdev); @@ -179,7 +179,7 @@ int Grow_Add_device(char *devname, int fd, char *newdev) st->ss->update_super(&info, super, "linear-grow-update", dv, 0, 0, NULL); - + if (st->ss->store_super(st, fd2, super)) { fprintf(stderr, Name ": Cannot store new superblock on %s\n", dv); close(fd2); @@ -816,7 +816,7 @@ int Grow_reshape(char *devname, int fd, int quiet, char *backup_file, break; sleep(1); } - + /* invalidate superblocks */ memset(&bsb, 0, sizeof(bsb)); for (i=odisks; i0) { if (ioctl(fd, STOP_ARRAY_RO, NULL)) { fprintf(stderr, Name ": failed to set readonly for %s: %s\n", @@ -69,7 +69,7 @@ int Manage_ro(char *devname, int fd, int readonly) return 1; } } - return 0; + return 0; } #ifndef MDASSEMBLE @@ -88,7 +88,7 @@ int Manage_runstop(char *devname, int fd, int runstop, int quiet) return 1; } } - + if (md_get_version(fd) < 9000) { fprintf(stderr, Name ": need md driver version 0.90.0 or later\n"); return 1; @@ -342,7 +342,7 @@ int Manage_subdevs(char *devname, int fd, } /* need to find a sample superblock to copy, and - * a spare slot to use + * a spare slot to use */ for (j=0; jmax_devs; j++) { char *dev; @@ -507,7 +507,7 @@ int Manage_subdevs(char *devname, int fd, } } return 0; - + } int autodetect(void) diff --git a/Monitor.c b/Monitor.c index 8bc3ecc4..d43e5531 100644 --- a/Monitor.c +++ b/Monitor.c @@ -38,7 +38,7 @@ static void alert(char *event, char *dev, char *disc, char *mailaddr, char *mailfrom, char *cmd, int dosyslog); -static char *percentalerts[] = { +static char *percentalerts[] = { "RebuildStarted", "Rebuild20", "Rebuild40", @@ -291,11 +291,11 @@ int Monitor(mddev_dev_t devlist, alert("DegradedArray", dev, NULL, mailaddr, mailfrom, alert_cmd, dosyslog); if (st->utime == 0 && /* new array */ - st->expected_spares > 0 && - array.spare_disks < st->expected_spares) + st->expected_spares > 0 && + array.spare_disks < st->expected_spares) alert("SparesMissing", dev, NULL, mailaddr, mailfrom, alert_cmd, dosyslog); if (mse && - st->percent == -1 && + st->percent == -1 && mse->percent >= 0) alert("RebuildStarted", dev, NULL, mailaddr, mailfrom, alert_cmd, dosyslog); if (mse && @@ -401,7 +401,7 @@ int Monitor(mddev_dev_t devlist, /* now check if there are any new devices found in mdstat */ if (scan) { struct mdstat_ent *mse; - for (mse=mdstat; mse; mse=mse->next) + for (mse=mdstat; mse; mse=mse->next) if (mse->devnum != INT_MAX && (strcmp(mse->level, "raid0")!=0 && strcmp(mse->level, "linear")!=0) @@ -467,7 +467,7 @@ int Monitor(mddev_dev_t devlist, } } if (dev > 0) { - if (ioctl(fd2, HOT_REMOVE_DISK, + if (ioctl(fd2, HOT_REMOVE_DISK, (unsigned long)dev) == 0) { if (ioctl(fd1, HOT_ADD_DISK, (unsigned long)dev) == 0) { @@ -504,7 +504,7 @@ static void alert(char *event, char *dev, char *disc, char *mailaddr, char *mail if (!cmd && !mailaddr) { time_t now = time(0); - + printf("%1.15s: %s on %s %s\n", ctime(&now)+4, event, dev, disc?disc:"unknown device"); } if (cmd) { @@ -520,8 +520,8 @@ static void alert(char *event, char *dev, char *disc, char *mailaddr, char *mail exit(2); } } - if (mailaddr && - (strncmp(event, "Fail", 4)==0 || + if (mailaddr && + (strncmp(event, "Fail", 4)==0 || strncmp(event, "Test", 4)==0 || strncmp(event, "Spares", 6)==0 || strncmp(event, "Degrade", 7)==0)) { diff --git a/Query.c b/Query.c index 4cfcf578..e1743ef3 100644 --- a/Query.c +++ b/Query.c @@ -34,7 +34,7 @@ int Query(char *dev) { /* Give a brief description of the device, - * whether it is an md device and whether it has + * whether it is an md device and whether it has * a superblock */ int fd = open(dev, O_RDONLY, 0); @@ -62,7 +62,7 @@ int Query(char *dev) if (ioctl(fd, GET_ARRAY_INFO, &array)<0) ioctlerr = errno; else ioctlerr = 0; - + fstat(fd, &stb); if (vers>=9000 && !ioctlerr) { @@ -70,7 +70,7 @@ int Query(char *dev) larray_size = 0; } - if (vers < 0) + if (vers < 0) printf("%s: is not an md array\n", dev); else if (vers < 9000) printf("%s: is an md device, but kernel cannot provide details\n", dev); @@ -91,7 +91,7 @@ int Query(char *dev) if (st) { superror = st->ss->load_super(st, fd, &super, dev); superrno = errno; - } else + } else superror = -1; close(fd); if (superror == 0) { @@ -102,7 +102,7 @@ int Query(char *dev) disc.number = info.disk.number; activity = "undetected"; if (mddev && (fd = open(mddev, O_RDONLY))>=0) { - if (md_get_version(fd) >= 9000 && + if (md_get_version(fd) >= 9000 && ioctl(fd, GET_ARRAY_INFO, &array)>= 0) { if (ioctl(fd, GET_DISK_INFO, &disc) >= 0 && makedev((unsigned)disc.major,(unsigned)disc.minor) == stb.st_rdev) @@ -117,7 +117,7 @@ int Query(char *dev) mddev = "array"; } printf("%s: device %d in %d device %s %s %s. Use mdadm --examine for more detail.\n", - dev, + dev, info.disk.number, info.array.raid_disks, activity, map_num(pers, info.array.level), @@ -128,4 +128,3 @@ int Query(char *dev) return 0; } - diff --git a/ReadMe.c b/ReadMe.c index d07ad798..cb3290e2 100644 --- a/ReadMe.c +++ b/ReadMe.c @@ -110,7 +110,7 @@ struct option long_options[] = { /* synonyms */ {"monitor", 0, 0, 'F'}, - + /* after those will normally come the name of the md device */ {"help", 0, 0, 'h'}, {"help-options",0,0,'h'}, diff --git a/bitmap.c b/bitmap.c index dcea2633..db2342bd 100644 --- a/bitmap.c +++ b/bitmap.c @@ -152,7 +152,7 @@ bitmap_info_t *bitmap_fd_read(int fd, int brief) skip = sizeof(info->sb); sb_le_to_cpu(&info->sb); /* convert superblock to CPU byte ordering */ - + if (brief || info->sb.sync_size == 0) goto out; @@ -219,7 +219,7 @@ bitmap_info_t *bitmap_file_read(char *filename, int brief, struct supertype **st if (!st) { /* just look at device... */ lseek(fd, 0, 0); - } else { + } else { st->ss->locate_bitmap(st, fd, NULL); } ioctl(fd, BLKFLSBUF, 0); /* make sure we read current data */ @@ -398,7 +398,7 @@ int CreateBitmap(char *filename, int force, char uuid[16], } bytes -= sizeof(block); } - + rv = 0; fflush(fp); /* make the file be the right size (well, to the nearest byte) */ diff --git a/bitmap.h b/bitmap.h index 055661d1..c8725a30 100644 --- a/bitmap.h +++ b/bitmap.h @@ -162,7 +162,7 @@ typedef struct bitmap_super_s { * (1) This event counter is updated before the eventcounter in the md superblock * When a bitmap is loaded, it is only accepted if this event counter is equal * to, or one greater than, the event counter in the superblock. - * (2) This event counter is updated when the other one is *if*and*only*if* the + * (2) This event counter is updated when the other one is *if*and*only*if* the * array is not degraded. As bits are not cleared when the array is degraded, * this represents the last time that any bits were cleared. * If a device is being added that has an event count with this value or @@ -187,7 +187,7 @@ struct bitmap_page { unsigned int hijacked; /* * count of dirty bits on the page - */ + */ int count; }; diff --git a/config.c b/config.c index 68c1507e..29eadc59 100644 --- a/config.c +++ b/config.c @@ -100,7 +100,7 @@ int match_keyword(char *word) { int len = strlen(word); int n; - + if (len < 3) return -1; for (n=0; keywords[n]; n++) { if (strncasecmp(word, keywords[n], len)==0) @@ -173,7 +173,7 @@ char *conf_word(FILE *file, int allow_key) } return word; } - + /* * conf_line reads one logical line from the conffile. * It skips comments and continues until it finds a line that starts @@ -237,7 +237,7 @@ mddev_dev_t load_partitions(void) if (buf[0] != ' ') continue; major = strtoul(buf, &mp, 10); - if (mp == buf || *mp != ' ') + if (mp == buf || *mp != ' ') continue; minor = strtoul(mp, NULL, 10); @@ -379,7 +379,7 @@ static void createline(char *line) } } -void devline(char *line) +void devline(char *line) { char *w; struct conf_dev *cd; @@ -494,7 +494,7 @@ void arrayline(char *line) } else if (strncasecmp(w, "metadata=", 9) == 0) { /* style of metadata on the devices. */ int i; - + for(i=0; superlist[i] && !mis.st; i++) mis.st = superlist[i]->match_metadata_desc(w+9); @@ -657,7 +657,7 @@ void load_conffile(void) } free_line(line); } - + fclose(f); /* printf("got file\n"); */ @@ -717,7 +717,7 @@ mddev_dev_t conf_get_devs() free(t->devname); free(t); } - + load_conffile(); if (cdevlist == NULL) diff --git a/md_p.h b/md_p.h index ed2e5fd9..a9f0204c 100644 --- a/md_p.h +++ b/md_p.h @@ -1,15 +1,15 @@ /* md_p.h : physical layout of Linux RAID devices Copyright (C) 1996-98 Ingo Molnar, Gadi Oxman - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. - + You should have received a copy of the GNU General Public License (for example /usr/src/linux/COPYING); if not, write to the Free - Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef _MD_P_H @@ -80,7 +80,7 @@ #define MD_DISK_REMOVED 3 /* disk is in sync with the raid set */ #define MD_DISK_WRITEMOSTLY 9 /* disk is "write-mostly" is RAID1 config. - * read requests will only be sent here in + * read requests will only be sent here in * dire need */ @@ -190,5 +190,5 @@ static inline __u64 md_event(mdp_super_t *sb) { return (ev<<32)| sb->events_lo; } -#endif +#endif diff --git a/md_u.h b/md_u.h index 6b067c6a..a874cec1 100644 --- a/md_u.h +++ b/md_u.h @@ -1,15 +1,15 @@ /* md_u.h : user <=> kernel API between Linux raidtools and RAID drivers Copyright (C) 1998 Ingo Molnar - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. - + You should have received a copy of the GNU General Public License (for example /usr/src/linux/COPYING); if not, write to the Free - Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef _MD_U_H @@ -119,5 +119,5 @@ typedef struct mdu_param_s int max_fault; /* unused for now */ } mdu_param_t; -#endif +#endif diff --git a/mdadm.c b/mdadm.c index 40fdccf7..b4b503dd 100644 --- a/mdadm.c +++ b/mdadm.c @@ -26,7 +26,7 @@ * Sydney, 2052 * Australia * - * Additions for bitmap and write-behind RAID options, Copyright (C) 2003-2004, + * Additions for bitmap and write-behind RAID options, Copyright (C) 2003-2004, * Paul Clements, SteelEye Technology, Inc. */ @@ -133,7 +133,7 @@ int main(int argc, char *argv[]) /* firstly, some mode-independant options */ switch(opt) { case 'h': - if (option_index > 0 && + if (option_index > 0 && strcmp(long_options[option_index].name, "help-options")==0) print_help = 2; else @@ -174,7 +174,7 @@ int main(int argc, char *argv[]) } /* second, figure out the mode. * Some options force the mode. Others - * set the mode if it isn't already + * set the mode if it isn't already */ switch(opt) { @@ -232,7 +232,7 @@ int main(int argc, char *argv[]) mode = newmode; } else { /* special case of -c --help */ - if (opt == 'c' && + if (opt == 'c' && ( strncmp(optarg, "--h", 3)==0 || strncmp(optarg, "-h", 2)==0)) { fputs(Help_config, stdout); @@ -255,7 +255,7 @@ int main(int argc, char *argv[]) dv->next = NULL; *devlistend = dv; devlistend = &dv->next; - + devs_found++; continue; } @@ -307,7 +307,7 @@ int main(int argc, char *argv[]) dv->next = NULL; *devlistend = dv; devlistend = &dv->next; - + devs_found++; continue; } @@ -342,7 +342,7 @@ int main(int argc, char *argv[]) fprintf(stderr, Name ": metadata information already given\n"); exit(2); } - for(i=0; !ss && superlist[i]; i++) + for(i=0; !ss && superlist[i]; i++) ss = superlist[i]->match_metadata_desc(optarg); if (!ss) { @@ -451,7 +451,7 @@ int main(int argc, char *argv[]) case -5: /* Faulty * modeNNN */ - + { int ln = strcspn(optarg, "0123456789"); char *m = strdup(optarg); @@ -584,7 +584,7 @@ int main(int argc, char *argv[]) exit(2); } update = optarg; - if (strcmp(update, "sparc2.2")==0) + if (strcmp(update, "sparc2.2")==0) continue; if (strcmp(update, "super-minor") == 0) continue; @@ -605,7 +605,7 @@ int main(int argc, char *argv[]) fprintf(stderr, Name ": must not set metadata type with --update=byteorder.\n"); exit(2); } - for(i=0; !ss && superlist[i]; i++) + for(i=0; !ss && superlist[i]; i++) ss = superlist[i]->match_metadata_desc("0.swap"); if (!ss) { fprintf(stderr, Name ": INTERNAL ERROR cannot find 0.swap\n"); @@ -941,7 +941,7 @@ int main(int argc, char *argv[]) exit(2); } if ((int)ident.super_minor == -2 && autof) { - fprintf(stderr, Name ": --super-minor=dev is incompatible with --auto\n"); + fprintf(stderr, Name ": --super-minor=dev is incompatible with --auto\n"); exit(2); } if (mode == MANAGE || mode == GROW) @@ -1010,7 +1010,7 @@ int main(int argc, char *argv[]) devlist->devname); rv |= 1; } else { - mdfd = open_mddev(devlist->devname, + mdfd = open_mddev(devlist->devname, array_ident->autof ? array_ident->autof : autof); if (mdfd < 0) rv |= 1; @@ -1042,7 +1042,7 @@ int main(int argc, char *argv[]) rv |= 1; continue; } - mdfd = open_mddev(dv->devname, + mdfd = open_mddev(dv->devname, array_ident->autof ?array_ident->autof : autof); if (mdfd < 0) { rv |= 1; @@ -1310,7 +1310,7 @@ int main(int argc, char *argv[]) case GROW: if (devs_found > 1) { - + /* must be '-a'. */ if (size >= 0 || raiddisks) { fprintf(stderr, Name ": --size, --raiddisks, and --add are exclusing in --grow mode\n"); diff --git a/mdadm.h b/mdadm.h index dba09f0f..5e9eeee7 100644 --- a/mdadm.h +++ b/mdadm.h @@ -195,7 +195,7 @@ enum special_options { #define UnSet (0xfffe) typedef struct mddev_ident_s { char *devname; - + int uuid_set; int uuid[4]; char name[33]; diff --git a/mdopen.c b/mdopen.c index ebaba950..55252dc1 100644 --- a/mdopen.c +++ b/mdopen.c @@ -193,7 +193,7 @@ int open_mddev(char *dev, int autof) * If the device name is in a 'standard' format, * intuit the minor from that, else * easiest to read /proc/mdstat, and hunt through for - * an unused number + * an unused number */ if (num < 0) { /* need to pick an unused number */ diff --git a/mdstat.c b/mdstat.c index 335e1e58..a8f7ce75 100644 --- a/mdstat.c +++ b/mdstat.c @@ -161,7 +161,7 @@ struct mdstat_ent *mdstat_read(int hold, int start) ent->dev = strdup(line); ent->devnum = devnum; - + for (w=dl_next(line); w!= line ; w=dl_next(w)) { int l = strlen(w); char *eq; @@ -209,7 +209,7 @@ struct mdstat_ent *mdstat_read(int hold, int start) strncmp(w, "resync", 4)==0) { ent->resync = 1; } else if (ent->percent == -1 && - w[0] >= '0' && + w[0] >= '0' && w[0] <= '9' && w[l-1] == '%') { ent->percent = atoi(w); diff --git a/raid5extend.c b/raid5extend.c index 98615a69..d8e62c2c 100644 --- a/raid5extend.c +++ b/raid5extend.c @@ -52,7 +52,7 @@ raid5_extend(unsigned long len, int chunksize, int layout, int n, int m, int rfd unsigned int blocksperchunk= chunksize/4096; unsigned long b; - + for (b=0; bnr_disks = sb->active_disks = sb->working_disks = sb->failed_disks = sb->spare_disks = 0; - for (i=0; i < MD_SB_DISKS ; i++) + for (i=0; i < MD_SB_DISKS ; i++) if (sb->disks[i].major || sb->disks[i].minor) { int state = sb->disks[i].state; @@ -727,7 +727,7 @@ static int load_super0(struct supertype *st, int fd, void **sbp, char *devname) mdp_super_t *super; int uuid[4]; struct bitmap_super_s *bsb; - + if (!get_dev_size(fd, devname, &dsize)) return 1; @@ -910,7 +910,7 @@ int write_bitmap0(struct supertype *st, int fd, void *sbv) unsigned long long dsize; unsigned long long offset; mdp_super_t *sb = sbv; - + int rv = 0; int towrite, n; @@ -938,7 +938,7 @@ int write_bitmap0(struct supertype *st, int fd, void *sbv) memset(buf, 0xff, sizeof(buf)); while (towrite > 0) { n = towrite; - if (n > sizeof(buf)) + if (n > sizeof(buf)) n = sizeof(buf); n = write(fd, buf, n); if (n > 0) diff --git a/util.c b/util.c index f57613f5..4a751aaf 100644 --- a/util.c +++ b/util.c @@ -73,33 +73,32 @@ struct blkpg_partition { */ int parse_uuid(char *str, int uuid[4]) { - int hit = 0; /* number of Hex digIT */ - int i; - char c; - for (i=0; i<4; i++) uuid[i]=0; - - while ((c= *str++)) { - int n; - if (c>='0' && c<='9') - n = c-'0'; - else if (c>='a' && c <= 'f') - n = 10 + c - 'a'; - else if (c>='A' && c <= 'F') - n = 10 + c - 'A'; - else if (strchr(":. -", c)) - continue; - else return 0; - - if (hit<32) { - uuid[hit/8] <<= 4; - uuid[hit/8] += n; + int hit = 0; /* number of Hex digIT */ + int i; + char c; + for (i=0; i<4; i++) uuid[i]=0; + + while ((c= *str++)) { + int n; + if (c>='0' && c<='9') + n = c-'0'; + else if (c>='a' && c <= 'f') + n = 10 + c - 'a'; + else if (c>='A' && c <= 'F') + n = 10 + c - 'A'; + else if (strchr(":. -", c)) + continue; + else return 0; + + if (hit<32) { + uuid[hit/8] <<= 4; + uuid[hit/8] += n; + } + hit++; } - hit++; - } - if (hit == 32) - return 1; - return 0; - + if (hit == 32) + return 1; + return 0; } @@ -132,7 +131,6 @@ int md_get_version(int fd) return -1; } - int get_linux_version() { struct utsname name; @@ -224,7 +222,7 @@ int same_uuid(int a[4], int b[4], int swapuuid) if (swapuuid) { /* parse uuids are hostendian. * uuid's from some superblocks are big-ending - * if there is a difference, we need to swap.. + * if there is a difference, we need to swap.. */ unsigned char *ac = (unsigned char *)a; unsigned char *bc = (unsigned char *)b; @@ -318,7 +316,7 @@ int check_reiser(int fd, char *name) fprintf(stderr, Name ": %s appears to contain a reiserfs file system\n",name); size = sb[0]|(sb[1]|(sb[2]|sb[3]<<8)<<8)<<8; fprintf(stderr, " size = %luK\n", size*4); - + return 1; } @@ -391,7 +389,7 @@ int is_standard(char *dev, int *nump) { /* tests if dev is a "standard" md dev name. * i.e if the last component is "/dNN" or "/mdNN", - * where NN is a string of digits + * where NN is a string of digits */ char *d = strrchr(dev, '/'); int type=0; @@ -546,7 +544,7 @@ unsigned long calc_csum(void *super, int bytes) newcsum+= superc[i]; csum = (newcsum& 0xffffffff) + (newcsum>>32); #ifdef __alpha__ -/* The in-kernel checksum calculation is always 16bit on +/* The in-kernel checksum calculation is always 16bit on * the alpha, though it is 32 bit on i386... * I wonder what it is elsewhere... (it uses and API in * a way that it shouldn't). @@ -592,7 +590,6 @@ char *human_size(long long bytes) char *human_size_brief(long long bytes) { static char buf[30]; - if (bytes < 5000*1024) snprintf(buf, sizeof(buf), "%ld.%02ldKiB", @@ -753,7 +750,7 @@ struct supertype *guess_super(int fd) struct supertype *st; unsigned long besttime = 0; int bestsuper = -1; - + void *sbp = NULL; int i; -- 2.39.2