Tidyup automatic name choice for v-1 arrays

/dev/md_d0 now becomes '0', not '_d0'.
This commit is contained in:
Neil Brown 2006-08-07 11:30:02 +10:00
parent 43f2372a03
commit 60248f7433
2 changed files with 11 additions and 2 deletions

View File

@ -2,6 +2,8 @@ Changes Prior to 2.5.3 release
- Document v0.91 superblocks in md.4
- Make GPL explicit in man pages.
- Fix recent breakage of starting degraded arrays.
- Tidyup automatic name choice for v-1 arrays:
/dev/md_d0 now becomes '0', not '_d0'.
Changes Prior to 2.5.2 release
- Fix problem with compiling with gcc-2 compilers

View File

@ -30,6 +30,7 @@
#include "mdadm.h"
#include "md_u.h"
#include "md_p.h"
#include <ctype.h>
int Create(struct supertype *st, char *mddev, int mdfd,
int chunk, int level, int layout, unsigned long long size, int raiddisks, int sparedisks,
@ -399,9 +400,15 @@ int Create(struct supertype *st, char *mddev, int mdfd,
name = strrchr(mddev, '/');
if (name) {
name++;
if (strncmp(name, "md", 2)==0 &&
strlen(name) > 2 &&
if (strncmp(name, "md_d", 4)==0 &&
strlen(name) > 4 &&
isdigit(name[4]) &&
(name-mddev) == 5 /* /dev/ */)
name += 4;
else if (strncmp(name, "md", 2)==0 &&
strlen(name) > 2 &&
isdigit(name[2]) &&
(name-mddev) == 5 /* /dev/ */)
name += 2;
}
}