Various compile fixes.
Make "make everything" succeed. This fixed some real bugs. Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
parent
87eb4fabe3
commit
71204a5029
|
@ -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",
|
fprintf(stderr, Name ": %s is a container, but we are looking for components\n",
|
||||||
devname);
|
devname);
|
||||||
tmpdev->used = 2;
|
tmpdev->used = 2;
|
||||||
|
#if !defined(MDASSEMBLE) || defined(MDASSEMBLE) && defined(MDASSEMBLE_AUTO)
|
||||||
} if (!tst && (tst = super_by_fd(dfd, NULL)) == NULL) {
|
} if (!tst && (tst = super_by_fd(dfd, NULL)) == NULL) {
|
||||||
if (report_missmatch)
|
if (report_missmatch)
|
||||||
fprintf(stderr, Name ": not a recognisable container: %s\n",
|
fprintf(stderr, Name ": not a recognisable container: %s\n",
|
||||||
devname);
|
devname);
|
||||||
tmpdev->used = 2;
|
tmpdev->used = 2;
|
||||||
|
#endif
|
||||||
} else if (!tst->ss->load_container
|
} else if (!tst->ss->load_container
|
||||||
|| tst->ss->load_container(tst, dfd, NULL)) {
|
|| tst->ss->load_container(tst, dfd, NULL)) {
|
||||||
if (report_missmatch)
|
if (report_missmatch)
|
||||||
|
|
|
@ -883,7 +883,7 @@ static int array_try_spare(char *devname, int *dfdp, struct dev_policy *pol,
|
||||||
struct domainlist *dl = NULL;
|
struct domainlist *dl = NULL;
|
||||||
struct mdinfo *sra;
|
struct mdinfo *sra;
|
||||||
unsigned long long devsize;
|
unsigned long long devsize;
|
||||||
unsigned long long component_size;
|
unsigned long long component_size = 0;
|
||||||
|
|
||||||
if (is_subarray(mp->metadata))
|
if (is_subarray(mp->metadata))
|
||||||
continue;
|
continue;
|
||||||
|
@ -1077,7 +1077,7 @@ static int partition_try_spare(char *devname, int *dfdp, struct dev_policy *pol,
|
||||||
DIR *dir;
|
DIR *dir;
|
||||||
struct dirent *de;
|
struct dirent *de;
|
||||||
char *chosen = NULL;
|
char *chosen = NULL;
|
||||||
unsigned long long chosen_size;
|
unsigned long long chosen_size = 0;
|
||||||
struct supertype *chosen_st = NULL;
|
struct supertype *chosen_st = NULL;
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
|
@ -1118,7 +1118,10 @@ static int partition_try_spare(char *devname, int *dfdp, struct dev_policy *pol,
|
||||||
domain_free(domlist);
|
domain_free(domlist);
|
||||||
domlist = NULL;
|
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);
|
fd = open(devname, O_RDONLY);
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
goto next;
|
goto next;
|
||||||
|
|
|
@ -291,7 +291,8 @@ static int check_one_sharer(int scan)
|
||||||
struct stat buf;
|
struct stat buf;
|
||||||
fp = fopen("/var/run/mdadm/autorebuild.pid", "r");
|
fp = fopen("/var/run/mdadm/autorebuild.pid", "r");
|
||||||
if (fp) {
|
if (fp) {
|
||||||
fscanf(fp, "%d", &pid);
|
if (fscanf(fp, "%d", &pid) != 1)
|
||||||
|
pid = -1;
|
||||||
sprintf(dir, "/proc/%d", pid);
|
sprintf(dir, "/proc/%d", pid);
|
||||||
rv = stat(dir, &buf);
|
rv = stat(dir, &buf);
|
||||||
if (rv != -1) {
|
if (rv != -1) {
|
||||||
|
|
|
@ -380,7 +380,7 @@ void RebuildMap(void)
|
||||||
int dfd;
|
int dfd;
|
||||||
int ok;
|
int ok;
|
||||||
struct supertype *st;
|
struct supertype *st;
|
||||||
char *subarray;
|
char *subarray = NULL;
|
||||||
char *path;
|
char *path;
|
||||||
struct mdinfo *info;
|
struct mdinfo *info;
|
||||||
|
|
||||||
|
|
|
@ -105,7 +105,7 @@ int main(int argc, char *argv[]) {
|
||||||
if (mdfd >= 0)
|
if (mdfd >= 0)
|
||||||
close(mdfd);
|
close(mdfd);
|
||||||
rv |= Assemble(array_list->st, array_list->devname,
|
rv |= Assemble(array_list->st, array_list->devname,
|
||||||
array_list, NULL, NULL,
|
array_list, NULL, NULL, 0,
|
||||||
readonly, runstop, NULL, NULL, 0,
|
readonly, runstop, NULL, NULL, 0,
|
||||||
verbose, force);
|
verbose, force);
|
||||||
}
|
}
|
||||||
|
|
|
@ -205,8 +205,8 @@ static int validate_geometry(struct supertype *st, int level,
|
||||||
struct superswitch gpt = {
|
struct superswitch gpt = {
|
||||||
#ifndef MDASSEMBLE
|
#ifndef MDASSEMBLE
|
||||||
.examine_super = examine_gpt,
|
.examine_super = examine_gpt,
|
||||||
#endif
|
|
||||||
.validate_geometry = validate_geometry,
|
.validate_geometry = validate_geometry,
|
||||||
|
#endif
|
||||||
.match_metadata_desc = match_metadata_desc,
|
.match_metadata_desc = match_metadata_desc,
|
||||||
.load_super = load_gpt,
|
.load_super = load_gpt,
|
||||||
.store_super = store_gpt,
|
.store_super = store_gpt,
|
||||||
|
|
|
@ -384,6 +384,7 @@ const char *get_sys_dev_type(enum sys_dev_type type)
|
||||||
return _sys_dev_type[type];
|
return _sys_dev_type[type];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef MDASSEMBLE
|
||||||
static struct intel_hba * alloc_intel_hba(struct sys_dev *device)
|
static struct intel_hba * alloc_intel_hba(struct sys_dev *device)
|
||||||
{
|
{
|
||||||
struct intel_hba *result = malloc(sizeof(*result));
|
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,
|
static int attach_hba_to_super(struct intel_super *super, struct sys_dev *device,
|
||||||
const char *devname)
|
const char *devname)
|
||||||
{
|
{
|
||||||
|
@ -475,6 +475,7 @@ static struct sys_dev* find_disk_attached_hba(int fd, const char *devname)
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
#endif /* MDASSEMBLE */
|
||||||
|
|
||||||
|
|
||||||
static struct supertype *match_metadata_desc_imsm(char *arg)
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif /* MDASSEMBLE */
|
|
||||||
|
|
||||||
static int is_gen_migration(struct imsm_dev *dev)
|
static int is_gen_migration(struct imsm_dev *dev)
|
||||||
{
|
{
|
||||||
|
@ -4658,6 +4658,7 @@ static int is_gen_migration(struct imsm_dev *dev)
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif /* MDASSEMBLE */
|
||||||
|
|
||||||
static int is_rebuilding(struct imsm_dev *dev)
|
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);
|
__free_imsm_disk(dl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* MDASSEMBLE */
|
|
||||||
|
|
||||||
static char disk_by_path[] = "/dev/disk/by-path/";
|
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");
|
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_name = dev;
|
||||||
geo.dev_id = st->devnum;
|
geo.dev_id = st->devnum;
|
||||||
|
@ -7167,6 +7167,7 @@ static int imsm_manage_reshape(
|
||||||
afd, sra, reshape, st, stripes,
|
afd, sra, reshape, st, stripes,
|
||||||
fds, offsets, dests, destfd, destoffsets);
|
fds, offsets, dests, destfd, destoffsets);
|
||||||
}
|
}
|
||||||
|
#endif /* MDASSEMBLE */
|
||||||
|
|
||||||
struct superswitch super_imsm = {
|
struct superswitch super_imsm = {
|
||||||
#ifndef MDASSEMBLE
|
#ifndef MDASSEMBLE
|
||||||
|
@ -7184,6 +7185,10 @@ struct superswitch super_imsm = {
|
||||||
.kill_subarray = kill_subarray_imsm,
|
.kill_subarray = kill_subarray_imsm,
|
||||||
.update_subarray = update_subarray_imsm,
|
.update_subarray = update_subarray_imsm,
|
||||||
.load_container = load_container_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
|
#endif
|
||||||
.match_home = match_home_imsm,
|
.match_home = match_home_imsm,
|
||||||
.uuid_from_super= uuid_from_super_imsm,
|
.uuid_from_super= uuid_from_super_imsm,
|
||||||
|
@ -7202,10 +7207,6 @@ struct superswitch super_imsm = {
|
||||||
.free_super = free_super_imsm,
|
.free_super = free_super_imsm,
|
||||||
.match_metadata_desc = match_metadata_desc_imsm,
|
.match_metadata_desc = match_metadata_desc_imsm,
|
||||||
.container_content = container_content_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,
|
.external = 1,
|
||||||
.name = "imsm",
|
.name = "imsm",
|
||||||
|
|
|
@ -199,8 +199,8 @@ static int validate_geometry(struct supertype *st, int level,
|
||||||
struct superswitch mbr = {
|
struct superswitch mbr = {
|
||||||
#ifndef MDASSEMBLE
|
#ifndef MDASSEMBLE
|
||||||
.examine_super = examine_mbr,
|
.examine_super = examine_mbr,
|
||||||
#endif
|
|
||||||
.validate_geometry = validate_geometry,
|
.validate_geometry = validate_geometry,
|
||||||
|
#endif
|
||||||
.match_metadata_desc = match_metadata_desc,
|
.match_metadata_desc = match_metadata_desc,
|
||||||
.load_super = load_super_mbr,
|
.load_super = load_super_mbr,
|
||||||
.store_super = store_mbr,
|
.store_super = store_mbr,
|
||||||
|
|
2
util.c
2
util.c
|
@ -160,6 +160,7 @@ int get_linux_version()
|
||||||
return (a*1000000)+(b*1000)+c;
|
return (a*1000000)+(b*1000)+c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef MDASSEMBLE
|
||||||
int mdadm_version(char *version)
|
int mdadm_version(char *version)
|
||||||
{
|
{
|
||||||
int a, b, c;
|
int a, b, c;
|
||||||
|
@ -185,7 +186,6 @@ int mdadm_version(char *version)
|
||||||
return (a*1000000)+(b*1000)+c;
|
return (a*1000000)+(b*1000)+c;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef MDASSEMBLE
|
|
||||||
long long parse_size(char *size)
|
long long parse_size(char *size)
|
||||||
{
|
{
|
||||||
/* parse 'size' which should be a number optionally
|
/* parse 'size' which should be a number optionally
|
||||||
|
|
Loading…
Reference in New Issue