summaryrefslogtreecommitdiffstats
path: root/Monitor.c
diff options
context:
space:
mode:
authorJes Sorensen <Jes.Sorensen@gmail.com>2017-03-29 20:35:41 +0200
committerJes Sorensen <Jes.Sorensen@gmail.com>2017-03-29 20:35:41 +0200
commit9cd39f015558dba82c293a4433b481b921ceec87 (patch)
tree324f4d170f41b88d9941b06c832638a0ba232950 /Monitor.c
parentGrow: Fixup a pile of cosmetic issues (diff)
downloadmdadm-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 'Monitor.c')
-rw-r--r--Monitor.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/Monitor.c b/Monitor.c
index bdd3e63e..0a0a1e27 100644
--- a/Monitor.c
+++ b/Monitor.c
@@ -497,7 +497,7 @@ static int check_array(struct state *st, struct mdstat_ent *mdstat,
return 0;
}
fcntl(fd, F_SETFD, FD_CLOEXEC);
- if (ioctl(fd, GET_ARRAY_INFO, &array)<0) {
+ if (md_get_array_info(fd, &array) < 0) {
if (!st->err)
alert("DeviceDisappeared", dev, NULL, ainfo);
st->err++;
@@ -709,9 +709,10 @@ static int add_new_arrays(struct mdstat_ent *mdstat, struct state **statelist,
st->devname = xstrdup(name);
if ((fd = open(st->devname, O_RDONLY)) < 0 ||
- ioctl(fd, GET_ARRAY_INFO, &array)< 0) {
+ md_get_array_info(fd, &array) < 0) {
/* no such array */
- if (fd >=0) close(fd);
+ if (fd >= 0)
+ close(fd);
put_md_name(st->devname);
free(st->devname);
if (st->metadata) {