From beae1dfe2e5a3f11e6e52a93fbf617d644708415 Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Thu, 14 Dec 2006 17:32:57 +1100 Subject: Central calls to ioctl BLKGETSIZE Instead of opencoding the same thing everywhere. --- Query.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'Query.c') diff --git a/Query.c b/Query.c index 46707ed..4cfcf57 100644 --- a/Query.c +++ b/Query.c @@ -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) -- cgit