diff options
author | Denys Vlasenko | 2013-11-12 12:09:14 +0100 |
---|---|---|
committer | Denys Vlasenko | 2013-11-12 12:09:14 +0100 |
commit | cd0936be361ad2566200479d66fc1e5671182b73 (patch) | |
tree | ea80e1bd884cd37cfd38ef251802f16cf9d8d75d | |
parent | d3092c99ae90f2be2e1f990eab15921ea26652fd (diff) | |
download | busybox-cd0936be361ad2566200479d66fc1e5671182b73.zip busybox-cd0936be361ad2566200479d66fc1e5671182b73.tar.gz |
fstrim: use new-style config/kbuild/applet snippets; trim help text
function old new delta
packed_usage 29546 29520 -26
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | include/applets.src.h | 1 | ||||
-rw-r--r-- | util-linux/Config.src | 7 | ||||
-rw-r--r-- | util-linux/Kbuild.src | 1 | ||||
-rw-r--r-- | util-linux/fstrim.c | 34 |
4 files changed, 22 insertions, 21 deletions
diff --git a/include/applets.src.h b/include/applets.src.h index 5268200..3a47e15 100644 --- a/include/applets.src.h +++ b/include/applets.src.h @@ -167,7 +167,6 @@ IF_FSCK(APPLET(fsck, BB_DIR_SBIN, BB_SUID_DROP)) //IF_E2FSCK(APPLET_ODDNAME(fsck.ext2, e2fsck, BB_DIR_SBIN, BB_SUID_DROP, fsck_ext2)) //IF_E2FSCK(APPLET_ODDNAME(fsck.ext3, e2fsck, BB_DIR_SBIN, BB_SUID_DROP, fsck_ext3)) IF_FSCK_MINIX(APPLET_ODDNAME(fsck.minix, fsck_minix, BB_DIR_SBIN, BB_SUID_DROP, fsck_minix)) -IF_FSTRIM(APPLET(fstrim, BB_DIR_SBIN, BB_SUID_DROP)) IF_FSYNC(APPLET_NOFORK(fsync, fsync, BB_DIR_BIN, BB_SUID_DROP, fsync)) IF_FTPD(APPLET(ftpd, BB_DIR_USR_SBIN, BB_SUID_DROP)) IF_FTPGET(APPLET_ODDNAME(ftpget, ftpgetput, BB_DIR_USR_BIN, BB_SUID_DROP, ftpget)) diff --git a/util-linux/Config.src b/util-linux/Config.src index ef70397..5a8b006 100644 --- a/util-linux/Config.src +++ b/util-linux/Config.src @@ -246,13 +246,6 @@ config FSCK_MINIX check for and attempt to repair any corruption that occurs to a minix filesystem. -config FSTRIM - bool "fstrim" - default y - select PLATFORM_LINUX - help - Discard unused blocks on a mounted filesystem. - config MKFS_EXT2 bool "mkfs_ext2" default y diff --git a/util-linux/Kbuild.src b/util-linux/Kbuild.src index 429cf11..468fc6b 100644 --- a/util-linux/Kbuild.src +++ b/util-linux/Kbuild.src @@ -18,7 +18,6 @@ lib-$(CONFIG_FINDFS) += findfs.o lib-$(CONFIG_FLOCK) += flock.o lib-$(CONFIG_FREERAMDISK) += freeramdisk.o lib-$(CONFIG_FSCK_MINIX) += fsck_minix.o -lib-$(CONFIG_FSTRIM) += fstrim.o lib-$(CONFIG_GETOPT) += getopt.o lib-$(CONFIG_HEXDUMP) += hexdump.o lib-$(CONFIG_HWCLOCK) += hwclock.o diff --git a/util-linux/fstrim.c b/util-linux/fstrim.c index 4d90fa7..675a021 100644 --- a/util-linux/fstrim.c +++ b/util-linux/fstrim.c @@ -8,21 +8,31 @@ * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//config:config FSTRIM +//config: bool "fstrim" +//config: default y +//config: select PLATFORM_LINUX +//config: help +//config: Discard unused blocks on a mounted filesystem. + +//applet:IF_FSTRIM(APPLET(fstrim, BB_DIR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_FSTRIM) += fstrim.o + //usage:#define fstrim_trivial_usage -//usage: "[Options] <mountpoint>" +//usage: "[OPTIONS] MOUNTPOINT" //usage:#define fstrim_full_usage "\n\n" -//usage: "Options:" //usage: IF_LONG_OPTS( -//usage: "\n -o,--offset=offset offset in bytes to discard from" -//usage: "\n -l,--length=length length of bytes to discard from the offset" -//usage: "\n -m,--minimum=minimum minimum extent length to discard" -//usage: "\n -v,--verbose print number of discarded bytes" +//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( -//usage: "\n -o offset offset in bytes to discard from" -//usage: "\n -l length length of bytes to discard from the offset" -//usage: "\n -m minimum minimum extent length to discard" -//usage: "\n -v, print number of discarded bytes" +//usage: " -o OFFSET Offset in bytes to discard from" +//usage: "\n -l LEN Bytes to discard" +//usage: "\n -m MIN Minimum extent length" +//usage: "\n -v, Print number of discarded bytes" //usage: ) #include "libbb.h" @@ -94,7 +104,7 @@ int fstrim_main(int argc UNUSED_PARAM, char **argv) if (opts & OPT_m) range.minlen = xatoull_sfx(arg_m, fstrim_sfx); - mp = *(argv += optind); + mp = argv[optind]; if (find_block_device(mp)) { fd = xopen_nonblocking(mp); xioctl(fd, FITRIM, &range); @@ -102,7 +112,7 @@ int fstrim_main(int argc UNUSED_PARAM, char **argv) close(fd); if (opts & OPT_v) - printf("%s: %llu bytes were trimmed\n", mp, range.len); + printf("%s: %llu bytes trimmed\n", mp, (unsigned long long)range.len); return EXIT_SUCCESS; } return EXIT_FAILURE; |