Add init support for dm-verity logging mode

Add a built-in command for loading verity state. If dm-verity
will be started in logging mode, trigger verity-logging.

Needs changes from
  Ibb82953594d234f81ad21c40f524190b88e4ac8f

Change-Id: I5af4918f2f14fdd4d07f51c55837e08111fd3748
This commit is contained in:
Sami Tolvanen 2015-02-16 11:03:34 +00:00
parent 51bf11ad95
commit 8ff0190835
3 changed files with 19 additions and 0 deletions

View File

@ -712,6 +712,20 @@ int do_sysclktz(int nargs, char **args)
return 0;
}
int do_verity_load_state(int nargs, char **args) {
if (nargs == 1) {
int mode = -1;
int rc = fs_mgr_load_verity_state(&mode);
if (rc == 0 && mode == VERITY_MODE_LOGGING) {
action_for_each_trigger("verity-logging", action_add_queue_tail);
}
return rc;
}
return -1;
}
int do_write(int nargs, char **args)
{
const char *path = args[1];

View File

@ -204,6 +204,9 @@ static int lookup_keyword(const char *s)
case 'u':
if (!strcmp(s, "ser")) return K_user;
break;
case 'v':
if (!strcmp(s, "erity_load_state")) return K_verity_load_state;
break;
case 'w':
if (!strcmp(s, "rite")) return K_write;
if (!strcmp(s, "ait")) return K_wait;

View File

@ -41,6 +41,7 @@ int do_chmod(int nargs, char **args);
int do_loglevel(int nargs, char **args);
int do_load_persist_props(int nargs, char **args);
int do_load_all_props(int nargs, char **args);
int do_verity_load_state(int nargs, char **args);
int do_wait(int nargs, char **args);
#define __MAKE_KEYWORD_ENUM__
#define KEYWORD(symbol, flags, nargs, func) K_##symbol,
@ -97,6 +98,7 @@ enum {
KEYWORD(symlink, COMMAND, 1, do_symlink)
KEYWORD(sysclktz, COMMAND, 1, do_sysclktz)
KEYWORD(user, OPTION, 0, 0)
KEYWORD(verity_load_state, COMMAND, 0, do_verity_load_state)
KEYWORD(wait, COMMAND, 1, do_wait)
KEYWORD(write, COMMAND, 2, do_write)
KEYWORD(copy, COMMAND, 2, do_copy)