From 2a5a49d3376eae890d76bb560e0d8ffc264ff5a6 Mon Sep 17 00:00:00 2001 From: Tao Bao Date: Thu, 20 Aug 2015 12:10:46 -0700 Subject: edify: Switch to C++. Change-Id: I71aede6e29af1dc4bb858a62016c8035db5d3452 --- edify/expr.h | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'edify/expr.h') diff --git a/edify/expr.h b/edify/expr.h index a9ed2f9c5..36f8e9612 100644 --- a/edify/expr.h +++ b/edify/expr.h @@ -21,10 +21,6 @@ #include "yydefs.h" -#ifdef __cplusplus -extern "C" { -#endif - #define MAX_STRING_LEN 1024 typedef struct Expr Expr; @@ -59,7 +55,7 @@ typedef Value* (*Function)(const char* name, State* state, struct Expr { Function fn; - char* name; + const char* name; int argc; Expr** argv; int start, end; @@ -166,8 +162,4 @@ void FreeValue(Value* v); int parse_string(const char* str, Expr** root, int* error_count); -#ifdef __cplusplus -} // extern "C" -#endif - #endif // _EXPRESSION_H -- cgit v1.2.3 From 162558382b768a4120b3e41090a4c7b53f11469a Mon Sep 17 00:00:00 2001 From: Tianjie Xu Date: Sat, 30 Apr 2016 11:49:59 -0700 Subject: Allow recovery to return error codes Write error code, cause code, and retry count into last_install. So we can have more information about the reason of a failed OTA. Example of new last_install: @/cache/recovery/block.map package name 0 install result retry: 1 retry count (new) error: 30 error code (new) cause: 12 error cause (new) Details in: go/android-ota-errorcode Bug: 28471955 Change-Id: I00e7153c821e7355c1be81a86c7f228108f3dc37 --- edify/expr.h | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'edify/expr.h') 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 +#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); -- cgit v1.2.3 From 7ce287d432dd3a4dc8841fc59e11ee1a0b7808a1 Mon Sep 17 00:00:00 2001 From: Tianjie Xu Date: Tue, 31 May 2016 09:29:49 -0700 Subject: Call ioctl before each write on retry If the update is a retry, ioctl(BLKDISCARD) the destination blocks before writing to these blocks. Bug: 28990135 Change-Id: I1e703808e68ebb1292cd66afd76be8fd6946ee59 --- edify/expr.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'edify/expr.h') diff --git a/edify/expr.h b/edify/expr.h index 5c06de846..886347991 100644 --- a/edify/expr.h +++ b/edify/expr.h @@ -49,6 +49,8 @@ typedef struct { // in addition to the error code. CauseCode cause_code = kNoCause; + bool is_retry = false; + } State; #define VAL_STRING 1 // data will be NULL-terminated; size doesn't count null -- cgit v1.2.3