diff options
author | NeilBrown <neilb@suse.de> | 2011-02-01 15:48:03 +1100 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2011-02-01 15:48:03 +1100 |
commit | 71204a50293035e5e7eb4807285ac0181c69e4f3 (patch) | |
tree | 0f889f9a6639e734180693242d0d84b80964bb77 | |
parent | 87eb4fabe316461cd1ad1600d41a81cd29882961 (diff) | |
download | mdadm-71204a50293035e5e7eb4807285ac0181c69e4f3.tar.gz |
Various compile fixes.
Make "make everything" succeed.
This fixed some real bugs.
Signed-off-by: NeilBrown <neilb@suse.de>
-rw-r--r-- | Assemble.c | 2 | ||||
-rw-r--r-- | Incremental.c | 9 | ||||
-rw-r--r-- | Monitor.c | 3 | ||||
-rw-r--r-- | mapfile.c | 2 | ||||
-rw-r--r-- | mdassemble.c | 2 | ||||
-rw-r--r-- | super-gpt.c | 2 | ||||
-rw-r--r-- | super-intel.c | 17 | ||||
-rw-r--r-- | super-mbr.c | 2 | ||||
-rw-r--r-- | util.c | 2 |
9 files changed, 24 insertions, 17 deletions
@@ -330,11 +330,13 @@ int Assemble(struct supertype *st, char *mddev, fprintf(stderr, Name ": %s is a container, but we are looking for components\n", devname); tmpdev->used = 2; +#if !defined(MDASSEMBLE) || defined(MDASSEMBLE) && defined(MDASSEMBLE_AUTO) } if (!tst && (tst = super_by_fd(dfd, NULL)) == NULL) { if (report_missmatch) fprintf(stderr, Name ": not a recognisable container: %s\n", devname); tmpdev->used = 2; +#endif } else if (!tst->ss->load_container || tst->ss->load_container(tst, dfd, NULL)) { if (report_missmatch) diff --git a/Incremental.c b/Incremental.c index 52558e4..889184f 100644 --- a/Incremental.c +++ b/Incremental.c @@ -883,7 +883,7 @@ static int array_try_spare(char *devname, int *dfdp, struct dev_policy *pol, struct domainlist *dl = NULL; struct mdinfo *sra; unsigned long long devsize; - unsigned long long component_size; + unsigned long long component_size = 0; if (is_subarray(mp->metadata)) continue; @@ -1077,7 +1077,7 @@ static int partition_try_spare(char *devname, int *dfdp, struct dev_policy *pol, DIR *dir; struct dirent *de; char *chosen = NULL; - unsigned long long chosen_size; + unsigned long long chosen_size = 0; struct supertype *chosen_st = NULL; int fd; @@ -1118,7 +1118,10 @@ static int partition_try_spare(char *devname, int *dfdp, struct dev_policy *pol, domain_free(domlist); domlist = NULL; - asprintf(&devname, "/dev/disk/by-path/%s", de->d_name); + if (asprintf(&devname, "/dev/disk/by-path/%s", de->d_name) != 1) { + devname = NULL; + goto next; + } fd = open(devname, O_RDONLY); if (fd < 0) goto next; @@ -291,7 +291,8 @@ static int check_one_sharer(int scan) struct stat buf; fp = fopen("/var/run/mdadm/autorebuild.pid", "r"); if (fp) { - fscanf(fp, "%d", &pid); + if (fscanf(fp, "%d", &pid) != 1) + pid = -1; sprintf(dir, "/proc/%d", pid); rv = stat(dir, &buf); if (rv != -1) { @@ -380,7 +380,7 @@ void RebuildMap(void) int dfd; int ok; struct supertype *st; - char *subarray; + char *subarray = NULL; char *path; struct mdinfo *info; diff --git a/mdassemble.c b/mdassemble.c index 28f431b..a8b78ce 100644 --- a/mdassemble.c +++ b/mdassemble.c @@ -105,7 +105,7 @@ int main(int argc, char *argv[]) { if (mdfd >= 0) close(mdfd); rv |= Assemble(array_list->st, array_list->devname, - array_list, NULL, NULL, + array_list, NULL, NULL, 0, readonly, runstop, NULL, NULL, 0, verbose, force); } diff --git a/super-gpt.c b/super-gpt.c index e70a6fa..f60a671 100644 --- a/super-gpt.c +++ b/super-gpt.c @@ -205,8 +205,8 @@ static int validate_geometry(struct supertype *st, int level, struct superswitch gpt = { #ifndef MDASSEMBLE .examine_super = examine_gpt, -#endif .validate_geometry = validate_geometry, +#endif .match_metadata_desc = match_metadata_desc, .load_super = load_gpt, .store_super = store_gpt, diff --git a/super-intel.c b/super-intel.c index 5d39d5b..84ab47b 100644 --- a/super-intel.c +++ b/super-intel.c @@ -384,6 +384,7 @@ const char *get_sys_dev_type(enum sys_dev_type type) return _sys_dev_type[type]; } +#ifndef MDASSEMBLE static struct intel_hba * alloc_intel_hba(struct sys_dev *device) { struct intel_hba *result = malloc(sizeof(*result)); @@ -408,7 +409,6 @@ static struct intel_hba * find_intel_hba(struct intel_hba *hba, struct sys_dev * } - static int attach_hba_to_super(struct intel_super *super, struct sys_dev *device, const char *devname) { @@ -475,6 +475,7 @@ static struct sys_dev* find_disk_attached_hba(int fd, const char *devname) return NULL; } +#endif /* MDASSEMBLE */ static struct supertype *match_metadata_desc_imsm(char *arg) @@ -4646,7 +4647,6 @@ static int update_subarray_imsm(struct supertype *st, char *subarray, return 0; } -#endif /* MDASSEMBLE */ static int is_gen_migration(struct imsm_dev *dev) { @@ -4658,6 +4658,7 @@ static int is_gen_migration(struct imsm_dev *dev) return 0; } +#endif /* MDASSEMBLE */ static int is_rebuilding(struct imsm_dev *dev) { @@ -6639,7 +6640,6 @@ static void imsm_delete(struct intel_super *super, struct dl **dlp, unsigned ind __free_imsm_disk(dl); } } -#endif /* MDASSEMBLE */ static char disk_by_path[] = "/dev/disk/by-path/"; @@ -7066,7 +7066,7 @@ static int imsm_reshape_super(struct supertype *st, long long size, int level, dprintf("imsm: reshape_super called.\n"); - memset(&geo, sizeof(struct geo_params), 0); + memset(&geo, 0, sizeof(struct geo_params)); geo.dev_name = dev; geo.dev_id = st->devnum; @@ -7167,6 +7167,7 @@ static int imsm_manage_reshape( afd, sra, reshape, st, stripes, fds, offsets, dests, destfd, destoffsets); } +#endif /* MDASSEMBLE */ struct superswitch super_imsm = { #ifndef MDASSEMBLE @@ -7184,6 +7185,10 @@ struct superswitch super_imsm = { .kill_subarray = kill_subarray_imsm, .update_subarray = update_subarray_imsm, .load_container = load_container_imsm, + .default_geometry = default_geometry_imsm, + .get_disk_controller_domain = imsm_get_disk_controller_domain, + .reshape_super = imsm_reshape_super, + .manage_reshape = imsm_manage_reshape, #endif .match_home = match_home_imsm, .uuid_from_super= uuid_from_super_imsm, @@ -7202,10 +7207,6 @@ struct superswitch super_imsm = { .free_super = free_super_imsm, .match_metadata_desc = match_metadata_desc_imsm, .container_content = container_content_imsm, - .default_geometry = default_geometry_imsm, - .get_disk_controller_domain = imsm_get_disk_controller_domain, - .reshape_super = imsm_reshape_super, - .manage_reshape = imsm_manage_reshape, .external = 1, .name = "imsm", diff --git a/super-mbr.c b/super-mbr.c index 0129fd6..7d770aa 100644 --- a/super-mbr.c +++ b/super-mbr.c @@ -199,8 +199,8 @@ static int validate_geometry(struct supertype *st, int level, struct superswitch mbr = { #ifndef MDASSEMBLE .examine_super = examine_mbr, -#endif .validate_geometry = validate_geometry, +#endif .match_metadata_desc = match_metadata_desc, .load_super = load_super_mbr, .store_super = store_mbr, @@ -160,6 +160,7 @@ int get_linux_version() return (a*1000000)+(b*1000)+c; } +#ifndef MDASSEMBLE int mdadm_version(char *version) { int a, b, c; @@ -185,7 +186,6 @@ int mdadm_version(char *version) return (a*1000000)+(b*1000)+c; } -#ifndef MDASSEMBLE long long parse_size(char *size) { /* parse 'size' which should be a number optionally |