diff --git a/init/builtins.c b/init/builtins.c index 6e37d0867..bfc0ddb15 100644 --- a/init/builtins.c +++ b/init/builtins.c @@ -516,6 +516,18 @@ int do_mount_all(int nargs, char **args) return ret; } +int do_swapon_all(int nargs, char **args) +{ + struct fstab *fstab; + int ret; + + fstab = fs_mgr_read_fstab(args[1]); + ret = fs_mgr_swapon_all(fstab); + fs_mgr_free_fstab(fstab); + + return ret; +} + int do_setcon(int nargs, char **args) { if (is_selinux_enabled() <= 0) return 0; diff --git a/init/init_parser.c b/init/init_parser.c index 28bf30c14..776c699aa 100644 --- a/init/init_parser.c +++ b/init/init_parser.c @@ -151,6 +151,7 @@ int lookup_keyword(const char *s) if (!strcmp(s, "ocket")) return K_socket; if (!strcmp(s, "tart")) return K_start; if (!strcmp(s, "top")) return K_stop; + if (!strcmp(s, "wapon_all")) return K_swapon_all; if (!strcmp(s, "ymlink")) return K_symlink; if (!strcmp(s, "ysclktz")) return K_sysclktz; break; diff --git a/init/keywords.h b/init/keywords.h index f14750647..5a44df356 100644 --- a/init/keywords.h +++ b/init/keywords.h @@ -27,6 +27,7 @@ int do_setrlimit(int nargs, char **args); int do_setsebool(int nargs, char **args); int do_start(int nargs, char **args); int do_stop(int nargs, char **args); +int do_swapon_all(int nargs, char **args); int do_trigger(int nargs, char **args); int do_symlink(int nargs, char **args); int do_sysclktz(int nargs, char **args); @@ -84,6 +85,7 @@ enum { KEYWORD(socket, OPTION, 0, 0) KEYWORD(start, COMMAND, 1, do_start) KEYWORD(stop, COMMAND, 1, do_stop) + KEYWORD(swapon_all, COMMAND, 1, do_swapon_all) KEYWORD(trigger, COMMAND, 1, do_trigger) KEYWORD(symlink, COMMAND, 1, do_symlink) KEYWORD(sysclktz, COMMAND, 1, do_sysclktz)