• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
9 enum 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 
23 struct hiview_hisysevent;
24 
25 #ifdef CONFIG_HISYSEVENT
26 
27 struct hiview_hisysevent *
28 hisysevent_create(const char *domain, const char *name, enum hisysevent_type type);
29 void hisysevent_destroy(struct hiview_hisysevent **event);
30 int hisysevent_put_integer(struct hiview_hisysevent *event, const char *key, long long value);
31 int hisysevent_put_string(struct hiview_hisysevent *event, const char *key, const char *value);
32 int hisysevent_write(struct hiview_hisysevent *event);
33 
34 #else
35 
36 #include <linux/errno.h>
37 #include <linux/stddef.h>
38 
39 static inline struct hiview_hisysevent *
hisysevent_create(const char * domain,const char * name,enum hisysevent_type type)40 hisysevent_create(const char *domain, const char *name, enum hisysevent_type type)
41 {
42 	return NULL;
43 }
44 
hisysevent_destroy(struct hiview_hisysevent ** event)45 static inline void hisysevent_destroy(struct hiview_hisysevent **event)
46 {}
47 
48 static inline int
hisysevent_put_integer(struct hiview_hisysevent * event,const char * key,long long value)49 hisysevent_put_integer(struct hiview_hisysevent *event, const char *key, long long value)
50 {
51 	return -EOPNOTSUPP;
52 }
53 
54 static inline int
hisysevent_put_string(struct hiview_hisysevent * event,const char * key,const char * value)55 hisysevent_put_string(struct hiview_hisysevent *event, const char *key, const char *value)
56 {
57 	return -EOPNOTSUPP;
58 }
59 
hisysevent_write(struct hiview_hisysevent * event)60 static 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