From d79865b92da224131f58ab311e75e49043b62c7a Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Tue, 28 Sep 2010 16:05:27 -0400 Subject: [PATCH] Move to babeltrace namespace Signed-off-by: Mathieu Desnoyers --- README | 7 + formats/ctf/types/enum.c | 2 +- formats/ctf/types/float.c | 36 ++--- formats/ctf/types/string.c | 2 +- formats/ctf/types/struct.c | 2 +- include/{ctf => babeltrace}/align.h | 8 +- include/{ctf => babeltrace}/bitfield.h | 138 +++++++++--------- include/babeltrace/compiler.h | 6 + .../ctf/types-bitfield.h} | 6 +- .../ctf-types.h => babeltrace/ctf/types.h} | 6 +- include/babeltrace/types.h | 26 ++++ include/ctf/compiler.h | 6 - tests/test-bitfield.c | 58 ++++---- types/types.c | 2 +- 14 files changed, 170 insertions(+), 135 deletions(-) create mode 100644 README rename include/{ctf => babeltrace}/align.h (95%) rename include/{ctf => babeltrace}/bitfield.h (71%) create mode 100644 include/babeltrace/compiler.h rename include/{ctf/ctf-types-bitfield.h => babeltrace/ctf/types-bitfield.h} (94%) rename include/{ctf/ctf-types.h => babeltrace/ctf/types.h} (96%) create mode 100644 include/babeltrace/types.h delete mode 100644 include/ctf/compiler.h diff --git a/README b/README new file mode 100644 index 00000000..e72ece8a --- /dev/null +++ b/README @@ -0,0 +1,7 @@ +BabelTrace - Trace Format Babel Tower +Mathieu Desnoyers, EfficiOS Inc. +September 2010 + +This project provides trace read and write libraries, as well as a trace +converter. A plugin can be created for any trace format to allow its conversion +to/from another trace format. diff --git a/formats/ctf/types/enum.c b/formats/ctf/types/enum.c index 507d0c35..5e0fda7d 100644 --- a/formats/ctf/types/enum.c +++ b/formats/ctf/types/enum.c @@ -20,7 +20,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include +#include #include #include diff --git a/formats/ctf/types/float.c b/formats/ctf/types/float.c index eb0291ec..a26e94cc 100644 --- a/formats/ctf/types/float.c +++ b/formats/ctf/types/float.c @@ -22,7 +22,7 @@ * Reference: ISO C99 standard 5.2.4 */ -#include +#include #include #include /* C99 floating point definitions */ #include @@ -103,22 +103,24 @@ void ctf_float_copy(unsigned char *destp, const struct ctf_float *dest, } /* sign */ - tmp.u = bitfield_unsigned_read(ptr, srcpos.sign_start, 1, - src->byte_order); - bitfield_unsigned_write(&u.bits, destpos.sign_start, 1, - dest->byte_order, tmp.u); + tmp.u = ctf_bitfield_unsigned_read(ptr, srcpos.sign_start, 1, + src->byte_order); + ctf_bitfield_unsigned_write(&u.bits, destpos.sign_start, 1, + dest->byte_order, tmp.u); /* mantissa (without leading 1). No sign extend. */ - tmp.u = bitfield_unsigned_read(ptr, srcpos.mantissa_start, - src->mantissa_len - 1, src->byte_order); - bitfield_unsigned_write(&u.bits, destpos.mantissa_start, - dest->mantissa_len - 1, dest->byte_order, tmp.u); + tmp.u = ctf_bitfield_unsigned_read(ptr, srcpos.mantissa_start, + src->mantissa_len - 1, + src->byte_order); + ctf_bitfield_unsigned_write(&u.bits, destpos.mantissa_start, + dest->mantissa_len - 1, dest->byte_order, + tmp.u); /* exponent, with sign-extend. */ - tmp.s = bitfield_signed_read(ptr, srcpos.exp_start, src->exp_len, - src->byte_order); - bitfield_signed_write(&u.bits, destpos.exp_start, dest->exp_len, - dest->byte_order, tmp.s); + tmp.s = ctf_bitfield_signed_read(ptr, srcpos.exp_start, src->exp_len, + src->byte_order); + ctf_bitfield_signed_write(&u.bits, destpos.exp_start, dest->exp_len, + dest->byte_order, tmp.s); } double ctf_double_read(const unsigned char *ptr, const struct ctf_float *src) @@ -130,7 +132,7 @@ double ctf_double_read(const unsigned char *ptr, const struct ctf_float *src) .byte_order = BYTE_ORDER, }; - float_copy(&u.bits, &dest, ptr, src); + ctf_float_copy(&u.bits, &dest, ptr, src); return u.v; } @@ -147,7 +149,7 @@ size_t ctf_double_write(unsigned char *ptr, const struct ctf_float *dest, if (!ptr) goto end; u.v = v; - float_copy(ptr, dest, &u.bits, &src); + ctf_float_copy(ptr, dest, &u.bits, &src); end: return len; } @@ -162,7 +164,7 @@ long double ctf_ldouble_read(const unsigned char *ptr, .byte_order = BYTE_ORDER, }; - float_copy(&u.bits, &dest, ptr, src); + ctf_float_copy(&u.bits, &dest, ptr, src); return u.v; } @@ -179,7 +181,7 @@ size_t ctf_ldouble_write(unsigned char *ptr, const struct ctf_float *dest, if (!ptr) goto end; u.v = v; - float_copy(ptr, dest, &u.bits, &src); + ctf_float_copy(ptr, dest, &u.bits, &src); end: return len; } diff --git a/formats/ctf/types/string.c b/formats/ctf/types/string.c index 578388d1..65018c74 100644 --- a/formats/ctf/types/string.c +++ b/formats/ctf/types/string.c @@ -20,7 +20,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include +#include #include size_t string_copy(char *dest, const char *src) diff --git a/formats/ctf/types/struct.c b/formats/ctf/types/struct.c index 3aa8d587..8d248da1 100644 --- a/formats/ctf/types/struct.c +++ b/formats/ctf/types/struct.c @@ -20,7 +20,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include +#include #include diff --git a/include/ctf/align.h b/include/babeltrace/align.h similarity index 95% rename from include/ctf/align.h rename to include/babeltrace/align.h index 5adac7f3..85ee42fa 100644 --- a/include/ctf/align.h +++ b/include/babeltrace/align.h @@ -1,8 +1,8 @@ -#ifndef _CTF_ALIGN_H -#define _CTF_ALIGN_H +#ifndef _BABELTRACE_ALIGN_H +#define _BABELTRACE_ALIGN_H /* - * align.h - alignment header + * BabelTrace align.h - alignment header * * Copyright (c) 2010 Mathieu Desnoyers * @@ -69,4 +69,4 @@ (((align_drift) - (alignment)) & ((alignment) - 1); \ }) -#endif /* _CTF_ALIGN_H */ +#endif /* _BABELTRACE_ALIGN_H */ diff --git a/include/ctf/bitfield.h b/include/babeltrace/bitfield.h similarity index 71% rename from include/ctf/bitfield.h rename to include/babeltrace/bitfield.h index e1eb3abc..74d8228c 100644 --- a/include/ctf/bitfield.h +++ b/include/babeltrace/bitfield.h @@ -1,8 +1,8 @@ -#ifndef _CTF_BITFIELD_H -#define _CTF_BITFIELD_H +#ifndef _BABELTRACE_BITFIELD_H +#define _BABELTRACE_BITFIELD_H /* - * Common Trace Format + * BabelTrace * * Bitfields read/write functions. * @@ -25,7 +25,7 @@ #include /* We can't shift a int from 32 bit, >> 32 and << 32 on int is undefined */ -#define _ctf_piecewise_rshift(v, shift) \ +#define _bt_piecewise_rshift(v, shift) \ ({ \ unsigned long sb = (shift) / (sizeof(v) * CHAR_BIT - 1); \ unsigned long final = (shift) % (sizeof(v) * CHAR_BIT - 1); \ @@ -36,7 +36,7 @@ _v >>= final; \ }) -#define _ctf_piecewise_lshift(v, shift) \ +#define _bt_piecewise_lshift(v, shift) \ ({ \ unsigned long sb = (shift) / (sizeof(v) * CHAR_BIT - 1); \ unsigned long final = (shift) % (sizeof(v) * CHAR_BIT - 1); \ @@ -47,9 +47,9 @@ _v <<= final; \ }) -#define _ctf_is_signed_type(type) (((type)(-1)) < 0) +#define _bt_is_signed_type(type) (((type)(-1)) < 0) -#define _ctf_unsigned_cast(type, v) \ +#define _bt_unsigned_cast(type, v) \ ({ \ (sizeof(v) < sizeof(type)) ? \ ((type) (v)) & (~(~(type) 0 << (sizeof(v) * CHAR_BIT))) : \ @@ -57,7 +57,7 @@ }) /* - * ctf_bitfield_write - write integer to a bitfield in native endianness + * bt_bitfield_write - write integer to a bitfield in native endianness * * Save integer to the bitfield, which starts at the "start" bit, has "len" * bits. @@ -74,7 +74,7 @@ * Also, consecutive bitfields are placed from higher to lower bits. */ -#define _ctf_bitfield_write_le(ptr, _start, _length, _v) \ +#define _bt_bitfield_write_le(ptr, _start, _length, _v) \ do { \ typeof(_v) v = (_v); \ typeof(*(ptr)) mask, cmask; \ @@ -113,13 +113,13 @@ do { \ cmask &= ~mask; \ (ptr)[this_unit] &= mask; \ (ptr)[this_unit] |= cmask; \ - v = _ctf_piecewise_rshift(v, ts - cshift); \ + v = _bt_piecewise_rshift(v, ts - cshift); \ start += ts - cshift; \ this_unit++; \ } \ for (; this_unit < end_unit - 1; this_unit++) { \ (ptr)[this_unit] = (typeof(*(ptr))) v; \ - v = _ctf_piecewise_rshift(v, ts); \ + v = _bt_piecewise_rshift(v, ts); \ start += ts; \ } \ if (end % ts) { \ @@ -132,7 +132,7 @@ do { \ (ptr)[this_unit] = (typeof(*(ptr))) v; \ } while (0) -#define _ctf_bitfield_write_be(ptr, _start, _length, _v) \ +#define _bt_bitfield_write_be(ptr, _start, _length, _v) \ do { \ typeof(_v) v = (_v); \ typeof(*(ptr)) mask, cmask; \ @@ -171,13 +171,13 @@ do { \ cmask &= ~mask; \ (ptr)[this_unit] &= mask; \ (ptr)[this_unit] |= cmask; \ - v = _ctf_piecewise_rshift(v, cshift); \ + v = _bt_piecewise_rshift(v, cshift); \ end -= cshift; \ this_unit--; \ } \ for (; (long) this_unit >= (long) start_unit + 1; this_unit--) { \ (ptr)[this_unit] = (typeof(*(ptr))) v; \ - v = _ctf_piecewise_rshift(v, ts); \ + v = _bt_piecewise_rshift(v, ts); \ end -= ts; \ } \ if (start % ts) { \ @@ -191,32 +191,32 @@ do { \ } while (0) /* - * ctf_bitfield_write - write integer to a bitfield in native endianness - * ctf_bitfield_write_le - write integer to a bitfield in little endian - * ctf_bitfield_write_be - write integer to a bitfield in big endian + * bt_bitfield_write - write integer to a bitfield in native endianness + * bt_bitfield_write_le - write integer to a bitfield in little endian + * bt_bitfield_write_be - write integer to a bitfield in big endian */ #if (BYTE_ORDER == LITTLE_ENDIAN) -#define ctf_bitfield_write(ptr, _start, _length, _v) \ - _ctf_bitfield_write_le(ptr, _start, _length, _v) +#define bt_bitfield_write(ptr, _start, _length, _v) \ + _bt_bitfield_write_le(ptr, _start, _length, _v) -#define ctf_bitfield_write_le(ptr, _start, _length, _v) \ - _ctf_bitfield_write_le(ptr, _start, _length, _v) +#define bt_bitfield_write_le(ptr, _start, _length, _v) \ + _bt_bitfield_write_le(ptr, _start, _length, _v) -#define ctf_bitfield_write_be(ptr, _start, _length, _v) \ - _ctf_bitfield_write_be((unsigned char *) (ptr), _start, _length, _v) +#define bt_bitfield_write_be(ptr, _start, _length, _v) \ + _bt_bitfield_write_be((unsigned char *) (ptr), _start, _length, _v) #elif (BYTE_ORDER == BIG_ENDIAN) -#define ctf_bitfield_write(ptr, _start, _length, _v) \ - _ctf_bitfield_write_be(ptr, _start, _length, _v) +#define bt_bitfield_write(ptr, _start, _length, _v) \ + _bt_bitfield_write_be(ptr, _start, _length, _v) -#define ctf_bitfield_write_le(ptr, _start, _length, _v) \ - _ctf_bitfield_write_le((unsigned char *) (ptr), _start, _length, _v) +#define bt_bitfield_write_le(ptr, _start, _length, _v) \ + _bt_bitfield_write_le((unsigned char *) (ptr), _start, _length, _v) -#define ctf_bitfield_write_be(ptr, _start, _length, _v) \ - _ctf_bitfield_write_be(ptr, _start, _length, _v) +#define bt_bitfield_write_be(ptr, _start, _length, _v) \ + _bt_bitfield_write_be(ptr, _start, _length, _v) #else /* (BYTE_ORDER == PDP_ENDIAN) */ @@ -224,7 +224,7 @@ do { \ #endif -#define _ctf_bitfield_read_le(ptr, _start, _length, vptr) \ +#define _bt_bitfield_read_le(ptr, _start, _length, vptr) \ do { \ typeof(*(vptr)) v; \ typeof(*(ptr)) mask, cmask; \ @@ -243,7 +243,7 @@ do { \ end_unit = (end + (ts - 1)) / ts; \ \ this_unit = end_unit - 1; \ - if (_ctf_is_signed_type(typeof(v)) \ + if (_bt_is_signed_type(typeof(v)) \ && ((ptr)[this_unit] & ((typeof(*(ptr))) 1 << ((end % ts ? : ts) - 1)))) \ v = ~(typeof(v)) 0; \ else \ @@ -255,8 +255,8 @@ do { \ mask = ~((~(typeof(*(ptr))) 0) << (end - start)); \ cmask &= mask; \ } \ - v = _ctf_piecewise_lshift(v, end - start); \ - v |= _ctf_unsigned_cast(typeof(v), cmask); \ + v = _bt_piecewise_lshift(v, end - start); \ + v |= _bt_unsigned_cast(typeof(v), cmask); \ *(vptr) = v; \ break; \ } \ @@ -265,14 +265,14 @@ do { \ mask = ~((~(typeof(*(ptr))) 0) << cshift); \ cmask = (ptr)[this_unit]; \ cmask &= mask; \ - v = _ctf_piecewise_lshift(v, cshift); \ - v |= _ctf_unsigned_cast(typeof(v), cmask); \ + v = _bt_piecewise_lshift(v, cshift); \ + v |= _bt_unsigned_cast(typeof(v), cmask); \ end -= cshift; \ this_unit--; \ } \ for (; (long) this_unit >= (long) start_unit + 1; this_unit--) { \ - v = _ctf_piecewise_lshift(v, ts); \ - v |= _ctf_unsigned_cast(typeof(v), (ptr)[this_unit]); \ + v = _bt_piecewise_lshift(v, ts); \ + v |= _bt_unsigned_cast(typeof(v), (ptr)[this_unit]); \ end -= ts; \ } \ if (start % ts) { \ @@ -280,16 +280,16 @@ do { \ cmask = (ptr)[this_unit]; \ cmask >>= (start % ts); \ cmask &= mask; \ - v = _ctf_piecewise_lshift(v, ts - (start % ts)); \ - v |= _ctf_unsigned_cast(typeof(v), cmask); \ + v = _bt_piecewise_lshift(v, ts - (start % ts)); \ + v |= _bt_unsigned_cast(typeof(v), cmask); \ } else { \ - v = _ctf_piecewise_lshift(v, ts); \ - v |= _ctf_unsigned_cast(typeof(v), (ptr)[this_unit]); \ + v = _bt_piecewise_lshift(v, ts); \ + v |= _bt_unsigned_cast(typeof(v), (ptr)[this_unit]); \ } \ *(vptr) = v; \ } while (0) -#define _ctf_bitfield_read_be(ptr, _start, _length, vptr) \ +#define _bt_bitfield_read_be(ptr, _start, _length, vptr) \ do { \ typeof(*(vptr)) v; \ typeof(*(ptr)) mask, cmask; \ @@ -308,7 +308,7 @@ do { \ end_unit = (end + (ts - 1)) / ts; \ \ this_unit = start_unit; \ - if (_ctf_is_signed_type(typeof(v)) \ + if (_bt_is_signed_type(typeof(v)) \ && ((ptr)[this_unit] & ((typeof(*(ptr))) 1 << (ts - (start % ts) - 1)))) \ v = ~(typeof(v)) 0; \ else \ @@ -320,8 +320,8 @@ do { \ mask = ~((~(typeof(*(ptr))) 0) << (end - start)); \ cmask &= mask; \ } \ - v = _ctf_piecewise_lshift(v, end - start); \ - v |= _ctf_unsigned_cast(typeof(v), cmask); \ + v = _bt_piecewise_lshift(v, end - start); \ + v |= _bt_unsigned_cast(typeof(v), cmask); \ *(vptr) = v; \ break; \ } \ @@ -329,14 +329,14 @@ do { \ mask = ~((~(typeof(*(ptr))) 0) << (ts - (start % ts))); \ cmask = (ptr)[this_unit]; \ cmask &= mask; \ - v = _ctf_piecewise_lshift(v, ts - (start % ts)); \ - v |= _ctf_unsigned_cast(typeof(v), cmask); \ + v = _bt_piecewise_lshift(v, ts - (start % ts)); \ + v |= _bt_unsigned_cast(typeof(v), cmask); \ start += ts - (start % ts); \ this_unit++; \ } \ for (; this_unit < end_unit - 1; this_unit++) { \ - v = _ctf_piecewise_lshift(v, ts); \ - v |= _ctf_unsigned_cast(typeof(v), (ptr)[this_unit]); \ + v = _bt_piecewise_lshift(v, ts); \ + v |= _bt_unsigned_cast(typeof(v), (ptr)[this_unit]); \ start += ts; \ } \ if (end % ts) { \ @@ -344,42 +344,42 @@ do { \ cmask = (ptr)[this_unit]; \ cmask >>= ts - (end % ts); \ cmask &= mask; \ - v = _ctf_piecewise_lshift(v, end % ts); \ - v |= _ctf_unsigned_cast(typeof(v), cmask); \ + v = _bt_piecewise_lshift(v, end % ts); \ + v |= _bt_unsigned_cast(typeof(v), cmask); \ } else { \ - v = _ctf_piecewise_lshift(v, ts); \ - v |= _ctf_unsigned_cast(typeof(v), (ptr)[this_unit]); \ + v = _bt_piecewise_lshift(v, ts); \ + v |= _bt_unsigned_cast(typeof(v), (ptr)[this_unit]); \ } \ *(vptr) = v; \ } while (0) /* - * ctf_bitfield_read - read integer from a bitfield in native endianness - * ctf_bitfield_read_le - read integer from a bitfield in little endian - * ctf_bitfield_read_be - read integer from a bitfield in big endian + * bt_bitfield_read - read integer from a bitfield in native endianness + * bt_bitfield_read_le - read integer from a bitfield in little endian + * bt_bitfield_read_be - read integer from a bitfield in big endian */ #if (BYTE_ORDER == LITTLE_ENDIAN) -#define ctf_bitfield_read(ptr, _start, _length, _vptr) \ - _ctf_bitfield_read_le(ptr, _start, _length, _vptr) +#define bt_bitfield_read(ptr, _start, _length, _vptr) \ + _bt_bitfield_read_le(ptr, _start, _length, _vptr) -#define ctf_bitfield_read_le(ptr, _start, _length, _vptr) \ - _ctf_bitfield_read_le(ptr, _start, _length, _vptr) +#define bt_bitfield_read_le(ptr, _start, _length, _vptr) \ + _bt_bitfield_read_le(ptr, _start, _length, _vptr) -#define ctf_bitfield_read_be(ptr, _start, _length, _vptr) \ - _ctf_bitfield_read_be((const unsigned char *) (ptr), _start, _length, _vptr) +#define bt_bitfield_read_be(ptr, _start, _length, _vptr) \ + _bt_bitfield_read_be((const unsigned char *) (ptr), _start, _length, _vptr) #elif (BYTE_ORDER == BIG_ENDIAN) -#define ctf_bitfield_read(ptr, _start, _length, _vptr) \ - _ctf_bitfield_read_be(ptr, _start, _length, _vptr) +#define bt_bitfield_read(ptr, _start, _length, _vptr) \ + _bt_bitfield_read_be(ptr, _start, _length, _vptr) -#define ctf_bitfield_read_le(ptr, _start, _length, _vptr) \ - _ctf_bitfield_read_le((const unsigned char *) (ptr), _start, _length, _vptr) +#define bt_bitfield_read_le(ptr, _start, _length, _vptr) \ + _bt_bitfield_read_le((const unsigned char *) (ptr), _start, _length, _vptr) -#define ctf_bitfield_read_be(ptr, _start, _length, _vptr) \ - _ctf_bitfield_read_be(ptr, _start, _length, _vptr) +#define bt_bitfield_read_be(ptr, _start, _length, _vptr) \ + _bt_bitfield_read_be(ptr, _start, _length, _vptr) #else /* (BYTE_ORDER == PDP_ENDIAN) */ @@ -387,4 +387,4 @@ do { \ #endif -#endif /* _CTF_BITFIELD_H */ +#endif /* _BABELTRACE_BITFIELD_H */ diff --git a/include/babeltrace/compiler.h b/include/babeltrace/compiler.h new file mode 100644 index 00000000..7850ded6 --- /dev/null +++ b/include/babeltrace/compiler.h @@ -0,0 +1,6 @@ +#ifndef _BABELTRACE_COMPILER_H +#define _BABELTRACE_COMPILER_H + +#define MAYBE_BUILD_BUG_ON(cond) ((void)sizeof(char[1 - 2 * !!(cond)])) + +#endif /* _BABELTRACE_COMPILER_H */ diff --git a/include/ctf/ctf-types-bitfield.h b/include/babeltrace/ctf/types-bitfield.h similarity index 94% rename from include/ctf/ctf-types-bitfield.h rename to include/babeltrace/ctf/types-bitfield.h index 82ee1120..c425a8e2 100644 --- a/include/ctf/ctf-types-bitfield.h +++ b/include/babeltrace/ctf/types-bitfield.h @@ -1,5 +1,5 @@ -#ifndef _CTF_TYPES_BITFIELD_H -#define _CTF_TYPES_BITFIELD_H +#ifndef _BABELTRACE_CTF_TYPES_BITFIELD_H +#define _BABELTRACE_CTF_TYPES_BITFIELD_H /* * Common Trace Format @@ -84,4 +84,4 @@ end: return len; } -#endif /* _CTF_TYPES_BITFIELD_H */ +#endif /* _BABELTRACE_CTF_TYPES_BITFIELD_H */ diff --git a/include/ctf/ctf-types.h b/include/babeltrace/ctf/types.h similarity index 96% rename from include/ctf/ctf-types.h rename to include/babeltrace/ctf/types.h index 25ec3466..276152db 100644 --- a/include/ctf/ctf-types.h +++ b/include/babeltrace/ctf/types.h @@ -1,5 +1,5 @@ -#ifndef _CTF_TYPES_H -#define _CTF_TYPES_H +#ifndef _BABELTRACE_CTF_TYPES_H +#define _BABELTRACE_CTF_TYPES_H /* * Common Trace Format @@ -80,4 +80,4 @@ void ctf_enum_unsigned_insert(struct enum_table *table, uint64_t v, GQuark q); struct enum_table *ctf_enum_new(void); void ctf_enum_destroy(struct enum_table *table); -#endif /* _CTF_TYPES_H */ +#endif /* _BABELTRACE_CTF_TYPES_H */ diff --git a/include/babeltrace/types.h b/include/babeltrace/types.h new file mode 100644 index 00000000..23fec0fc --- /dev/null +++ b/include/babeltrace/types.h @@ -0,0 +1,26 @@ +#ifndef _BABELTRACE_TYPES_H +#define _BABELTRACE_TYPES_H + +/* + * BabelTrace + * + * Type header + * + * Copyright (c) 2010 Mathieu Desnoyers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#endif /* _BABELTRACE_TYPES_H */ diff --git a/include/ctf/compiler.h b/include/ctf/compiler.h deleted file mode 100644 index eadef213..00000000 --- a/include/ctf/compiler.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef _CTF_COMPILER_H -#define _CTF_COMPILER_H - -#define MAYBE_BUILD_BUG_ON(cond) ((void)sizeof(char[1 - 2 * !!(cond)])) - -#endif /* _CTF_COMPILER_H */ diff --git a/tests/test-bitfield.c b/tests/test-bitfield.c index 5911eb46..f8b63853 100644 --- a/tests/test-bitfield.c +++ b/tests/test-bitfield.c @@ -1,7 +1,7 @@ /* * test-bitfield.c * - * Common Trace Format - bitfield test program + * BabelTrace - bitfield test program * * Copyright 2010 - Mathieu Desnoyers * @@ -21,7 +21,7 @@ */ #define _GNU_SOURCE -#include +#include #include unsigned int glob; @@ -32,7 +32,7 @@ unsigned int glob; */ void fct(void) { - ctf_bitfield_write(&glob, 12, 15, 0x12345678); + bt_bitfield_write(&glob, 12, 15, 0x12345678); } /* Test array size, in bytes */ @@ -139,8 +139,8 @@ int run_test_unsigned(void) for (s = 0; s < CHAR_BIT * TEST_LEN; s++) { for (l = nrbits; l < (CHAR_BIT * TEST_LEN) - s; l++) { init_byte_array(target.c, TEST_LEN, 0xFF); - ctf_bitfield_write(target.c, s, l, src); - ctf_bitfield_read(target.c, s, l, &readval); + bt_bitfield_write(target.c, s, l, src); + bt_bitfield_read(target.c, s, l, &readval); if (readval != src) { printf("Error (bytewise) src %lX read %llX shift %d len %d\n", src, readval, s, l); @@ -149,8 +149,8 @@ int run_test_unsigned(void) } init_byte_array(target.c, TEST_LEN, 0xFF); - ctf_bitfield_write(target.s, s, l, src); - ctf_bitfield_read(target.c, s, l, &readval); + bt_bitfield_write(target.s, s, l, src); + bt_bitfield_read(target.c, s, l, &readval); if (readval != src) { printf("Error (shortwise) src %lX read %llX shift %d len %d\n", src, readval, s, l); @@ -159,8 +159,8 @@ int run_test_unsigned(void) } init_byte_array(target.c, TEST_LEN, 0xFF); - ctf_bitfield_write(target.i, s, l, src); - ctf_bitfield_read(target.c, s, l, &readval); + bt_bitfield_write(target.i, s, l, src); + bt_bitfield_read(target.c, s, l, &readval); if (readval != src) { printf("Error (intwise) src %lX read %llX shift %d len %d\n", src, readval, s, l); @@ -169,8 +169,8 @@ int run_test_unsigned(void) } init_byte_array(target.c, TEST_LEN, 0xFF); - ctf_bitfield_write(target.l, s, l, src); - ctf_bitfield_read(target.c, s, l, &readval); + bt_bitfield_write(target.l, s, l, src); + bt_bitfield_read(target.c, s, l, &readval); if (readval != src) { printf("Error (longwise) src %lX read %llX shift %d len %d\n", src, readval, s, l); @@ -179,8 +179,8 @@ int run_test_unsigned(void) } init_byte_array(target.c, TEST_LEN, 0xFF); - ctf_bitfield_write(target.ll, s, l, src); - ctf_bitfield_read(target.c, s, l, &readval); + bt_bitfield_write(target.ll, s, l, src); + bt_bitfield_read(target.c, s, l, &readval); if (readval != src) { printf("Error (longlongwise) src %lX read %llX shift %d len %d\n", src, readval, s, l); @@ -221,8 +221,8 @@ int run_test_signed(void) for (s = 0; s < 8 * TEST_LEN; s++) { for (l = nrbits; l < (8 * TEST_LEN) - s; l++) { init_byte_array(target.c, TEST_LEN, 0x0); - ctf_bitfield_write(target.c, s, l, src); - ctf_bitfield_read(target.c, s, l, &readval); + bt_bitfield_write(target.c, s, l, src); + bt_bitfield_read(target.c, s, l, &readval); if (readval != src) { printf("Error (bytewise) src %lX read %llX shift %d len %d\n", src, readval, s, l); @@ -231,8 +231,8 @@ int run_test_signed(void) } init_byte_array(target.c, TEST_LEN, 0x0); - ctf_bitfield_write(target.s, s, l, src); - ctf_bitfield_read(target.c, s, l, &readval); + bt_bitfield_write(target.s, s, l, src); + bt_bitfield_read(target.c, s, l, &readval); if (readval != src) { printf("Error (shortwise) src %lX read %llX shift %d len %d\n", src, readval, s, l); @@ -241,8 +241,8 @@ int run_test_signed(void) } init_byte_array(target.c, TEST_LEN, 0x0); - ctf_bitfield_write(target.i, s, l, src); - ctf_bitfield_read(target.c, s, l, &readval); + bt_bitfield_write(target.i, s, l, src); + bt_bitfield_read(target.c, s, l, &readval); if (readval != src) { printf("Error (intwise) src %lX read %llX shift %d len %d\n", src, readval, s, l); @@ -251,8 +251,8 @@ int run_test_signed(void) } init_byte_array(target.c, TEST_LEN, 0x0); - ctf_bitfield_write(target.l, s, l, src); - ctf_bitfield_read(target.c, s, l, &readval); + bt_bitfield_write(target.l, s, l, src); + bt_bitfield_read(target.c, s, l, &readval); if (readval != src) { printf("Error (longwise) src %lX read %llX shift %d len %d\n", src, readval, s, l); @@ -261,8 +261,8 @@ int run_test_signed(void) } init_byte_array(target.c, TEST_LEN, 0x0); - ctf_bitfield_write(target.ll, s, l, src); - ctf_bitfield_read(target.c, s, l, &readval); + bt_bitfield_write(target.ll, s, l, src); + bt_bitfield_read(target.c, s, l, &readval); if (readval != src) { printf("Error (longlongwise) src %lX read %llX shift %d len %d\n", src, readval, s, l); @@ -335,35 +335,35 @@ int main(int argc, char **argv) target.i[0] = 0xFFFFFFFF; target.i[1] = 0xFFFFFFFF; - ctf_bitfield_write(target.c, shift, len, src); + bt_bitfield_write(target.c, shift, len, src); printf("bytewise\n"); print_byte_array(target.c, 8); target.i[0] = 0xFFFFFFFF; target.i[1] = 0xFFFFFFFF; - ctf_bitfield_write(target.s, shift, len, src); + bt_bitfield_write(target.s, shift, len, src); printf("shortwise\n"); print_byte_array(target.c, 8); target.i[0] = 0xFFFFFFFF; target.i[1] = 0xFFFFFFFF; - ctf_bitfield_write(target.i, shift, len, src); + bt_bitfield_write(target.i, shift, len, src); printf("intwise\n"); print_byte_array(target.c, 8); target.i[0] = 0xFFFFFFFF; target.i[1] = 0xFFFFFFFF; - ctf_bitfield_write(target.l, shift, len, src); + bt_bitfield_write(target.l, shift, len, src); printf("longwise\n"); print_byte_array(target.c, 8); target.i[0] = 0xFFFFFFFF; target.i[1] = 0xFFFFFFFF; - ctf_bitfield_write(target.ll, shift, len, src); + bt_bitfield_write(target.ll, shift, len, src); printf("lluwise\n"); print_byte_array(target.c, 8); - ctf_bitfield_read(target.c, shift, len, &readval); + bt_bitfield_read(target.c, shift, len, &readval); printf("read: %llX\n", readval); ret = run_test(); diff --git a/types/types.c b/types/types.c index f4843e6a..28242d23 100644 --- a/types/types.c +++ b/types/types.c @@ -1,5 +1,5 @@ /* - * Common Trace Format - Converter + * BabelTrace - Converter * * Types registry. * -- 2.34.1