diff options
author | Neil Brown <neilb@suse.de> | 2006-12-14 17:32:57 +1100 |
---|---|---|
committer | Neil Brown <neilb@suse.de> | 2006-12-14 17:32:57 +1100 |
commit | beae1dfe2e5a3f11e6e52a93fbf617d644708415 (patch) | |
tree | ca12b130f76d63e7156e43ac89d76c11b2c140b8 /Detail.c | |
parent | ab5303d695eb7249b9462f9ad4e973711622a9c5 (diff) |
Central calls to ioctl BLKGETSIZE
Instead of opencoding the same thing everywhere.
Diffstat (limited to 'Detail.c')
-rw-r--r-- | Detail.c | 14 |
1 files changed, 2 insertions, 12 deletions
@@ -132,7 +132,6 @@ int Detail(char *dev, int brief, int test, char *homehost) printf("ARRAY %s level=%s num-devices=%d", dev, c?c:"-unknown-",array.raid_disks ); else { mdu_bitmap_file_t bmf; - unsigned long array_size; unsigned long long larray_size; struct mdstat_ent *ms = mdstat_read(0, 0); struct mdstat_ent *e; @@ -143,17 +142,8 @@ int Detail(char *dev, int brief, int test, char *homehost) for (e=ms; e; e=e->next) if (e->devnum == devnum) break; -#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; printf("%s:\n", dev); printf(" Version : %02d.%02d.%02d\n", |