diff options
author | Jes Sorensen <Jes.Sorensen@gmail.com> | 2017-03-29 21:23:50 +0200 |
---|---|---|
committer | Jes Sorensen <Jes.Sorensen@gmail.com> | 2017-03-29 21:23:50 +0200 |
commit | d97572f5a59ca1ddde9971a79d47c9ea4db5891b (patch) | |
tree | f748c4137dc291624599a7927c57310efe794584 /Detail.c | |
parent | Incremental: Remove redundant call for GET_ARRAY_INFO (diff) | |
download | mdadm-d97572f5a59ca1ddde9971a79d47c9ea4db5891b.tar.xz mdadm-d97572f5a59ca1ddde9971a79d47c9ea4db5891b.zip |
util: Introduce md_get_disk_info()
This removes all the inline ioctl calls for GET_DISK_INFO, allowing us
to switch to sysfs in one place, and improves type checking.
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
Diffstat (limited to 'Detail.c')
-rw-r--r-- | Detail.c | 8 |
1 files changed, 3 insertions, 5 deletions
@@ -51,10 +51,8 @@ static int add_device(const char *dev, char ***p_devices, int Detail(char *dev, struct context *c) { /* - * Print out details for an md array by using - * GET_ARRAY_INFO and GET_DISK_INFO ioctl calls + * Print out details for an md array */ - int fd = open(dev, O_RDONLY); int vers; mdu_array_info_t array; @@ -165,7 +163,7 @@ int Detail(char *dev, struct context *c) disk = subdev->disk; else { disk.number = d; - if (ioctl(fd, GET_DISK_INFO, &disk) < 0) + if (md_get_disk_info(fd, &disk) < 0) continue; if (d >= array.raid_disks && disk.major == 0 && @@ -322,7 +320,7 @@ int Detail(char *dev, struct context *c) } else for (d = 0; d < max_disks; d++) { mdu_disk_info_t disk; disk.number = d; - if (ioctl(fd, GET_DISK_INFO, &disk) < 0) { + if (md_get_disk_info(fd, &disk) < 0) { if (d < array.raid_disks) pr_err("cannot get device detail for device %d: %s\n", d, strerror(errno)); |