#include <sys/file.h>
#include <ctype.h>
-
#define MAP_READ 0
#define MAP_NEW 1
#define MAP_LOCK 2
mapname[0]) == 0;
}
-
static FILE *lf = NULL;
int map_lock(struct map_ent **melp)
{
* It needs to match what -I or -As would come
* up with.
* That means:
- * Check if array is in mdadm.conf
+ * Check if array is in mdadm.conf
* - if so use that.
* determine trustworthy from homehost etc
* find a unique name based on metadata name.
- *
+ *
*/
struct mddev_ident *match = conf_match(st, info,
NULL, 0,
sep = "";
}
}
- if (strchr(name, ':'))
- /* probably a uniquifying
+ if (strchr(name, ':')) {
+ /* Probably a uniquifying
* hostname prefix. Allow
- * without a suffix
+ * without a suffix, and strip
+ * hostname if it is us.
*/
+ if (homehost && unum == -1 &&
+ strncmp(name, homehost,
+ strlen(homehost)) == 0 &&
+ name[strlen(homehost)] == ':')
+ name += strlen(homehost)+1;
unum = -1;
+ }
while (conflict) {
if (unum >= 0)