1303 files changed, 32187 insertions, 57138 deletions
diff --git a/util-linux/mkswap.c b/util-linux/mkswap.c index b5d2c49..954a194 100644 --- a/util-linux/mkswap.c +++ b/util-linux/mkswap.c @@ -5,6 +5,29 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ +//config:config MKSWAP +//config: bool "mkswap" +//config: default y +//config: help +//config: The mkswap utility is used to configure a file or disk partition as +//config: Linux swap space. This allows Linux to use the entire file or +//config: partition as if it were additional RAM, which can greatly increase +//config: the capability of low-memory machines. This additional memory is +//config: much slower than real RAM, but can be very helpful at preventing your +//config: applications being killed by the Linux out of memory (OOM) killer. +//config: Once you have created swap space using 'mkswap' you need to enable +//config: the swap space using the 'swapon' utility. +//config: +//config:config FEATURE_MKSWAP_UUID +//config: bool "UUID support" +//config: default y +//config: depends on MKSWAP +//config: help +//config: Generate swap spaces with universally unique identifiers. + +//applet:IF_MKSWAP(APPLET(mkswap, BB_DIR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_MKSWAP) += mkswap.o //usage:#define mkswap_trivial_usage //usage: "[-L LBL] BLOCKDEV [KBYTES]" @@ -13,6 +36,7 @@ //usage: "\n -L LBL Label" #include "libbb.h" +#include "common_bufsiz.h" #if ENABLE_SELINUX static void mkswap_selinux_setcontext(int fd, const char *path) @@ -75,6 +99,7 @@ struct swap_header_v1 { #define NWORDS 129 #define hdr ((struct swap_header_v1*)bb_common_bufsiz1) +#define INIT_G() do { setup_common_bufsiz(); } while (0) struct BUG_sizes { char swap_header_v1_wrong[sizeof(*hdr) != (NWORDS * 4) ? -1 : 1]; @@ -92,6 +117,8 @@ int mkswap_main(int argc UNUSED_PARAM, char **argv) off_t len; const char *label = ""; + INIT_G(); + opt_complementary = "-1"; /* at least one param */ /* TODO: -p PAGESZ, -U UUID */ getopt32(argv, "L:", &label); |