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. --- Grow.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'Grow.c') diff --git a/Grow.c b/Grow.c index fec0d32..c160f2c 100644 --- a/Grow.c +++ b/Grow.c @@ -257,15 +257,13 @@ int Grow_addbitmap(char *devname, int fd, char *file, int chunk, int delay, int } bitmapsize = array.size; bitmapsize <<= 1; -#ifdef BLKGETSIZE64 - if (ioctl(fd, BLKGETSIZE64, &array_size) == 0 && + if (get_dev_size(fd, NULL, &array_size) && array_size > (0x7fffffffULL<<9)) { /* Array is big enough that we cannot trust array.size * try other approaches */ bitmapsize = get_component_size(fd); } -#endif if (bitmapsize == 0) { fprintf(stderr, Name ": Cannot reliably determine size of array to create bitmap - sorry.\n"); return 1; -- cgit