Make "make everything" succeed.
This fixed some real bugs.
Signed-off-by: NeilBrown <neilb@suse.de>
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)
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;
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;
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;
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) {
int dfd;
int ok;
struct supertype *st;
- char *subarray;
+ char *subarray = NULL;
char *path;
struct mdinfo *info;
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);
}
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,
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));
}
-
static int attach_hba_to_super(struct intel_super *super, struct sys_dev *device,
const char *devname)
{
return NULL;
}
+#endif /* MDASSEMBLE */
static struct supertype *match_metadata_desc_imsm(char *arg)
return 0;
}
-#endif /* MDASSEMBLE */
static int is_gen_migration(struct imsm_dev *dev)
{
return 0;
}
+#endif /* MDASSEMBLE */
static int is_rebuilding(struct imsm_dev *dev)
{
__free_imsm_disk(dl);
}
}
-#endif /* MDASSEMBLE */
static char disk_by_path[] = "/dev/disk/by-path/";
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;
afd, sra, reshape, st, stripes,
fds, offsets, dests, destfd, destoffsets);
}
+#endif /* MDASSEMBLE */
struct superswitch super_imsm = {
#ifndef MDASSEMBLE
.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,
.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",
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,
return (a*1000000)+(b*1000)+c;
}
+#ifndef MDASSEMBLE
int mdadm_version(char *version)
{
int a, b, c;
return (a*1000000)+(b*1000)+c;
}
-#ifndef MDASSEMBLE
long long parse_size(char *size)
{
/* parse 'size' which should be a number optionally