summaryrefslogtreecommitdiffstats
path: root/mdadm.h
diff options
context:
space:
mode:
authorMariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>2023-06-01 09:27:50 +0200
committerJes Sorensen <jes@trained-monkey.org>2023-10-26 23:28:23 +0200
commite2eb503bd797908f515b58428b274f1ba6a05349 (patch)
tree88ef87abb98fe35d6e111b332536423aab7592d2 /mdadm.h
parentmdadm: define ident_set_devname() (diff)
downloadmdadm-e2eb503bd797908f515b58428b274f1ba6a05349.tar.xz
mdadm-e2eb503bd797908f515b58428b274f1ba6a05349.zip
mdadm: Follow POSIX Portable Character Set
When the user creates a device with a name that contains whitespace, mdadm timeouts and throws an error. This issue is caused by udev, which truncates /dev/md link until the first whitespace. This patch introduces prohibition of characters other than A-Za-z0-9.-_ in the device name. Also, it prohibits using leading "-" in device name, so name won't be confused with cli parameter. Set of allowed characters is taken from POSIX 3.280 Portable Character Set. Also, device name length now is limited to NAME_MAX. In some places, there are other requirements for string length (e.g. size up to MD_NAME_MAX for device name). This routine is made to follow POSIX and other, more strict limitations should be checked separately. We are aware of the risk of regression in exceptional cases (as escape_devname function is removed) that should be fixed by updating the array name. The POSIX validation is added for: - 'name' parameter in every mode. - first devlist entry, for Build, Create, Assemble, Manage, Grow. - config entries, both devname and "name=". Additionally, some manual cleanups are made. Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com> Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
Diffstat (limited to 'mdadm.h')
-rw-r--r--mdadm.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/mdadm.h b/mdadm.h
index 49422e24..9effb941 100644
--- a/mdadm.h
+++ b/mdadm.h
@@ -1617,6 +1617,7 @@ extern int check_raid(int fd, char *name);
extern int check_partitions(int fd, char *dname,
unsigned long long freesize,
unsigned long long size);
+extern bool is_name_posix_compatible(const char *path);
extern int fstat_is_blkdev(int fd, char *devname, dev_t *rdev);
extern int stat_is_blkdev(char *devname, dev_t *rdev);
@@ -1657,7 +1658,6 @@ extern int conf_get_monitor_delay(void);
extern char *conf_line(FILE *file);
extern char *conf_word(FILE *file, int allow_key);
extern void print_quoted(char *str);
-extern void print_escape(char *str);
extern int use_udev(void);
extern unsigned long GCD(unsigned long a, unsigned long b);
extern int conf_name_is_free(char *name);