Commit | Line | Data |
---|---|---|
3d914829 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 | ||
21 | #include <lttng/session.h> | |
22 | #include <urcu/rculfhash.h> | |
23 | #include <urcu/list.h> | |
24 | ||
25 | enum lttng_tracker_list_state { | |
26 | LTTNG_TRACK_ALL, | |
27 | LTTNG_TRACK_NONE, | |
28 | LTTNG_TRACK_LIST, | |
29 | }; | |
30 | ||
31 | /* Tracker ID */ | |
32 | struct lttng_tracker_list_node { | |
33 | struct lttng_tracker_id id; | |
34 | ||
35 | struct cds_list_head list_node; | |
36 | struct cds_lfht_node ht_node; | |
37 | struct rcu_head rcu_head; | |
38 | }; | |
39 | ||
40 | struct lttng_tracker_list { | |
41 | struct cds_list_head list_head; | |
42 | /* Hash table for O(1) removal lookup. */ | |
43 | struct cds_lfht *ht; | |
44 | enum lttng_tracker_list_state state; | |
45 | }; | |
46 | ||
47 | struct lttng_tracker_list *lttng_tracker_list_create(void); | |
48 | void lttng_tracker_list_destroy(struct lttng_tracker_list *tracker_list); | |
49 | ||
50 | int lttng_tracker_list_add(struct lttng_tracker_list *tracker_list, | |
51 | const struct lttng_tracker_id *id); | |
52 | int lttng_tracker_list_remove(struct lttng_tracker_list *tracker_list, | |
53 | const struct lttng_tracker_id *id); | |
54 | ||
55 | int lttng_tracker_id_lookup_string(enum lttng_tracker_type tracker_type, | |
56 | const struct lttng_tracker_id *id, | |
57 | int *result); | |
58 | ssize_t lttng_tracker_id_get_list(struct lttng_tracker_list *tracker_list, | |
59 | struct lttng_tracker_id **_ids); | |
60 | int lttng_tracker_id_set_list(struct lttng_tracker_list *tracker_list, | |
61 | struct lttng_tracker_id *_ids, | |
62 | size_t count); | |
63 | ||
64 | #endif /* _LTT_TRACKER_H */ |