Factor out test for subarray version string.
We are about to change the syntax of the version string for 'subarray's. So factor out the test into a single function. Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
parent
6c386dd368
commit
3c558363a1
2
Create.c
2
Create.c
|
@ -523,7 +523,7 @@ int Create(struct supertype *st, char *mddev, int mdfd,
|
|||
st->ss->getinfo_super(st, &info);
|
||||
|
||||
if (did_default && verbose >= 0) {
|
||||
if (info.text_version[0] == '/') {
|
||||
if (is_subarray(info.text_version)) {
|
||||
int dnum = devname2devnum(info.text_version+1);
|
||||
char *path;
|
||||
int mdp = get_mdp_major();
|
||||
|
|
4
Manage.c
4
Manage.c
|
@ -123,7 +123,7 @@ int Manage_runstop(char *devname, int fd, int runstop, int quiet)
|
|||
mdi = sysfs_read(fd, -1, GET_LEVEL|GET_VERSION);
|
||||
if (mdi &&
|
||||
mdi->array.level > 0 &&
|
||||
mdi->text_version[0] == '/') {
|
||||
is_subarray(mdi->text_version)) {
|
||||
char *cp;
|
||||
|
||||
/* This is mdmon managed. */
|
||||
|
@ -147,7 +147,7 @@ int Manage_runstop(char *devname, int fd, int runstop, int quiet)
|
|||
} else if (mdi &&
|
||||
mdi->array.major_version == -1 &&
|
||||
mdi->array.minor_version == -2 &&
|
||||
mdi->text_version[0] != '/') {
|
||||
!is_subarray(mdi->text_version)) {
|
||||
/* container, possibly mdmon-managed.
|
||||
* Make sure mdmon isn't opening it, which
|
||||
* would interfere with the 'stop'
|
||||
|
|
|
@ -492,7 +492,8 @@ void manage(struct mdstat_ent *mdstat, struct supertype *container)
|
|||
continue;
|
||||
}
|
||||
if (mdstat->metadata_version == NULL ||
|
||||
strncmp(mdstat->metadata_version, "external:/", 10) != 0 ||
|
||||
strncmp(mdstat->metadata_version, "external:", 9) != 0 ||
|
||||
!is_subarray(mdstat->metadata_version+9) ||
|
||||
strncmp(mdstat->metadata_version+10, container->devname,
|
||||
strlen(container->devname)) != 0 ||
|
||||
mdstat->metadata_version[10+strlen(container->devname)]
|
||||
|
|
5
mdadm.h
5
mdadm.h
|
@ -805,6 +805,11 @@ static inline int ROUND_UP(int a, int base)
|
|||
return ((a+base-1)/base)*base;
|
||||
}
|
||||
|
||||
static inline int is_subarray(char *vers)
|
||||
{
|
||||
return (*vers == '/');
|
||||
}
|
||||
|
||||
#define LEVEL_MULTIPATH (-4)
|
||||
#define LEVEL_LINEAR (-1)
|
||||
#define LEVEL_FAULTY (-5)
|
||||
|
|
Loading…
Reference in New Issue