Lines Matching refs:elem

11 static void bpf_stream_elem_init(struct bpf_stream_elem *elem, int len)  in bpf_stream_elem_init()  argument
13 init_llist_node(&elem->node); in bpf_stream_elem_init()
14 elem->total_len = len; in bpf_stream_elem_init()
15 elem->consumed_len = 0; in bpf_stream_elem_init()
21 struct bpf_stream_elem *elem; in bpf_stream_elem_alloc() local
33 elem = kmalloc_nolock(alloc_size, __GFP_ZERO, -1); in bpf_stream_elem_alloc()
34 if (!elem) in bpf_stream_elem_alloc()
37 bpf_stream_elem_init(elem, len); in bpf_stream_elem_alloc()
39 return elem; in bpf_stream_elem_alloc()
44 struct bpf_stream_elem *elem = NULL; in __bpf_stream_push_str() local
50 elem = bpf_stream_elem_alloc(len); in __bpf_stream_push_str()
51 if (!elem) in __bpf_stream_push_str()
54 memcpy(elem->str, str, len); in __bpf_stream_push_str()
55 llist_add(&elem->node, log); in __bpf_stream_push_str()
71 static void bpf_stream_release_capacity(struct bpf_stream *stream, struct bpf_stream_elem *elem) in bpf_stream_release_capacity() argument
73 int len = elem->total_len; in bpf_stream_release_capacity()
92 static void bpf_stream_free_elem(struct bpf_stream_elem *elem) in bpf_stream_free_elem() argument
94 kfree_nolock(elem); in bpf_stream_free_elem()
99 struct bpf_stream_elem *elem, *tmp; in bpf_stream_free_list() local
101 llist_for_each_entry_safe(elem, tmp, list, node) in bpf_stream_free_list()
102 bpf_stream_free_elem(elem); in bpf_stream_free_list()
144 static bool bpf_stream_consume_elem(struct bpf_stream_elem *elem, int *len) in bpf_stream_consume_elem() argument
146 int rem = elem->total_len - elem->consumed_len; in bpf_stream_consume_elem()
149 elem->consumed_len += used; in bpf_stream_consume_elem()
152 return elem->consumed_len == elem->total_len; in bpf_stream_consume_elem()
158 struct bpf_stream_elem *elem = NULL; in bpf_stream_read() local
174 elem = container_of(node, typeof(*elem), node); in bpf_stream_read()
176 cons_len = elem->consumed_len; in bpf_stream_read()
177 cont = bpf_stream_consume_elem(elem, &rem_len) == false; in bpf_stream_read()
179 ret = copy_to_user(buf + pos, elem->str + cons_len, in bpf_stream_read()
180 elem->consumed_len - cons_len); in bpf_stream_read()
184 elem->consumed_len = cons_len; in bpf_stream_read()
191 bpf_stream_release_capacity(stream, elem); in bpf_stream_read()
192 bpf_stream_free_elem(elem); in bpf_stream_read()