diff options
author | Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com> | 2023-03-23 17:50:16 +0100 |
---|---|---|
committer | Jes Sorensen <jes@trained-monkey.org> | 2023-05-08 22:23:45 +0200 |
commit | 7b3b691ba69b909ea8c172aae693fa2a6938fd14 (patch) | |
tree | 6c1394139b0aa0d549f00e7087acdcff1d48dc4c /config.c | |
parent | mdadm: define DEV_NUM_PREF (diff) | |
download | mdadm-7b3b691ba69b909ea8c172aae693fa2a6938fd14.tar.xz mdadm-7b3b691ba69b909ea8c172aae693fa2a6938fd14.zip |
mdadm: define is_devname_ignore()
Use function instead of direct checks across code.
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.c | 16 |
1 files changed, 14 insertions, 2 deletions
@@ -120,6 +120,18 @@ int match_keyword(char *word) } /** + * is_devname_ignore() - check if &devname is a special "<ignore>" keyword. + */ +bool is_devname_ignore(char *devname) +{ + static const char keyword[] = "<ignore>"; + + if (strcasecmp(devname, keyword) == 0) + return true; + return false; +} + +/** * ident_init() - Set defaults. * @ident: ident pointer, not NULL. */ @@ -404,7 +416,7 @@ void arrayline(char *line) * <ignore> * or anything that doesn't start '/' or '<' */ - if (strcasecmp(w, "<ignore>") == 0 || + if (is_devname_ignore(w) == true || strncmp(w, DEV_MD_DIR, DEV_MD_DIR_LEN) == 0 || (w[0] != '/' && w[0] != '<') || (strncmp(w, DEV_NUM_PREF, DEV_NUM_PREF_LEN) == 0 && @@ -571,7 +583,7 @@ void homehostline(char *line) char *w; for (w = dl_next(line); w != line; w = dl_next(w)) { - if (strcasecmp(w, "<ignore>") == 0) + if (is_devname_ignore(w) == true) require_homehost = 0; else if (home_host == NULL) { if (strcasecmp(w, "<none>") == 0) |