Commit bdd6df6a authored by Eduard - Gabriel Munteanu's avatar Eduard - Gabriel Munteanu Committed by Ingo Molnar

tracing: provide trace_seq_reserve()

trace_seq_reserve() allows a caller to reserve space in a trace_seq and
write directly into it. This makes it easier to export binary data to
userspace via the tracing interface, by simply filling in a struct.
Signed-off-by: default avatarEduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 2a4efa42
......@@ -167,6 +167,19 @@ int trace_seq_putmem_hex(struct trace_seq *s, void *mem, size_t len)
return trace_seq_putmem(s, hex, j);
}
void *trace_seq_reserve(struct trace_seq *s, size_t len)
{
void *ret;
if (len > ((PAGE_SIZE - 1) - s->len))
return NULL;
ret = s->buffer + s->len;
s->len += len;
return ret;
}
int trace_seq_path(struct trace_seq *s, struct path *path)
{
unsigned char *p;
......
......@@ -33,6 +33,7 @@ int trace_seq_puts(struct trace_seq *s, const char *str);
int trace_seq_putc(struct trace_seq *s, unsigned char c);
int trace_seq_putmem(struct trace_seq *s, void *mem, size_t len);
int trace_seq_putmem_hex(struct trace_seq *s, void *mem, size_t len);
void *trace_seq_reserve(struct trace_seq *s, size_t len);
int trace_seq_path(struct trace_seq *s, struct path *path);
int seq_print_userip_objs(const struct userstack_entry *entry,
struct trace_seq *s, unsigned long sym_flags);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment