ident->uuid_set = 0;
}
-/** ident_check_name() - helper function to verify name.
- * @name: name to check.
- * @prop_name: the name of the property it is validated against, used for logging.
- * @cmdline: context dependent actions.
- *
- * @name must follow name's criteria, be POSIX compatible and does not have leading dot.
- */
-static mdadm_status_t ident_check_name(const char *name, const char *prop_name, const bool cmdline)
-{
- if (!is_string_lq(name, MD_NAME_MAX + 1)) {
- ident_log(prop_name, name, "Too long or empty", cmdline);
- return MDADM_STATUS_ERROR;
- }
-
- if (*name == '.') {
- /* MD device should not be considered as hidden. */
- ident_log(prop_name, name, "Leading dot forbidden", cmdline);
- return MDADM_STATUS_ERROR;
- }
-
- if (!is_name_posix_compatible(name)) {
- ident_log(prop_name, name, "Not POSIX compatible", cmdline);
- return MDADM_STATUS_ERROR;
- }
-
- return MDADM_STATUS_SUCCESS;
-}
-
/**
* _ident_set_devname() - verify devname and set it in &mddev_ident.
* @ident: pointer to &mddev_ident.
static const char named_dev_pref[] = DEV_NUM_PREF "_";
static const int named_dev_pref_size = sizeof(named_dev_pref) - 1;
const char *prop_name = "devname";
- mdadm_status_t ret;
const char *name;
if (ident->devname) {
else
name = devname;
- ret = ident_check_name(name, prop_name, cmdline);
- if (ret)
- return ret;
+ if (!is_string_lq(name, MD_NAME_MAX + 1)) {
+ ident_log(prop_name, name, "Too long or empty", cmdline);
+ return MDADM_STATUS_ERROR;
+ }
+
pass:
ident->devname = xstrdup(devname);
return MDADM_STATUS_SUCCESS;
assert(ident);
const char *prop_name = "name";
- mdadm_status_t ret;
if (ident->name[0]) {
ident_log(prop_name, name, "Already defined", true);
return MDADM_STATUS_ERROR;
}
- ret = ident_check_name(name, prop_name, true);
- if (ret)
- return ret;
+ if (!is_string_lq(name, MD_NAME_MAX + 1)) {
+ ident_log(prop_name, name, "Too long or empty", true);
+ return MDADM_STATUS_ERROR;
+ }
snprintf(ident->name, MD_NAME_MAX + 1, "%s", name);
return MDADM_STATUS_SUCCESS;
.BR \-N ", " \-\-name=
Set a
.B name
-for the array. It must be
-.BR "POSIX PORTABLE NAME"
-compatible and cannot be longer than 32 chars. This is effective when creating an array
-with a v1 metadata, or an external array.
+for the array. It cannot be longer than 32 chars. This is effective when
+creating an array with a v1 metadata, or an external array.
If name is needed but not specified, it is taken from the basename of the device
that is being created. See
.TP
.BR \-N ", " \-\-name=
-Specify the name of the array to assemble. It must be
-.BR "POSIX PORTABLE NAME"
-compatible and cannot be longer than 32 chars. This must be the name
-that was specified when creating the array. It must either match
-the name stored in the superblock exactly, or it must match
+Specify the name of the array to assemble. It cannot be longer than 32 chars.
+This must be the name that was specified when creating the array. It must
+either match the name stored in the superblock exactly, or it must match
with the current
.I homehost
prefixed to the start of the given name.
The
.B name
-option updates the subarray name in the metadata. It must be
-.BR "POSIX PORTABLE NAME"
-compatible and cannot be longer than 32 chars. If successes, new value will be respected after
-next assembly.
+option updates the subarray name in the metadata. It cannot be longer than
+32 chars. If successes, new value will be respected after next assembly.
The
.B ppl
.I home
can be given.
-In every style, raw name must be compatible with
-.BR "POSIX PORTABLE NAME"
-and has to be no longer than 32 chars.
+In every style, raw name has to be no longer than 32 chars.
When
.I mdadm
return false;
}
+ if (name[0] == '.') {
+ pr_vrb("imsm: Name \"%s\" has forbidden leading dot", name);
+ return false;
+ }
+
+ if (is_name_posix_compatible(name) == false) {
+ pr_vrb("imsm: Name \"%s\" doesn't follow POSIX portable file name character set",
+ name);
+ return false;
+ }
+
for (i = 0; i < mpb->num_raid_devs; i++) {
struct imsm_dev *dev = get_imsm_dev(super, i);
# Test how <devname> is handled during Incremental assemblation with
# config file and ARRAYLINE specified.
+# for native, mdadm is not limiting or checking the set of ASCI symbols that
+# can be used. It is up to user to use symbols that are not conflicting with
+# system utilities. Any problem is this area is not mdadm issue.
+
names_create "/dev/md/name"
local _UUID="$(mdadm -D --export /dev/md127 | grep MD_UUID | cut -d'=' -f2)"
[[ "$_UUID" == "" ]] && echo "Cannot obtain UUID for $DEVNODE_NAME" && exit 1
names_verify "/dev/md4" "empty" "name"
mdadm -S "/dev/md4"
-# 6. <devname> with some special symbols and locales.
-# <devname> should be ignored.
-names_make_conf $_UUID "tźż-\.,<>st+-" $config
-mdadm -I $dev0 --config=$config
-names_verify "/dev/md127" "name" "name"
-mdadm -S "/dev/md127"
-
-# 7. No <devname> set.
+# 6. No <devname> set.
# Metadata name and default node used.
names_make_conf $_UUID "empty" $config
mdadm -I $dev0 --config=$config