--getsize is marked as deprecated in mainline blockdev.

Signed-off-by: Dan Fandrich <[email protected]>
---
 util-linux/blockdev.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/util-linux/blockdev.c b/util-linux/blockdev.c
index c2fcaee..94ea9b7 100644
--- a/util-linux/blockdev.c
+++ b/util-linux/blockdev.c
@@ -26,7 +26,8 @@
 //usage:     "\n       --getss         Get sector size"
 //usage:     "\n       --getbsz        Get block size"
 //usage:     "\n       --setbsz BYTES  Set block size"
-//usage:     "\n       --getsize       Get device size in 512-byte sectors"
+//usage:     "\n       --getsz         Get device size in 512-byte sectors"
+//usage:     "\n       --getsize       Get device size in sectors (deprecated)"
 //usage:     "\n       --getsize64     Get device size in bytes"
 //usage:     "\n       --flushbufs     Flush buffers"
 //usage:     "\n       --rereadpt      Reread partition table"
@@ -45,6 +46,7 @@ enum {
 
        FL_USRARG   = 4, /* argument is provided by user */
        FL_NORESULT = 8,
+       FL_SCALE512 = 16,
 };
 
 struct bdc {
@@ -86,6 +88,11 @@ static const struct bdc bdcommands[] = {
                .flags = ARG_INT + FL_NORESULT + FL_USRARG,
                .argval = 0,
        },{
+               .ioc = BLKGETSIZE64,
+               .name = "getsz",
+               .flags = ARG_U64 + FL_SCALE512,
+               .argval = -1,
+       },{
                .ioc = BLKGETSIZE,
                .name = "getsize",
                .flags = ARG_ULONG,
@@ -173,6 +180,9 @@ int blockdev_main(int argc, char **argv)
        /* Fetch it into register(s) */
        u64 = ioctl_val_on_stack.u64;
 
+       if (bdcmd->flags & FL_SCALE512)
+               u64 >>= 9;
+
        /* Zero- or one-extend the value if needed, then print */
        switch (bdcmd->flags & (ARG_MASK+FL_NORESULT)) {
        case ARG_INT:
-- 
1.5.3.2

_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to