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