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
diff --git a/init/builtins.cpp b/init/builtins.cpp
index 9f3dcc1..b4204d8 100644
--- a/init/builtins.cpp
+++ b/init/builtins.cpp
@@ -712,6 +712,20 @@
     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];
diff --git a/init/init_parser.cpp b/init/init_parser.cpp
index 61a5e0a..3932357 100644
--- a/init/init_parser.cpp
+++ b/init/init_parser.cpp
@@ -204,6 +204,9 @@
     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;
diff --git a/init/keywords.h b/init/keywords.h
index a8f29d1..60931f1 100644
--- a/init/keywords.h
+++ b/init/keywords.h
@@ -41,6 +41,7 @@
 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 @@
     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)