diff options
author | Neil Brown <neilb@suse.de> | 2006-12-14 07:32:57 +0100 |
---|---|---|
committer | Neil Brown <neilb@suse.de> | 2006-12-14 07:32:57 +0100 |
commit | beae1dfe2e5a3f11e6e52a93fbf617d644708415 (patch) | |
tree | ca12b130f76d63e7156e43ac89d76c11b2c140b8 /Query.c | |
parent | Don't hold md device open for so long in --monitor mode (diff) | |
download | mdadm-beae1dfe2e5a3f11e6e52a93fbf617d644708415.tar.xz mdadm-beae1dfe2e5a3f11e6e52a93fbf617d644708415.zip |
Central calls to ioctl BLKGETSIZE
Instead of opencoding the same thing everywhere.
Diffstat (limited to 'Query.c')
-rw-r--r-- | Query.c | 12 |
1 files changed, 2 insertions, 10 deletions
@@ -47,7 +47,6 @@ int Query(char *dev) struct supertype *st = NULL; unsigned long long larray_size; - unsigned long array_size; struct stat stb; char *mddev; mdu_disk_info_t disc; @@ -67,15 +66,8 @@ int Query(char *dev) fstat(fd, &stb); if (vers>=9000 && !ioctlerr) { -#ifdef BLKGETSIZE64 - if (ioctl(fd, BLKGETSIZE64, &larray_size)==0) - ; - else -#endif - if (ioctl(fd, BLKGETSIZE, &array_size)==0) { - larray_size = array_size; - larray_size <<= 9; - } else larray_size = 0; + if (!get_dev_size(fd, NULL, &larray_size)) + larray_size = 0; } if (vers < 0) |