bc: convert to "G trick" - this returns bc to zero bss increase
[oweals/busybox.git] / util-linux / blkdiscard.c
index ace88a1f0a36ab1006a3e07fc9c4506ae17e71e3..e4902e5b5ba12973a7ac3c5122b6b6741dab5e2a 100644 (file)
@@ -5,15 +5,16 @@
  *
  * Licensed under GPLv2 or later, see file LICENSE in this source tree.
  */
-
 //config:config BLKDISCARD
-//config:      bool "blkdiscard"
+//config:      bool "blkdiscard (5.3 kb)"
 //config:      default y
+//config:      select PLATFORM_LINUX
 //config:      help
-//config:        blkdiscard discards sectors on a given device.
+//config:      blkdiscard discards sectors on a given device.
+
+//applet:IF_BLKDISCARD(APPLET_NOEXEC(blkdiscard, blkdiscard, BB_DIR_USR_BIN, BB_SUID_DROP, blkdiscard))
 
 //kbuild:lib-$(CONFIG_BLKDISCARD) += blkdiscard.o
-//applet:IF_BLKDISCARD(APPLET(blkdiscard, BB_DIR_USR_BIN, BB_SUID_DROP))
 
 //usage:#define blkdiscard_trivial_usage
 //usage:       "[-o OFS] [-l LEN] [-s] DEVICE"
 #include "libbb.h"
 #include <linux/fs.h>
 
+#ifndef BLKDISCARD
+#define BLKDISCARD 0x1277
+#endif
+#ifndef BLKSECDISCARD
+#define BLKSECDISCARD 0x127d
+#endif
+
 int blkdiscard_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
 int blkdiscard_main(int argc UNUSED_PARAM, char **argv)
 {
@@ -38,7 +46,6 @@ int blkdiscard_main(int argc UNUSED_PARAM, char **argv)
        uint64_t offset; /* Leaving these two variables out does not  */
        uint64_t length; /* shrink code size and hampers readability. */
        uint64_t range[2];
-//     struct stat st;
        int fd;
 
        enum {
@@ -47,8 +54,7 @@ int blkdiscard_main(int argc UNUSED_PARAM, char **argv)
                OPT_SECURE = (1 << 2),
        };
 
-       opt_complementary = "=1";
-       opts = getopt32(argv, "o:l:s", &offset_str, &length_str);
+       opts = getopt32(argv, "^" "o:l:s" "\0" "=1", &offset_str, &length_str);
        argv += optind;
 
        fd = xopen(argv[0], O_RDWR|O_EXCL);