summaryrefslogtreecommitdiff
path: root/minix/usr.bin/trace/type.h
blob: 750c030b6d349b21afb383d4a39ef454ed4d601f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32

#define COUNT(s) (__arraycount(s))

struct call_handler {
	const char *name;
	const char *(*namefunc)(const message *m_out);
	int (*outfunc)(struct trace_proc *proc, const message *m_out);
	void (*infunc)(struct trace_proc *proc, const message *m_out,
	    const message *m_in, int failed);
};
#define HANDLER(n,o,i) { .name = n, .outfunc = o, .infunc = i }
#define HANDLER_NAME(n,o,i) { .namefunc = n, .outfunc = o, .infunc = i }

struct calls {
	endpoint_t endpt;
	unsigned int base;
	const struct call_handler *map;
	unsigned int count;
};

struct flags {
	unsigned int mask;
	unsigned int value;
	const char *name;
};
#define FLAG(f) { f, f, #f }
#define FLAG_MASK(m,f) { m, f, #f }
#define FLAG_ZERO(f) { ~0, f, #f }

/* not great, but it prevents a massive potential for typos.. */
#define NAME(r) case r: return #r
#define TEXT(v) case v: text = #v; break