mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2026-06-09 02:24:45 +00:00
tools:acrn-crashlog: new functions to operate file vmrecord
This patch provides some new functions to operate file /var/log/crashlog/VM_eventsID.log. Adding a mutex to protect this file as it will be accessed in multiple threads in the coming patches. Tracked-On: #1024 Signed-off-by: Liu, Xinwu <xinwu.liu@intel.com> Reviewed-by: Liu, Xiaojing <xiaojing.liu@intel.com> Acked-by: Chen, Gang <gang.c.chen@intel.com>
This commit is contained in:
committed by
ACRN System Integration
parent
9d22a18659
commit
b5236f21fd
43
tools/acrn-crashlog/acrnprobe/include/vmrecord.h
Normal file
43
tools/acrn-crashlog/acrnprobe/include/vmrecord.h
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright (C) 2018 Intel Corporation
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef __VMRECORD_H__
|
||||
#define __VMRECORD_H__
|
||||
#include "pthread.h"
|
||||
|
||||
#define VMRECORD_HEAD_LINES 10
|
||||
#define VMRECORD_TAG_LEN 9
|
||||
#define VMRECORD_TAG_WAITING_SYNC " <=="
|
||||
#define VMRECORD_TAG_NOT_FOUND "NOT_FOUND"
|
||||
#define VMRECORD_TAG_MISS_LOG "MISS_LOGS"
|
||||
#define VMRECORD_TAG_ON_GOING " ON_GOING"
|
||||
#define VMRECORD_TAG_SUCCESS " "
|
||||
|
||||
enum vmrecord_mark_t {
|
||||
SUCCESS,
|
||||
NOT_FOUND,
|
||||
WAITING_SYNC,
|
||||
ON_GOING,
|
||||
MISS_LOG
|
||||
};
|
||||
|
||||
struct vmrecord_t {
|
||||
char *path;
|
||||
pthread_mutex_t mtx;
|
||||
struct mm_file_t *recos;
|
||||
};
|
||||
|
||||
int vmrecord_last(struct vmrecord_t *vmrecord, const char *vm_name,
|
||||
size_t nlen, char *vmkey, size_t ksize);
|
||||
int vmrecord_mark(struct vmrecord_t *vmrecord, const char *vmkey,
|
||||
size_t klen, enum vmrecord_mark_t type);
|
||||
int vmrecord_open_mark(struct vmrecord_t *vmrecord, const char *vmkey,
|
||||
size_t klen, enum vmrecord_mark_t type);
|
||||
int vmrecord_gen_ifnot_exists(struct vmrecord_t *vmrecord);
|
||||
int vmrecord_new(struct vmrecord_t *vmrecord, const char *vm_name,
|
||||
const char *key);
|
||||
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user