Add swapon_all to init's builtin commands

For enabling swap devices found in the fstab file

Change-Id: Iec4fd4d208df3d7a161a90d95f8606e8b516334a
This commit is contained in:
Ken Sumrall 2013-07-09 18:42:09 -07:00
parent 5bc31a2632
commit a76baaabe5
3 changed files with 15 additions and 0 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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)