diff --git a/Create.c b/Create.c index d6dcdbf..afcf1a5 100644 --- a/Create.c +++ b/Create.c @@ -655,7 +655,7 @@ int Create(struct supertype *st, char *mddev, * including spares * failed_disks is the number of disks marked failed * - * Ideally, the kernel would keep these (except raid_disks) + * Ideally, the kernel would keep these (except raid_disks) * up-to-date as we ADD_NEW_DISK, but it doesn't (yet). * So for now, we assume that all raid and spare * devices will be given. diff --git a/ReadMe.c b/ReadMe.c index def75ec..2fde2ac 100644 --- a/ReadMe.c +++ b/ReadMe.c @@ -71,9 +71,9 @@ char Version[] = Name " - v3.2.5 - 18th May 2012\n"; char short_options[]="-ABCDEFGIQhVXYWZ:vqbc:i:l:p:m:n:x:u:c:d:z:U:N:sarfRSow1tye:"; char short_bitmap_options[]= - "-ABCDEFGIQhVXYWZ:vqb:c:i:l:p:m:n:x:u:c:d:z:U:N:sarfRSow1tye:"; + "-ABCDEFGIQhVXYWZ:vqb:c:i:l:p:m:n:x:u:c:d:z:U:N:sarfRSow1tye:"; char short_bitmap_auto_options[]= - "-ABCDEFGIQhVXYWZ:vqb:c:i:l:p:m:n:x:u:c:d:z:U:N:sa:rfRSow1tye:"; + "-ABCDEFGIQhVXYWZ:vqb:c:i:l:p:m:n:x:u:c:d:z:U:N:sa:rfRSow1tye:"; struct option long_options[] = { {"manage", 0, 0, ManageOpt}, diff --git a/config.c b/config.c index 9875d3e..656d4e2 100644 --- a/config.c +++ b/config.c @@ -149,8 +149,8 @@ void free_line(char *line) struct conf_dev { - struct conf_dev *next; - char *name; + struct conf_dev *next; + char *name; } *cdevlist = NULL; struct mddev_dev *load_partitions(void) @@ -940,26 +940,26 @@ int conf_test_metadata(const char *version, struct dev_policy *pol, int is_homeh int match_oneof(char *devices, char *devname) { - /* check if one of the comma separated patterns in devices - * matches devname - */ + /* check if one of the comma separated patterns in devices + * matches devname + */ - while (devices && *devices) { - char patn[1024]; - char *p = devices; - devices = strchr(devices, ','); - if (!devices) - devices = p + strlen(p); - if (devices-p < 1024) { - strncpy(patn, p, devices-p); - patn[devices-p] = 0; - if (fnmatch(patn, devname, FNM_PATHNAME)==0) - return 1; + while (devices && *devices) { + char patn[1024]; + char *p = devices; + devices = strchr(devices, ','); + if (!devices) + devices = p + strlen(p); + if (devices-p < 1024) { + strncpy(patn, p, devices-p); + patn[devices-p] = 0; + if (fnmatch(patn, devname, FNM_PATHNAME)==0) + return 1; + } + if (*devices == ',') + devices++; } - if (*devices == ',') - devices++; - } - return 0; + return 0; } int devname_matches(char *name, char *match) diff --git a/lib.c b/lib.c index dc32c56..1c85654 100644 --- a/lib.c +++ b/lib.c @@ -133,9 +133,9 @@ int fd2devnum(int fd) * Put them in a simple linked listfor now. */ struct devmap { - int major, minor; - char *name; - struct devmap *next; + int major, minor; + char *name; + struct devmap *next; } *devlist = NULL; int devlist_ready = 0; diff --git a/platform-intel.c b/platform-intel.c index d6698c7..0dcf07c 100644 --- a/platform-intel.c +++ b/platform-intel.c @@ -297,7 +297,7 @@ static const struct imsm_orom *find_imsm_hba_orom(enum sys_dev_type hba_id) } if (check_env("IMSM_TEST_OROM")) { dprintf("OROM CAP: %p, pid: %d pop: %d\n", - &imsm_orom[hba_id], (int) getpid(), populated_orom[hba_id]); + &imsm_orom[hba_id], (int) getpid(), populated_orom[hba_id]); return imsm_platform_test(hba_id, &populated_orom[hba_id], &imsm_orom[hba_id]); } /* return empty OROM capabilities in EFI test mode */ @@ -381,7 +381,7 @@ int read_efi_variable(void *buffer, ssize_t buf_size, char *variable_name, struc errno = 0; var_data_len = strtoul(buf, NULL, 16); if ((errno == ERANGE && (var_data_len == LONG_MAX)) - || (errno != 0 && var_data_len == 0)) + || (errno != 0 && var_data_len == 0)) return 1; /* get data */ diff --git a/policy.c b/policy.c index 8ee6a6c..c3de692 100644 --- a/policy.c +++ b/policy.c @@ -791,13 +791,13 @@ char udev_template_start[] = /* find rule named rule_type and return its value */ char *find_rule(struct rule *rule, char *rule_type) { - while (rule) { - if (rule->name == rule_type) - return rule->value; + while (rule) { + if (rule->name == rule_type) + return rule->value; - rule = rule->next; - } - return NULL; + rule = rule->next; + } + return NULL; } #define UDEV_RULE_FORMAT \ @@ -834,44 +834,44 @@ int write_rule(struct rule *rule, int fd, int force_part) */ int generate_entries(int fd) { - struct pol_rule *loop, *dup; - char *loop_value, *dup_value; - int duplicate; + struct pol_rule *loop, *dup; + char *loop_value, *dup_value; + int duplicate; - for (loop = config_rules; loop; loop = loop->next) { - if (loop->type != rule_policy && loop->type != rule_part) - continue; - duplicate = 0; + for (loop = config_rules; loop; loop = loop->next) { + if (loop->type != rule_policy && loop->type != rule_part) + continue; + duplicate = 0; - /* only policies with paths and with actions supporting - * bare disks are considered */ - loop_value = find_rule(loop->rule, pol_act); - if (!loop_value || map_act(loop_value) < act_spare_same_slot) - continue; - loop_value = find_rule(loop->rule, rule_path); - if (!loop_value) - continue; - for (dup = config_rules; dup != loop; dup = dup->next) { - if (dup->type != rule_policy && loop->type != rule_part) - continue; - dup_value = find_rule(dup->rule, pol_act); - if (!dup_value || map_act(dup_value) < act_spare_same_slot) - continue; - dup_value = find_rule(dup->rule, rule_path); - if (!dup_value) - continue; - if (strcmp(loop_value, dup_value) == 0) { - duplicate = 1; - break; - } - } + /* only policies with paths and with actions supporting + * bare disks are considered */ + loop_value = find_rule(loop->rule, pol_act); + if (!loop_value || map_act(loop_value) < act_spare_same_slot) + continue; + loop_value = find_rule(loop->rule, rule_path); + if (!loop_value) + continue; + for (dup = config_rules; dup != loop; dup = dup->next) { + if (dup->type != rule_policy && loop->type != rule_part) + continue; + dup_value = find_rule(dup->rule, pol_act); + if (!dup_value || map_act(dup_value) < act_spare_same_slot) + continue; + dup_value = find_rule(dup->rule, rule_path); + if (!dup_value) + continue; + if (strcmp(loop_value, dup_value) == 0) { + duplicate = 1; + break; + } + } - /* not a dup or first occurrence */ - if (!duplicate) - if (!write_rule(loop->rule, fd, loop->type == rule_part) ) - return 0; - } - return 1; + /* not a dup or first occurrence */ + if (!duplicate) + if (!write_rule(loop->rule, fd, loop->type == rule_part) ) + return 0; + } + return 1; } /* Write_rules routine creates dynamic udev rules used to handle @@ -879,40 +879,40 @@ int generate_entries(int fd) */ int Write_rules(char *rule_name) { - int fd; - char udev_rule_file[PATH_MAX]; + int fd; + char udev_rule_file[PATH_MAX]; - if (rule_name) { - strncpy(udev_rule_file, rule_name, sizeof(udev_rule_file) - 6); - udev_rule_file[sizeof(udev_rule_file) - 6] = '\0'; - strcat(udev_rule_file, ".temp"); - fd = creat(udev_rule_file, - S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); - if (fd == -1) - return 1; - } else - fd = 1; + if (rule_name) { + strncpy(udev_rule_file, rule_name, sizeof(udev_rule_file) - 6); + udev_rule_file[sizeof(udev_rule_file) - 6] = '\0'; + strcat(udev_rule_file, ".temp"); + fd = creat(udev_rule_file, + S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); + if (fd == -1) + return 1; + } else + fd = 1; - /* write static invocation */ - if (write(fd, udev_template_start, - sizeof(udev_template_start) - 1) - != (int)sizeof(udev_template_start)-1) - goto abort; + /* write static invocation */ + if (write(fd, udev_template_start, + sizeof(udev_template_start) - 1) + != (int)sizeof(udev_template_start)-1) + goto abort; - /* iterate, if none created or error occurred, remove file */ - if (generate_entries(fd) < 0) - goto abort; + /* iterate, if none created or error occurred, remove file */ + if (generate_entries(fd) < 0) + goto abort; - fsync(fd); - if (rule_name) { - close(fd); - rename(udev_rule_file, rule_name); - } - return 0; + fsync(fd); + if (rule_name) { + close(fd); + rename(udev_rule_file, rule_name); + } + return 0; abort: - if (rule_name) { - close(fd); - unlink(udev_rule_file); - } - return 1; + if (rule_name) { + close(fd); + unlink(udev_rule_file); + } + return 1; } diff --git a/super-ddf.c b/super-ddf.c index 4a6f623..3b3c1f0 100644 --- a/super-ddf.c +++ b/super-ddf.c @@ -3189,8 +3189,8 @@ static int ddf_set_array_state(struct active_array *a, int consistent) } #define container_of(ptr, type, member) ({ \ - const typeof( ((type *)0)->member ) *__mptr = (ptr); \ - (type *)( (char *)__mptr - offsetof(type,member) );}) + const typeof( ((type *)0)->member ) *__mptr = (ptr); \ + (type *)( (char *)__mptr - offsetof(type,member) );}) /* * The state of each disk is stored in the global phys_disk structure * in phys_disk.entries[n].state. diff --git a/super-intel.c b/super-intel.c index 80c0f8d..452fae4 100644 --- a/super-intel.c +++ b/super-intel.c @@ -685,12 +685,12 @@ static __u32 __gen_imsm_checksum(struct imsm_super *mpb) __u32 *p = (__u32 *) mpb; __u32 sum = 0; - while (end--) { - sum += __le32_to_cpu(*p); + while (end--) { + sum += __le32_to_cpu(*p); p++; } - return sum - __le32_to_cpu(mpb->check_sum); + return sum - __le32_to_cpu(mpb->check_sum); } static size_t sizeof_imsm_map(struct imsm_map *map) @@ -3062,11 +3062,11 @@ static int compare_super_imsm(struct supertype *st, struct supertype *tst) struct intel_super *first = st->sb; struct intel_super *sec = tst->sb; - if (!first) { - st->sb = tst->sb; - tst->sb = NULL; - return 0; - } + if (!first) { + st->sb = tst->sb; + tst->sb = NULL; + return 0; + } /* in platform dependent environment test if the disks * use the same Intel hba */ @@ -5850,7 +5850,7 @@ validate_geometry_imsm_orom(struct intel_super *super, int level, int layout, return 0; } - /* capabilities of OROM tested - copied from validate_geometry_imsm_volume */ + /* capabilities of OROM tested - copied from validate_geometry_imsm_volume */ if (!is_raid_level_supported(super->orom, level, raiddisks)) { pr_vrb(": platform does not support raid%d with %d disk%s\n", level, raiddisks, raiddisks > 1 ? "s" : ""); diff --git a/super1.c b/super1.c index d6b69fb..9993386 100644 --- a/super1.c +++ b/super1.c @@ -71,7 +71,7 @@ struct mdp_superblock_1 { __u32 dev_number; /* permanent identifier of this device - not role in raid */ __u32 cnt_corrected_read; /* number of read errors that were corrected by re-writing */ __u8 device_uuid[16]; /* user-space setable, ignored by kernel */ - __u8 devflags; /* per-device flags. Only one defined...*/ + __u8 devflags; /* per-device flags. Only one defined...*/ #define WriteMostly1 1 /* mask for writemostly flag in above */ /* bad block log. If there are any bad blocks the feature flag is set. * if offset and size are non-zero, that space is reserved and available. diff --git a/util.c b/util.c index 5e653f4..687a2ce 100644 --- a/util.c +++ b/util.c @@ -43,10 +43,10 @@ int __offroot; /* The argument structure */ struct blkpg_ioctl_arg { - int op; - int flags; - int datalen; - void *data; + int op; + int flags; + int datalen; + void *data; }; /* The subfunctions (for the op field) */ @@ -127,21 +127,21 @@ int parse_uuid(char *str, int uuid[4]) int md_get_version(int fd) { - struct stat stb; - mdu_version_t vers; + struct stat stb; + mdu_version_t vers; - if (fstat(fd, &stb)<0) - return -1; - if ((S_IFMT&stb.st_mode) != S_IFBLK) - return -1; + if (fstat(fd, &stb)<0) + return -1; + if ((S_IFMT&stb.st_mode) != S_IFBLK) + return -1; - if (ioctl(fd, RAID_VERSION, &vers) == 0) - return (vers.major*10000) + (vers.minor*100) + vers.patchlevel; - if (errno == EACCES) - return -1; - if (major(stb.st_rdev) == MD_MAJOR) - return (3600); - return -1; + if (ioctl(fd, RAID_VERSION, &vers) == 0) + return (vers.major*10000) + (vers.minor*100) + vers.patchlevel; + if (errno == EACCES) + return -1; + if (major(stb.st_rdev) == MD_MAJOR) + return (3600); + return -1; } int get_linux_version()