Lines Matching defs:elem
112 static void bpf_stream_elem_init(struct bpf_stream_elem *elem, int len)
114 init_llist_node(&elem->node);
115 elem->total_len = len;
116 elem->consumed_len = 0;
119 static struct bpf_stream_page *bpf_stream_page_from_elem(struct bpf_stream_elem *elem)
121 unsigned long addr = (unsigned long)elem;
136 struct bpf_stream_elem *elem = NULL;
155 elem = bpf_stream_page_push_elem(page, room);
156 bpf_stream_elem_init(elem, room);
157 return elem;
163 struct bpf_stream_elem *elem;
177 elem = bpf_stream_page_reserve_elem(len);
179 return elem;
184 struct bpf_stream_elem *elem = NULL;
190 elem = bpf_stream_elem_alloc(len);
191 if (!elem)
194 memcpy(elem->str, str, len);
195 llist_add(&elem->node, log);
211 static void bpf_stream_release_capacity(struct bpf_stream *stream, struct bpf_stream_elem *elem)
213 int len = elem->total_len;
232 static void bpf_stream_free_elem(struct bpf_stream_elem *elem)
236 p = bpf_stream_page_from_elem(elem);
242 struct bpf_stream_elem *elem, *tmp;
244 llist_for_each_entry_safe(elem, tmp, list, node)
245 bpf_stream_free_elem(elem);
287 static bool bpf_stream_consume_elem(struct bpf_stream_elem *elem, int *len)
289 int rem = elem->total_len - elem->consumed_len;
292 elem->consumed_len += used;
295 return elem->consumed_len == elem->total_len;
301 struct bpf_stream_elem *elem = NULL;
317 elem = container_of(node, typeof(*elem), node);
319 cons_len = elem->consumed_len;
320 cont = bpf_stream_consume_elem(elem, &rem_len) == false;
322 ret = copy_to_user(buf + pos, elem->str + cons_len,
323 elem->consumed_len - cons_len);
327 elem->consumed_len = cons_len;
334 bpf_stream_release_capacity(stream, elem);
335 bpf_stream_free_elem(elem);