chrt: add support for SCHED_BATCH
[oweals/busybox.git] / util-linux / fstrim.c
index fc51878b6e26f98f6b0243987dea4cd92df7a123..205d1e42b8eaaa747fa8ad5479163c790d32a637 100644 (file)
@@ -7,15 +7,14 @@
  *
  * Licensed under GPLv2 or later, see file LICENSE in this source tree.
  */
-
 //config:config FSTRIM
-//config:      bool "fstrim"
+//config:      bool "fstrim (5.5 kb)"
 //config:      default y
 //config:      select PLATFORM_LINUX
 //config:      help
-//config:        Discard unused blocks on a mounted filesystem.
+//config:      Discard unused blocks on a mounted filesystem.
 
-//applet:IF_FSTRIM(APPLET(fstrim, BB_DIR_SBIN, BB_SUID_DROP))
+//applet:IF_FSTRIM(APPLET_NOEXEC(fstrim, fstrim, BB_DIR_SBIN, BB_SUID_DROP, fstrim))
 
 //kbuild:lib-$(CONFIG_FSTRIM) += fstrim.o
 
@@ -23,9 +22,9 @@
 //usage:       "[OPTIONS] MOUNTPOINT"
 //usage:#define fstrim_full_usage "\n\n"
 //usage:       IF_LONG_OPTS(
-//usage:       "       -o,--offset=OFFSET      Offset in bytes to discard from"
-//usage:     "\n       -l,--length=LEN         Bytes to discard"
-//usage:     "\n       -m,--minimum=MIN        Minimum extent length"
+//usage:       "       -o,--offset OFFSET      Offset in bytes to discard from"
+//usage:     "\n       -l,--length LEN         Bytes to discard"
+//usage:     "\n       -m,--minimum MIN        Minimum extent length"
 //usage:     "\n       -v,--verbose            Print number of discarded bytes"
 //usage:       )
 //usage:       IF_NOT_LONG_OPTS(
@@ -63,17 +62,17 @@ int fstrim_main(int argc UNUSED_PARAM, char **argv)
        };
 
 #if ENABLE_LONG_OPTS
-       static const char getopt_longopts[] ALIGN1 =
+       static const char fstrim_longopts[] ALIGN1 =
                "offset\0"    Required_argument    "o"
                "length\0"    Required_argument    "l"
                "minimum\0"   Required_argument    "m"
                "verbose\0"   No_argument          "v"
                ;
-       applet_long_options = getopt_longopts;
 #endif
 
-       opt_complementary = "=1"; /* exactly one non-option arg: the mountpoint */
-       opts = getopt32(argv, "o:l:m:v", &arg_o, &arg_l, &arg_m);
+       opts = getopt32long(argv, "^" "o:l:m:v" "\0" "=1", fstrim_longopts,
+                       &arg_o, &arg_l, &arg_m
+       );
 
        memset(&range, 0, sizeof(range));
        range.len = ULLONG_MAX;