summaryrefslogtreecommitdiffstats
path: root/Detail.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 /Detail.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 'Detail.c')
-rw-r--r--Detail.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/Detail.c b/Detail.c
index 4ef26460..206d88e3 100644
--- a/Detail.c
+++ b/Detail.c
@@ -254,10 +254,9 @@ int Detail(char *dev, struct context *c)
fname_from_uuid(st, info, nbuf, ':');
printf("MD_UUID=%s\n", nbuf + 5);
mp = map_by_uuid(&map, info->uuid);
- if (mp && mp->path &&
- strncmp(mp->path, "/dev/md/", 8) == 0) {
+ if (mp && mp->path && strncmp(mp->path, DEV_MD_DIR, DEV_MD_DIR_LEN) == 0) {
printf("MD_DEVNAME=");
- print_escape(mp->path + 8);
+ print_escape(mp->path + DEV_MD_DIR_LEN);
putchar('\n');
}
@@ -273,9 +272,9 @@ int Detail(char *dev, struct context *c)
printf("MD_UUID=%s\n", nbuf+5);
}
if (mp && mp->path &&
- strncmp(mp->path, "/dev/md/", 8) == 0) {
+ strncmp(mp->path, DEV_MD_DIR, DEV_MD_DIR_LEN) == 0) {
printf("MD_DEVNAME=");
- print_escape(mp->path+8);
+ print_escape(mp->path + DEV_MD_DIR_LEN);
putchar('\n');
}
map_free(map);