]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - Detail.c
Central calls to ioctl BLKGETSIZE
[thirdparty/mdadm.git] / Detail.c
index 832e0d8719d1adcf861aacfa3406ba48fafd952d..ca34f1d48f125618bf33b554c7c96385296772d9 100644 (file)
--- a/Detail.c
+++ b/Detail.c
@@ -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",
@@ -168,11 +158,14 @@ int Detail(char *dev, int brief, int test, char *homehost)
                            (larray_size >= 0xFFFFFFFFULL|| array.size == 0)) {
                                unsigned long long dsize = get_component_size(fd);
                                if (dsize > 0)
-                                       printf("    Device Size : %llu%s\n", dsize, human_size((long long)array.size<<10));
+                                       printf("  Used Dev Size : %llu%s\n",
+                                              dsize,
+                                        human_size((long long)array.size<<10));
                                else
-                                       printf("    Device Size : unknown\n");
+                                       printf("  Used Dev Size : unknown\n");
                        } else
-                               printf("    Device Size : %d%s\n", array.size, human_size((long long)array.size<<10));
+                               printf("  Used Dev Size : %d%s\n", array.size,
+                                      human_size((long long)array.size<<10));
                }
                printf("   Raid Devices : %d\n", array.raid_disks);
                printf("  Total Devices : %d\n", array.nr_disks);