hyperv: Reorder the Hyper-V TSC initialization a bit.
[dragonfly.git] / lib / libevtr / internal.h
blob2050cf9e4a8394f793cbd9915e20acfa198c5046
1 #ifndef _EVTR_INTERNAL_H_
2 #define _EVTR_INTERNAL_H_
4 #include <sys/queue.h>
5 #include "evtr.h"
7 extern unsigned evtr_debug;
9 #define DEFINE_DEBUG_FLAG(nam, chr) \
10 nam = 1 << (chr - 'a')
12 enum debug_flags {
13 DEFINE_DEBUG_FLAG(IO, 'i'),
14 DEFINE_DEBUG_FLAG(DS, 't'), /* data structures */
15 DEFINE_DEBUG_FLAG(LEX, 'l'),
16 DEFINE_DEBUG_FLAG(PARSE, 'p'),
17 DEFINE_DEBUG_FLAG(MISC, 'm'),
20 #define printd(subsys, ...) \
21 do { \
22 if (evtr_debug & (subsys)) { \
23 fprintf(stderr, "%s:", #subsys); \
24 fprintf(stderr, __VA_ARGS__); \
25 } \
26 } while (0)
28 #define printw(...) \
29 do { \
30 fprintf(stderr, "Warning: "); \
31 fprintf(stderr, __VA_ARGS__); \
32 } while(0)
35 struct ktrfmt_parse_ctx {
36 struct symtab *symtab;
37 struct evtr_variable *var;
38 struct evtr_variable_value *val;
39 evtr_event_t ev;
40 char *errbuf;
41 size_t errbufsz;
42 int err;
45 TAILQ_HEAD(evtr_value_list, evtr_variable_value);
46 typedef struct evtr_value_list *evtr_value_list_t;
48 struct symtab *symtab_new(void);
49 struct evtr_variable * symtab_find(const struct symtab *, const char *);
50 int symtab_insert(struct symtab *, const char *, struct evtr_variable *);
51 void symtab_destroy(struct symtab *);
54 int parse_string(evtr_event_t, struct symtab *, const char *, char *, size_t);
55 int parse_var(const char *, struct symtab *, struct evtr_variable **,
56 char *, size_t);
58 struct hashtab;
59 struct hashentry;
60 struct hashtab * hash_new(void);
61 int hash_find(const struct hashtab *, uintptr_t, uintptr_t *);
62 struct hashentry * hash_insert(struct hashtab *, uintptr_t, uintptr_t);
64 void evtr_variable_value_list_destroy(evtr_value_list_t);
67 #endif /* _EVTR_INTERNAL_H_ */