1 /* 2 * Copyright (C) 2018-2022 Intel Corporation. 3 * SPDX-License-Identifier: BSD-3-Clause 4 */ 5 6 #ifndef __ANDROID_EVENTS_H__ 7 #define __ANDROID_EVENTS_H__ 8 #include "load_conf.h" 9 10 extern char *loop_dev; 11 12 #define VMEVT_HANDLED 0 13 #define VMEVT_DEFER -1 14 15 struct vm_event_t { 16 char *vm_msg; 17 size_t vm_msg_len; 18 const struct vm_t *vm; 19 }; 20 21 #define ANDROID_LOGS_DIR "/logs/" 22 #define IGN_SPACES "%*[[[:space:]]*]" 23 #define IGN_RESTS "%*[[.]*]" 24 #define IGN_ONEWORD "%*[[^[:space:]]*]" IGN_SPACES 25 #define VM_NAME_FMT "%[[A-Z0-9]{3}]" IGN_SPACES 26 27 /* These below macros were defined to obtain strings from 28 * andorid history_event 29 */ 30 #define ANDROID_WORD_LEN 32 31 32 /* Strings are constructed by A-Z, len < 8, e.g., CRASH REBOOT */ 33 #define ANDROID_ENEVT_FMT "%[[A-Z]{1,7}]" IGN_SPACES 34 /* Hashkeys are constructed by 0-9&a-z, len = 20, e.g., 0b34ae1afba54aee5cd0. */ 35 #define ANDROID_KEY_FMT "%[[0-9a-z]{20}]" IGN_SPACES 36 /* Strings, e.g., 2017-11-11/03:12:59 */ 37 #define ANDROID_LONGTIME_FMT "%[[0-9:/-]{15,20}]" IGN_SPACES 38 /* It's a time or a subtype of event, e.g., JAVACRASH POWER-ON 424874:19:56 */ 39 #define ANDROID_TYPE_FMT "%[[A-Z0-9_:-]{3,16}]" IGN_SPACES 40 #define ANDROID_LINE_REST_FMT "%[[^\n]*]" IGN_RESTS 41 42 void refresh_vm_history(struct sender_t *sender, 43 int (*fn)(const char*, size_t, const struct vm_t *)); 44 int android_event_analyze(const char *msg, size_t len, char **result, 45 size_t *rsize); 46 #endif 47