Commit | Line | Data |
---|---|---|
a8c3ad3e MD |
1 | #ifndef _LTT_TRACKER_H |
2 | #define _LTT_TRACKER_H | |
3 | ||
4 | /* | |
5 | * Copyright (C) 2018 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com> | |
6 | * | |
7 | * This program is free software; you can redistribute it and/or modify | |
8 | * it under the terms of the GNU General Public License, version 2 only, | |
9 | * as published by the Free Software Foundation. | |
10 | * | |
11 | * This program is distributed in the hope that it will be useful, | |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | * GNU General Public License for more details. | |
15 | * | |
16 | * You should have received a copy of the GNU General Public License along | |
17 | * with this program; if not, write to the Free Software Foundation, Inc., | |
18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
19 | */ | |
20 | ||
2d97a006 | 21 | #include <lttng/tracker.h> |
a8c3ad3e MD |
22 | #include <urcu.h> |
23 | #include <urcu/list.h> | |
24 | #include <urcu/rculfhash.h> | |
25 | ||
26 | enum lttng_tracker_list_state { | |
27 | LTTNG_TRACK_ALL, | |
28 | LTTNG_TRACK_NONE, | |
29 | LTTNG_TRACK_LIST, | |
30 | }; | |
31 | ||
32 | /* Tracker ID */ | |
33 | struct lttng_tracker_list_node { | |
2d97a006 | 34 | struct lttng_tracker_id *id; |
a8c3ad3e MD |
35 | |
36 | struct cds_list_head list_node; | |
37 | struct cds_lfht_node ht_node; | |
38 | struct rcu_head rcu_head; | |
39 | }; | |
40 | ||
41 | struct lttng_tracker_list { | |
42 | struct cds_list_head list_head; | |
43 | /* Hash table for O(1) removal lookup. */ | |
44 | struct cds_lfht *ht; | |
45 | enum lttng_tracker_list_state state; | |
46 | }; | |
47 | ||
48 | struct lttng_tracker_list *lttng_tracker_list_create(void); | |
49 | void lttng_tracker_list_destroy(struct lttng_tracker_list *tracker_list); | |
50 | ||
51 | int lttng_tracker_list_add(struct lttng_tracker_list *tracker_list, | |
52 | const struct lttng_tracker_id *id); | |
53 | int lttng_tracker_list_remove(struct lttng_tracker_list *tracker_list, | |
54 | const struct lttng_tracker_id *id); | |
55 | ||
56 | int lttng_tracker_id_lookup_string(enum lttng_tracker_type tracker_type, | |
57 | const struct lttng_tracker_id *id, | |
58 | int *result); | |
59 | ssize_t lttng_tracker_id_get_list(const struct lttng_tracker_list *tracker_list, | |
2d97a006 | 60 | struct lttng_tracker_id ***_ids); |
a8c3ad3e | 61 | int lttng_tracker_id_set_list(struct lttng_tracker_list *tracker_list, |
2d97a006 | 62 | struct lttng_tracker_id **_ids, |
a8c3ad3e MD |
63 | size_t count); |
64 | ||
65 | #endif /* _LTT_TRACKER_H */ |