fix a kmap leak in virtio_console
[linux/fpc-iii.git] / tools / lib / traceevent / kbuffer.h
blobc831f64b17a06f70381abf2a3c5b3f9baa54994d
1 /*
2 * Copyright (C) 2012 Red Hat Inc, Steven Rostedt <srostedt@redhat.com>
4 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation;
8 * version 2.1 of the License (not later!)
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
21 #ifndef _KBUFFER_H
22 #define _KBUFFER_H
24 #ifndef TS_SHIFT
25 #define TS_SHIFT 27
26 #endif
28 enum kbuffer_endian {
29 KBUFFER_ENDIAN_BIG,
30 KBUFFER_ENDIAN_LITTLE,
33 enum kbuffer_long_size {
34 KBUFFER_LSIZE_4,
35 KBUFFER_LSIZE_8,
38 enum {
39 KBUFFER_TYPE_PADDING = 29,
40 KBUFFER_TYPE_TIME_EXTEND = 30,
41 KBUFFER_TYPE_TIME_STAMP = 31,
44 struct kbuffer;
46 struct kbuffer *kbuffer_alloc(enum kbuffer_long_size size, enum kbuffer_endian endian);
47 void kbuffer_free(struct kbuffer *kbuf);
48 int kbuffer_load_subbuffer(struct kbuffer *kbuf, void *subbuffer);
49 void *kbuffer_read_event(struct kbuffer *kbuf, unsigned long long *ts);
50 void *kbuffer_next_event(struct kbuffer *kbuf, unsigned long long *ts);
51 unsigned long long kbuffer_timestamp(struct kbuffer *kbuf);
53 void *kbuffer_translate_data(int swap, void *data, unsigned int *size);
55 void *kbuffer_read_at_offset(struct kbuffer *kbuf, int offset, unsigned long long *ts);
57 int kbuffer_curr_index(struct kbuffer *kbuf);
59 int kbuffer_curr_offset(struct kbuffer *kbuf);
60 int kbuffer_curr_size(struct kbuffer *kbuf);
61 int kbuffer_event_size(struct kbuffer *kbuf);
62 int kbuffer_missed_events(struct kbuffer *kbuf);
63 int kbuffer_subbuffer_size(struct kbuffer *kbuf);
65 void kbuffer_set_old_format(struct kbuffer *kbuf);
67 #endif /* _K_BUFFER_H */