summaryrefslogtreecommitdiffstats
path: root/mdadm.h
diff options
context:
space:
mode:
authorMateusz Kusiak <mateusz.kusiak@intel.com>2024-01-18 11:28:41 +0100
committerMariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>2024-01-24 16:15:04 +0100
commitb823c8f9d65eb7cf3338036c2a3fedf5128dedbc (patch)
tree52bc23321dfa6a50733389b78e7e1f3f2ef5d363 /mdadm.h
parentDefine sysfs max buffer size (diff)
downloadmdadm-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 'mdadm.h')
-rw-r--r--mdadm.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/mdadm.h b/mdadm.h
index 46692730..709b6104 100644
--- a/mdadm.h
+++ b/mdadm.h
@@ -2027,3 +2027,19 @@ static inline int is_container(const int level)
return 1;
return 0;
}
+
+#define STR_COMMON_NONE "none"
+
+/**
+ * str_is_none() - check if @str starts with "none".
+ * @str: string
+ *
+ * return:
+ * true if string starts with "none", false otherwise.
+ */
+static inline bool str_is_none(char *str)
+{
+ if (strncmp(str, STR_COMMON_NONE, sizeof(STR_COMMON_NONE) - 1) == 0)
+ return true;
+ return false;
+}