1/* 2 * Copyright (C) 2012 Red Hat Inc, Steven Rostedt <srostedt@redhat.com> 3 * 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!) 9 * 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. 14 * 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. 18 * 19 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 20 */ 21#ifndef _KBUFFER_H 22#define _KBUFFER_H 23 24#ifndef TS_SHIFT 25#define TS_SHIFT 27 26#endif 27 28enum kbuffer_endian { 29 KBUFFER_ENDIAN_BIG, 30 KBUFFER_ENDIAN_LITTLE, 31}; 32 33enum kbuffer_long_size { 34 KBUFFER_LSIZE_4, 35 KBUFFER_LSIZE_8, 36}; 37 38enum { 39 KBUFFER_TYPE_PADDING = 29, 40 KBUFFER_TYPE_TIME_EXTEND = 30, 41 KBUFFER_TYPE_TIME_STAMP = 31, 42}; 43 44struct kbuffer; 45 46struct kbuffer *kbuffer_alloc(enum kbuffer_long_size size, enum kbuffer_endian endian); 47void kbuffer_free(struct kbuffer *kbuf); 48int kbuffer_load_subbuffer(struct kbuffer *kbuf, void *subbuffer); 49void *kbuffer_read_event(struct kbuffer *kbuf, unsigned long long *ts); 50void *kbuffer_next_event(struct kbuffer *kbuf, unsigned long long *ts); 51unsigned long long kbuffer_timestamp(struct kbuffer *kbuf); 52 53void *kbuffer_translate_data(int swap, void *data, unsigned int *size); 54 55void *kbuffer_read_at_offset(struct kbuffer *kbuf, int offset, unsigned long long *ts); 56 57int kbuffer_curr_index(struct kbuffer *kbuf); 58 59int kbuffer_curr_offset(struct kbuffer *kbuf); 60int kbuffer_curr_size(struct kbuffer *kbuf); 61int kbuffer_event_size(struct kbuffer *kbuf); 62int kbuffer_missed_events(struct kbuffer *kbuf); 63int kbuffer_subbuffer_size(struct kbuffer *kbuf); 64 65void kbuffer_set_old_format(struct kbuffer *kbuf); 66int kbuffer_start_of_data(struct kbuffer *kbuf); 67 68#endif /* _K_BUFFER_H */ 69