summaryrefslogtreecommitdiffstats
path: root/Detail.c
diff options
context:
space:
mode:
authorJes Sorensen <Jes.Sorensen@gmail.com>2017-03-29 21:23:50 +0200
committerJes Sorensen <Jes.Sorensen@gmail.com>2017-03-29 21:23:50 +0200
commitd97572f5a59ca1ddde9971a79d47c9ea4db5891b (patch)
treef748c4137dc291624599a7927c57310efe794584 /Detail.c
parentIncremental: Remove redundant call for GET_ARRAY_INFO (diff)
downloadmdadm-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.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/Detail.c b/Detail.c
index d7e886a7..fa6d4c77 100644
--- a/Detail.c
+++ b/Detail.c
@@ -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));