diff options
author | Mateusz Kusiak <mateusz.kusiak@intel.com> | 2024-01-18 11:28:41 +0100 |
---|---|---|
committer | Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com> | 2024-01-24 16:15:04 +0100 |
commit | b823c8f9d65eb7cf3338036c2a3fedf5128dedbc (patch) | |
tree | 52bc23321dfa6a50733389b78e7e1f3f2ef5d363 /sysfs.c | |
parent | Define sysfs max buffer size (diff) | |
download | mdadm-b823c8f9d65eb7cf3338036c2a3fedf5128dedbc.tar.xz mdadm-b823c8f9d65eb7cf3338036c2a3fedf5128dedbc.zip |
Replace "none" with macro
String "none" is used many times throughout the code.
Replace "none" strings with predefined macro.
Add str_is_none() for comparing strings with "none".
Replace str(n)cmp calls with function.
Signed-off-by: Mateusz Kusiak <mateusz.kusiak@intel.com>
Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
Diffstat (limited to 'sysfs.c')
-rw-r--r-- | sysfs.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -148,7 +148,7 @@ struct mdinfo *sysfs_read(int fd, char *devnm, unsigned long options) strcpy(base, "metadata_version"); if (load_sys(fname, buf, sizeof(buf))) goto abort; - if (strncmp(buf, "none", 4) == 0) { + if (str_is_none(buf) == true) { sra->array.major_version = sra->array.minor_version = -1; strcpy(sra->text_version, ""); @@ -244,7 +244,7 @@ struct mdinfo *sysfs_read(int fd, char *devnm, unsigned long options) goto abort; if (strncmp(buf, "file", 4) == 0) sra->bitmap_offset = 1; - else if (strncmp(buf, "none", 4) == 0) + else if (str_is_none(buf) == true) sra->bitmap_offset = 0; else if (buf[0] == '+') sra->bitmap_offset = strtol(buf+1, NULL, 10); |