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 /Grow.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 'Grow.c')
-rwxr-xr-x | Grow.c | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -161,7 +161,7 @@ int Grow_Add_device(char *devname, int fd, char *newdev) st->ss->free_super(st); disk.number = d; - if (ioctl(fd, GET_DISK_INFO, &disk) < 0) { + if (md_get_disk_info(fd, &disk) < 0) { pr_err("cannot get device detail for device %d\n", d); close(nfd); @@ -232,7 +232,7 @@ int Grow_Add_device(char *devname, int fd, char *newdev) char *dv; disk.number = d; - if (ioctl(fd, GET_DISK_INFO, &disk) < 0) { + if (md_get_disk_info(fd, &disk) < 0) { pr_err("cannot get device detail for device %d\n", d); return 1; @@ -422,7 +422,7 @@ int Grow_addbitmap(char *devname, int fd, struct context *c, struct shape *s) int fd2; disk.number = d; - if (ioctl(fd, GET_DISK_INFO, &disk) < 0) + if (md_get_disk_info(fd, &disk) < 0) continue; if (disk.major == 0 && disk.minor == 0) continue; @@ -483,7 +483,7 @@ int Grow_addbitmap(char *devname, int fd, struct context *c, struct shape *s) char *dv; int fd2; disk.number = d; - if (ioctl(fd, GET_DISK_INFO, &disk) < 0) + if (md_get_disk_info(fd, &disk) < 0) continue; if ((disk.major==0 && disk.minor == 0) || (disk.state & (1 << MD_DISK_REMOVED))) @@ -2908,7 +2908,7 @@ static int impose_level(int fd, int level, char *devname, int verbose) 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) continue; if (disk.major == 0 && disk.minor == 0) continue; @@ -2927,7 +2927,7 @@ static int impose_level(int fd, int level, char *devname, int verbose) 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) continue; if (disk.major == 0 && disk.minor == 0) continue; @@ -5011,7 +5011,7 @@ int Grow_continue_command(char *devname, int fd, char *dv; int err; disk.number = d; - if (ioctl(fd, GET_DISK_INFO, &disk) < 0) + if (md_get_disk_info(fd, &disk) < 0) continue; if (disk.major == 0 && disk.minor == 0) continue; |