From: Pierre-Marc Fournier Date: Thu, 11 Jun 2009 17:38:27 +0000 (-0400) Subject: libust: put offset macros in buffer.h X-Git-Tag: v1.9.1~995 X-Git-Url: http://git.lttng.org./?a=commitdiff_plain;h=a6de76185dd1e98838d6801e34356f012df7544c;p=lttng-ust.git libust: put offset macros in buffer.h This is to resolve a dependency issue. --- diff --git a/libust/buffer.h b/libust/buffer.h new file mode 100644 index 00000000..c974a0b6 --- /dev/null +++ b/libust/buffer.h @@ -0,0 +1,22 @@ +#ifndef UST_BUFFER_H +#define UST_BUFFER_H + +/* Buffer offset macros */ + +/* + * BUFFER_TRUNC zeroes the subbuffer offset and the subbuffer number parts of + * the offset, which leaves only the buffer number. + */ +#define BUFFER_TRUNC(offset, chan) \ + ((offset) & (~((chan)->alloc_size-1))) +#define BUFFER_OFFSET(offset, chan) ((offset) & ((chan)->alloc_size - 1)) +#define SUBBUF_OFFSET(offset, chan) ((offset) & ((chan)->subbuf_size - 1)) +#define SUBBUF_ALIGN(offset, chan) \ + (((offset) + (chan)->subbuf_size) & (~((chan)->subbuf_size - 1))) +#define SUBBUF_TRUNC(offset, chan) \ + ((offset) & (~((chan)->subbuf_size - 1))) +#define SUBBUF_INDEX(offset, chan) \ + (BUFFER_OFFSET((offset), chan) >> (chan)->subbuf_size_order) + + +#endif /* UST_BUFFER_H */ diff --git a/libust/tracer.h b/libust/tracer.h index 079e467b..16443273 100644 --- a/libust/tracer.h +++ b/libust/tracer.h @@ -16,6 +16,7 @@ #include //#include "list.h" #include "kernelcompat.h" +#include "buffer.h" #include "relay.h" #include "channels.h" #include "tracercore.h" @@ -430,23 +431,6 @@ static inline size_t ltt_write_event_header(struct ltt_trace_struct *trace, /* Lockless LTTng */ -/* Buffer offset macros */ - -/* - * BUFFER_TRUNC zeroes the subbuffer offset and the subbuffer number parts of - * the offset, which leaves only the buffer number. - */ -#define BUFFER_TRUNC(offset, chan) \ - ((offset) & (~((chan)->alloc_size-1))) -#define BUFFER_OFFSET(offset, chan) ((offset) & ((chan)->alloc_size - 1)) -#define SUBBUF_OFFSET(offset, chan) ((offset) & ((chan)->subbuf_size - 1)) -#define SUBBUF_ALIGN(offset, chan) \ - (((offset) + (chan)->subbuf_size) & (~((chan)->subbuf_size - 1))) -#define SUBBUF_TRUNC(offset, chan) \ - ((offset) & (~((chan)->subbuf_size - 1))) -#define SUBBUF_INDEX(offset, chan) \ - (BUFFER_OFFSET((offset), chan) >> (chan)->subbuf_size_order) - /* * ltt_reserve_slot *