summaryrefslogtreecommitdiffstats
path: root/edify/expr.h
diff options
context:
space:
mode:
authorTianjie Xu <xunchang@google.com>2016-05-23 23:28:44 +0200
committerandroid-build-merger <android-build-merger@google.com>2016-05-23 23:28:44 +0200
commit8a43084979c3fc3da20e23fc325922e5d01e2424 (patch)
tree6930deb10e9c1f0f7e7a160773455edbd0d027d4 /edify/expr.h
parentresolve merge conflicts of 86a28d0 to klp-modular-dev am: a5bc59620f am: 36acff7d7e am: 1f814d7630 am: ca45737e27 am: 8a1d4e97ad am: aa02888e55 am: 300af0779d am: fc1d9a49d1 am: b02b2fe392 am: 75dea9ca3a am: bd43d7e92b (diff)
parentresolve merge conflicts of 3aabd77 to nyc-mr1-dev-plus-aosp (diff)
downloadandroid_bootable_recovery-8a43084979c3fc3da20e23fc325922e5d01e2424.tar
android_bootable_recovery-8a43084979c3fc3da20e23fc325922e5d01e2424.tar.gz
android_bootable_recovery-8a43084979c3fc3da20e23fc325922e5d01e2424.tar.bz2
android_bootable_recovery-8a43084979c3fc3da20e23fc325922e5d01e2424.tar.lz
android_bootable_recovery-8a43084979c3fc3da20e23fc325922e5d01e2424.tar.xz
android_bootable_recovery-8a43084979c3fc3da20e23fc325922e5d01e2424.tar.zst
android_bootable_recovery-8a43084979c3fc3da20e23fc325922e5d01e2424.zip
Diffstat (limited to 'edify/expr.h')
-rw-r--r--edify/expr.h18
1 files changed, 17 insertions, 1 deletions
diff --git a/edify/expr.h b/edify/expr.h
index 36f8e9612..5c06de846 100644
--- a/edify/expr.h
+++ b/edify/expr.h
@@ -19,6 +19,7 @@
#include <unistd.h>
+#include "error_code.h"
#include "yydefs.h"
#define MAX_STRING_LEN 1024
@@ -39,6 +40,15 @@ typedef struct {
// Should be NULL initially, will be either NULL or a malloc'd
// pointer after Evaluate() returns.
char* errmsg;
+
+ // error code indicates the type of failure (e.g. failure to update system image)
+ // during the OTA process.
+ ErrorCode error_code = kNoError;
+
+ // cause code provides more detailed reason of an OTA failure (e.g. fsync error)
+ // in addition to the error code.
+ CauseCode cause_code = kNoCause;
+
} State;
#define VAL_STRING 1 // data will be NULL-terminated; size doesn't count null
@@ -152,7 +162,13 @@ Value** ReadValueVarArgs(State* state, int argc, Expr* argv[]);
// Use printf-style arguments to compose an error message to put into
// *state. Returns NULL.
-Value* ErrorAbort(State* state, const char* format, ...) __attribute__((format(printf, 2, 3)));
+Value* ErrorAbort(State* state, const char* format, ...)
+ __attribute__((format(printf, 2, 3), deprecated));
+
+// ErrorAbort has an optional (but recommended) argument 'cause_code'. If the cause code
+// is set, it will be logged into last_install and provides reason of OTA failures.
+Value* ErrorAbort(State* state, CauseCode cause_code, const char* format, ...)
+ __attribute__((format(printf, 3, 4)));
// Wrap a string into a Value, taking ownership of the string.
Value* StringValue(char* str);