Commit | Line | Data |
---|---|---|
8abe313a JG |
1 | /* |
2 | * Copyright (C) 2017 - Jérémie Galarneau <jeremie.galarneau@efficios.com> | |
3 | * | |
4 | * This program is free software; you can redistribute it and/or modify it | |
5 | * under the terms of the GNU General Public License, version 2 only, as | |
6 | * published by the Free Software Foundation. | |
7 | * | |
8 | * This program is distributed in the hope that it will be useful, but WITHOUT | |
9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | |
11 | * more details. | |
12 | * | |
13 | * You should have received a copy of the GNU General Public License along with | |
14 | * this program; if not, write to the Free Software Foundation, Inc., 51 | |
15 | * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
16 | */ | |
17 | ||
18 | #ifndef NOTIFICATION_THREAD_INTERNAL_H | |
19 | #define NOTIFICATION_THREAD_INTERNAL_H | |
20 | ||
21 | #include <lttng/ref-internal.h> | |
22 | #include <urcu/rculfhash.h> | |
23 | #include <unistd.h> | |
24 | ||
25 | struct channel_key { | |
26 | uint64_t key; | |
27 | enum lttng_domain_type domain; | |
28 | }; | |
29 | ||
30 | struct session_info { | |
31 | struct lttng_ref ref; | |
32 | char *name; | |
33 | uid_t uid; | |
34 | gid_t gid; | |
35 | /* | |
c7283958 | 36 | * Hashtable containing back-refs (weak) to all channels in this session. |
8abe313a JG |
37 | * The hashtable's key is a hash of (struct channel_key) and |
38 | * the value is of type (struct channel_info *). | |
39 | */ | |
40 | struct cds_lfht *channel_infos_ht; | |
ea9a44f0 | 41 | struct lttng_session_trigger_list *trigger_list; |
8abe313a JG |
42 | /* Node in the notification thread state's sessions_ht. */ |
43 | struct cds_lfht_node sessions_ht_node; | |
1eee26c5 JG |
44 | /* |
45 | * Weak reference to the thread state's sessions_ht. Used for removal on | |
46 | * destruction. | |
47 | */ | |
48 | struct cds_lfht *sessions_ht; | |
e8360425 | 49 | uint64_t consumed_data_size; |
51eab943 JG |
50 | struct { |
51 | /* Whether a rotation is ongoing for this session. */ | |
52 | bool ongoing; | |
53 | /* Identifier of the currently ongoing rotation. */ | |
54 | uint64_t id; | |
55 | } rotation; | |
8abe313a JG |
56 | }; |
57 | ||
58 | struct channel_info { | |
59 | struct channel_key key; | |
60 | char *name; | |
61 | uint64_t capacity; | |
62 | /* | |
63 | * A channel info holds a reference (lttng_ref) on session_info. | |
64 | * session_info, in return, holds a weak reference to the channel. | |
65 | */ | |
66 | struct session_info *session_info; | |
67 | /* Node in the notification thread state's channels_ht. */ | |
68 | struct cds_lfht_node channels_ht_node; | |
69 | /* Node in the session_info's channels_ht. */ | |
70 | struct cds_lfht_node session_info_channels_ht_node; | |
71 | }; | |
72 | ||
73 | #endif /* NOTIFICATION_THREAD_INTERNAL_H */ |