summaryrefslogtreecommitdiffstats
path: root/util.c
diff options
context:
space:
mode:
authorMateusz Kusiak <mateusz.kusiak@intel.com>2022-07-28 14:20:53 +0200
committerJes Sorensen <jsorensen@fb.com>2022-08-24 17:53:40 +0200
commit7211116c295ba1f9e1fcbdc2dd2d3762855062e1 (patch)
treeee4d983805d5150d509da2cbc143714a4e6fc6d2 /util.c
parentmdadm: Don't open md device for CREATE and ASSEMBLE (diff)
downloadmdadm-7211116c295ba1f9e1fcbdc2dd2d3762855062e1.tar.xz
mdadm-7211116c295ba1f9e1fcbdc2dd2d3762855062e1.zip
Grow: Split Grow_reshape into helper function
Grow_reshape should be split into helper functions given its size. - Add helper function for preparing reshape on external metadata. - Close cfd file descriptor. Signed-off-by: Mateusz Kusiak <mateusz.kusiak@intel.com> Acked-by: Coly Li <colyli@suse.de> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
Diffstat (limited to 'util.c')
-rw-r--r--util.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/util.c b/util.c
index ca48d976..26ffdcea 100644
--- a/util.c
+++ b/util.c
@@ -1027,6 +1027,20 @@ int get_maj_min(char *dev, int *major, int *minor)
*e == 0);
}
+/**
+ * is_bit_set() - get bit value by index.
+ * @val: value.
+ * @index: index of the bit (LSB numbering).
+ *
+ * Return: bit value.
+ */
+bool is_bit_set(int *val, unsigned char index)
+{
+ if ((*val) & (1 << index))
+ return true;
+ return false;
+}
+
int dev_open(char *dev, int flags)
{
/* like 'open', but if 'dev' matches %d:%d, create a temp