Add guess_super_type
This can select to only guess array types, or only guess partition types. Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
parent
73c9c47c70
commit
54887ad8cb
6
mdadm.h
6
mdadm.h
|
@ -729,7 +729,11 @@ struct supertype {
|
||||||
};
|
};
|
||||||
|
|
||||||
extern struct supertype *super_by_fd(int fd);
|
extern struct supertype *super_by_fd(int fd);
|
||||||
extern struct supertype *guess_super(int fd);
|
enum guess_types { guess_any, guess_array, guess_partitions };
|
||||||
|
extern struct supertype *guess_super_type(int fd, enum guess_types guess_type);
|
||||||
|
static inline struct supertype *guess_super(int fd) {
|
||||||
|
return guess_super_type(fd, guess_any);
|
||||||
|
}
|
||||||
extern struct supertype *dup_super(struct supertype *st);
|
extern struct supertype *dup_super(struct supertype *st);
|
||||||
extern int get_dev_size(int fd, char *dname, unsigned long long *sizep);
|
extern int get_dev_size(int fd, char *dname, unsigned long long *sizep);
|
||||||
extern void get_one_disk(int mdfd, mdu_array_info_t *ainf,
|
extern void get_one_disk(int mdfd, mdu_array_info_t *ainf,
|
||||||
|
|
6
util.c
6
util.c
|
@ -1087,7 +1087,7 @@ struct supertype *dup_super(struct supertype *orig)
|
||||||
return st;
|
return st;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct supertype *guess_super(int fd)
|
struct supertype *guess_super_type(int fd, enum guess_types guess_type)
|
||||||
{
|
{
|
||||||
/* try each load_super to find the best match,
|
/* try each load_super to find the best match,
|
||||||
* and return the best superswitch
|
* and return the best superswitch
|
||||||
|
@ -1102,6 +1102,10 @@ struct supertype *guess_super(int fd)
|
||||||
for (i=0 ; superlist[i]; i++) {
|
for (i=0 ; superlist[i]; i++) {
|
||||||
int rv;
|
int rv;
|
||||||
ss = superlist[i];
|
ss = superlist[i];
|
||||||
|
if (guess_type == guess_array && ss->add_to_super == NULL)
|
||||||
|
continue;
|
||||||
|
if (guess_type == guess_partitions && ss->add_to_super != NULL)
|
||||||
|
continue;
|
||||||
memset(st, 0, sizeof(*st));
|
memset(st, 0, sizeof(*st));
|
||||||
rv = ss->load_super(st, fd, NULL);
|
rv = ss->load_super(st, fd, NULL);
|
||||||
if (rv == 0) {
|
if (rv == 0) {
|
||||||
|
|
Loading…
Reference in New Issue