summaryrefslogtreecommitdiffstats
path: root/mdopen.c
diff options
context:
space:
mode:
authorMariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>2023-03-23 17:50:14 +0100
committerJes Sorensen <jes@trained-monkey.org>2023-05-08 22:23:45 +0200
commitb9ce7ab0218c550488587fdad5708628d6a5ffc2 (patch)
tree235d1a56bf56cb4ed8b5c3ca46c32afe67083d8f /mdopen.c
parentRemove the config files in mdcheck_start|continue service (diff)
downloadmdadm-b9ce7ab0218c550488587fdad5708628d6a5ffc2.tar.xz
mdadm-b9ce7ab0218c550488587fdad5708628d6a5ffc2.zip
mdadm: define DEV_MD_DIR
It is used many times. Additionally define _LEN to avoid repeated strlen() calls when length is needed. Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com> Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
Diffstat (limited to 'mdopen.c')
-rw-r--r--mdopen.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/mdopen.c b/mdopen.c
index 810f79a3..6c3bdb6a 100644
--- a/mdopen.c
+++ b/mdopen.c
@@ -188,12 +188,12 @@ int create_mddev(char *dev, char *name, int autof, int trustworthy,
parts = autof >> 3;
autof &= 7;
- strcpy(chosen, "/dev/md/");
+ strcpy(chosen, DEV_MD_DIR);
cname = chosen + strlen(chosen);
if (dev) {
- if (strncmp(dev, "/dev/md/", 8) == 0) {
- strcpy(cname, dev+8);
+ if (strncmp(dev, DEV_MD_DIR, DEV_MD_DIR_LEN) == 0) {
+ strcpy(cname, dev + DEV_MD_DIR_LEN);
} else if (strncmp(dev, "/dev/", 5) == 0) {
char *e = dev + strlen(dev);
while (e > dev && isdigit(e[-1]))