1/* SPDX-License-Identifier: GPL-2.0 */ 2/* 3 * Copyright (C) 2022 Huawei Technologies Co., Ltd. All rights reserved. 4 */ 5 6#ifndef HIVIEW_HISYSEVENT_H 7#define HIVIEW_HISYSEVENT_H 8 9enum hisysevent_type { 10 /* fault event */ 11 FAULT = 1, 12 13 /* statistic event */ 14 STATISTIC = 2, 15 16 /* security event */ 17 SECURITY = 3, 18 19 /* behavior event */ 20 BEHAVIOR = 4 21}; 22 23struct hiview_hisysevent; 24 25#ifdef CONFIG_HISYSEVENT 26 27struct hiview_hisysevent * 28hisysevent_create(const char *domain, const char *name, enum hisysevent_type type); 29void hisysevent_destroy(struct hiview_hisysevent **event); 30int hisysevent_put_integer(struct hiview_hisysevent *event, const char *key, long long value); 31int hisysevent_put_string(struct hiview_hisysevent *event, const char *key, const char *value); 32int hisysevent_write(struct hiview_hisysevent *event); 33 34#else 35 36#include <linux/errno.h> 37#include <linux/stddef.h> 38 39static inline struct hiview_hisysevent * 40hisysevent_create(const char *domain, const char *name, enum hisysevent_type type) 41{ 42 return NULL; 43} 44 45static inline void hisysevent_destroy(struct hiview_hisysevent **event) 46{} 47 48static inline int 49hisysevent_put_integer(struct hiview_hisysevent *event, const char *key, long long value) 50{ 51 return -EOPNOTSUPP; 52} 53 54static inline int 55hisysevent_put_string(struct hiview_hisysevent *event, const char *key, const char *value) 56{ 57 return -EOPNOTSUPP; 58} 59 60static inline int hisysevent_write(struct hiview_hisysevent *event) 61{ 62 return -EOPNOTSUPP; 63} 64 65#endif /* CONFIG_HISYSEVENT */ 66 67#endif /* HIVIEW_HISYSEVENT_H */ 68