From 7211116c295ba1f9e1fcbdc2dd2d3762855062e1 Mon Sep 17 00:00:00 2001 From: Mateusz Kusiak Date: Thu, 28 Jul 2022 20:20:53 +0800 Subject: 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 Acked-by: Coly Li Signed-off-by: Jes Sorensen --- util.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'util.c') 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 -- cgit v1.2.3