summaryrefslogtreecommitdiff
path: root/config.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 16:23:45 -0400
commitb9ce7ab0218c550488587fdad5708628d6a5ffc2 (patch)
tree235d1a56bf56cb4ed8b5c3ca46c32afe67083d8f /config.c
parent76c224c6cfc8ff154bd041d30b9551faecd593c1 (diff)
downloadmdadm-b9ce7ab0218c550488587fdad5708628d6a5ffc2.tar.gz
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 'config.c')
-rw-r--r--config.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/config.c b/config.c
index eeedd0c..59d5bfb 100644
--- a/config.c
+++ b/config.c
@@ -405,7 +405,7 @@ void arrayline(char *line)
* or anything that doesn't start '/' or '<'
*/
if (strcasecmp(w, "<ignore>") == 0 ||
- strncmp(w, "/dev/md/", 8) == 0 ||
+ strncmp(w, DEV_MD_DIR, DEV_MD_DIR_LEN) == 0 ||
(w[0] != '/' && w[0] != '<') ||
(strncmp(w, "/dev/md", 7) == 0 &&
is_number(w + 7)) ||
@@ -1102,13 +1102,13 @@ int devname_matches(char *name, char *match)
* mdNN with NN
* then just strcmp
*/
- if (strncmp(name, "/dev/md/", 8) == 0)
- name += 8;
+ if (strncmp(name, DEV_MD_DIR, DEV_MD_DIR_LEN) == 0)
+ name += DEV_MD_DIR_LEN;
else if (strncmp(name, "/dev/", 5) == 0)
name += 5;
- if (strncmp(match, "/dev/md/", 8) == 0)
- match += 8;
+ if (strncmp(match, DEV_MD_DIR, DEV_MD_DIR_LEN) == 0)
+ match += DEV_MD_DIR_LEN;
else if (strncmp(match, "/dev/", 5) == 0)
match += 5;