Ignore:
Timestamp:
Jan 1, 2014, 12:47:38 AM (7 years ago)
Author:
Bruno Cornec
Message:
  • Update mindi-busybox to 1.21.1
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.2/mindi-busybox/util-linux/blockdev.c

    r3085 r3232  
    77 */
    88
    9 //applet:IF_BLOCKDEV(APPLET(blockdev, _BB_DIR_SBIN, _BB_SUID_DROP))
     9//applet:IF_BLOCKDEV(APPLET(blockdev, BB_DIR_SBIN, BB_SUID_DROP))
    1010
    1111//kbuild:lib-$(CONFIG_BLOCKDEV) += blockdev.o
     
    2020//usage:    "OPTION BLOCKDEV"
    2121//usage:#define blockdev_full_usage "\n\n"
    22 //usage:       "Options:"
    23 //usage:     "\n    --setro     Set ro"
     22//usage:       "    --setro     Set ro"
    2423//usage:     "\n    --setrw     Set rw"
    2524//usage:     "\n    --getro     Get ro"
     
    2726//usage:     "\n    --getbsz    Get block size"
    2827//usage:     "\n    --setbsz BYTES  Set block size"
    29 //usage:     "\n    --getsize   Get device size in 512-byte sectors"
     28//usage:     "\n    --getsz     Get device size in 512-byte sectors"
     29/*//usage:     "\n  --getsize   Get device size in sectors (deprecated)"*/
    3030//usage:     "\n    --getsize64 Get device size in bytes"
    3131//usage:     "\n    --flushbufs Flush buffers"
     
    3535#include "libbb.h"
    3636#include <linux/fs.h>
    37 
    38 /*  Patch bco to compile this busybox on rhel3  */
    39 #ifndef BLKGETSIZE64
    40 #define BLKGETSIZE64 _IOR(0x12,114,size_t)
    41 #endif
    4237
    4338enum {
     
    5146    FL_USRARG   = 4, /* argument is provided by user */
    5247    FL_NORESULT = 8,
     48    FL_SCALE512 = 16,
    5349};
    5450
     
    9187        .flags = ARG_INT + FL_NORESULT + FL_USRARG,
    9288        .argval = 0,
     89    },{
     90        .ioc = BLKGETSIZE64,
     91        .name = "getsz",
     92        .flags = ARG_U64 + FL_SCALE512,
     93        .argval = -1,
    9394    },{
    9495        .ioc = BLKGETSIZE,
     
    129130
    130131int blockdev_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
    131 int blockdev_main(int argc, char **argv)
     132int blockdev_main(int argc UNUSED_PARAM, char **argv)
    132133{
    133134    const struct bdc *bdcmd;
     
    140141    } ioctl_val_on_stack;
    141142
    142     if ((unsigned)(argc - 3) > 1) /* must have 2 or 3 args */
     143    argv++;
     144    if (!argv[0] || !argv[1]) /* must have at least 2 args */
    143145        bb_show_usage();
    144146
    145     bdcmd = find_cmd(*++argv);
     147    bdcmd = find_cmd(*argv);
    146148
    147149    u64 = (int)bdcmd->argval;
     
    149151        u64 = xatoi_positive(*++argv);
    150152
    151     if (!*++argv || argv[1])
     153    argv++;
     154    if (!argv[0] || argv[1])
    152155        bb_show_usage();
    153     fd = xopen(*argv, O_RDONLY);
     156    fd = xopen(argv[0], O_RDONLY);
    154157
    155158    ioctl_val_on_stack.u64 = u64;
     
    179182    u64 = ioctl_val_on_stack.u64;
    180183
     184    if (bdcmd->flags & FL_SCALE512)
     185        u64 >>= 9;
     186
    181187    /* Zero- or one-extend the value if needed, then print */
    182188    switch (bdcmd->flags & (ARG_MASK+FL_NORESULT)) {
Note: See TracChangeset for help on using the changeset viewer.