diff options
author | Jes Sorensen <Jes.Sorensen@gmail.com> | 2017-03-29 20:35:41 +0200 |
---|---|---|
committer | Jes Sorensen <Jes.Sorensen@gmail.com> | 2017-03-29 20:35:41 +0200 |
commit | 9cd39f015558dba82c293a4433b481b921ceec87 (patch) | |
tree | 324f4d170f41b88d9941b06c832638a0ba232950 /Manage.c | |
parent | Grow: Fixup a pile of cosmetic issues (diff) | |
download | mdadm-9cd39f015558dba82c293a4433b481b921ceec87.tar.xz mdadm-9cd39f015558dba82c293a4433b481b921ceec87.zip |
util: Introduce md_get_array_info()
Remove most direct ioctl calls for GET_ARRAY_INFO, except for one,
which will be addressed in the next patch.
This is the start of the effort to clean up the use of ioctl calls and
introduce a more structured API, which will use sysfs and fall back to
ioctl for backup.
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
Diffstat (limited to 'Manage.c')
-rw-r--r-- | Manage.c | 13 |
1 files changed, 6 insertions, 7 deletions
@@ -95,7 +95,7 @@ int Manage_ro(char *devname, int fd, int readonly) goto out; } #endif - if (ioctl(fd, GET_ARRAY_INFO, &array)) { + if (md_get_array_info(fd, &array)) { pr_err("%s does not appear to be active.\n", devname); rv = 1; @@ -539,7 +539,7 @@ static void add_faulty(struct mddev_dev *dv, int fd, char disp) int remaining_disks; int i; - if (ioctl(fd, GET_ARRAY_INFO, &array) != 0) + if (md_get_array_info(fd, &array) != 0) return; remaining_disks = array.nr_disks; @@ -565,7 +565,7 @@ static void add_detached(struct mddev_dev *dv, int fd, char disp) int remaining_disks; int i; - if (ioctl(fd, GET_ARRAY_INFO, &array) != 0) + if (md_get_array_info(fd, &array) != 0) return; remaining_disks = array.nr_disks; @@ -602,7 +602,7 @@ static void add_set(struct mddev_dev *dv, int fd, char set_char) int copies, set; int i; - if (ioctl(fd, GET_ARRAY_INFO, &array) != 0) + if (md_get_array_info(fd, &array) != 0) return; if (array.level != 10) return; @@ -1383,9 +1383,8 @@ int Manage_subdevs(char *devname, int fd, int busy = 0; int raid_slot = -1; - if (ioctl(fd, GET_ARRAY_INFO, &array)) { - pr_err("Cannot get array info for %s\n", - devname); + if (md_get_array_info(fd, &array)) { + pr_err("Cannot get array info for %s\n", devname); goto abort; } sysfs_init(&info, fd, NULL); |