Implement array and sequence bitfields
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 8 Oct 2015 20:02:06 +0000 (16:02 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 21 Oct 2015 19:40:34 +0000 (15:40 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
instrumentation/events/lttng-module/lttng-test.h
lttng-events.c
lttng-events.h
probes/lttng-events-nowrite.h
probes/lttng-events-reset.h
probes/lttng-events-write.h
probes/lttng-events.h
probes/lttng-types.h

index 5b6f3371d68346643a8864252e23313882f9a27c..78e4c57d670bd41836880ab5c7ac4d1f707511a6 100644 (file)
@@ -25,6 +25,8 @@ LTTNG_TRACEPOINT_EVENT(lttng_test_filter_event,
                ctf_sequence_text(char, seqfield2, text, size_t, textlen)
                ctf_string(stringfield, text)
                ctf_string(stringfield2, etext)
+               ctf_sequence_bitfield(long, bitfield_seq, values, uint8_t, 3)
+               ctf_array_bitfield(long, bitfield_array, values, 3)
        )
 )
 
index c1dc1acbc5124fde9369b6045adb0f3c12ffa01f..1f34fbbc3341afd6ce8094c02fba4ed4b818bb70 100644 (file)
@@ -1695,6 +1695,14 @@ int _lttng_field_statedump(struct lttng_session *session,
                const struct lttng_basic_type *elem_type;
 
                elem_type = &field->type.u.array.elem_type;
+               if (field->type.u.array.elem_alignment) {
+                       ret = lttng_metadata_printf(session,
+                       "               struct { } align(%u) _%s_padding;\n",
+                                       field->type.u.array.elem_alignment * CHAR_BIT,
+                                       field->name);
+                       if (ret)
+                               return ret;
+               }
                ret = lttng_metadata_printf(session,
                        "               integer { size = %u; align = %u; signed = %u; encoding = %s; base = %u;%s } _%s[%u];\n",
                        elem_type->u.basic.integer.size,
@@ -1741,6 +1749,14 @@ int _lttng_field_statedump(struct lttng_session *session,
                if (ret)
                        return ret;
 
+               if (field->type.u.sequence.elem_alignment) {
+                       ret = lttng_metadata_printf(session,
+                       "               struct { } align(%u) _%s_padding;\n",
+                                       field->type.u.sequence.elem_alignment * CHAR_BIT,
+                                       field->name);
+                       if (ret)
+                               return ret;
+               }
                ret = lttng_metadata_printf(session,
                        "               integer { size = %u; align = %u; signed = %u; encoding = %s; base = %u;%s } _%s[ __%s_length ];\n",
                        elem_type->u.basic.integer.size,
index 921bc1fc8342d9b7d2be1479cb8d50d07ef33e3c..234d4bcb9ff01f5aa83745f925e1775fd9eb5bd4 100644 (file)
@@ -71,15 +71,16 @@ struct lttng_enum_entry {
        const char *string;
 };
 
-#define __type_integer(_type, _byte_order, _base, _encoding)   \
+#define __type_integer(_type, _size, _alignment, _signedness,  \
+               _byte_order, _base, _encoding)  \
        {                                                       \
            .atype = atype_integer,                             \
            .u.basic.integer =                                  \
                {                                               \
-                 .size = sizeof(_type) * CHAR_BIT,             \
-                 .alignment = lttng_alignof(_type) * CHAR_BIT, \
-                 .signedness = lttng_is_signed_type(_type),    \
-                 .reverse_byte_order = _byte_order != __BYTE_ORDER,    \
+                 .size = (_size) ? : sizeof(_type) * CHAR_BIT, \
+                 .alignment = (_alignment) ? : lttng_alignof(_type) * CHAR_BIT, \
+                 .signedness = (_signedness) >= 0 ? (_signedness) : lttng_is_signed_type(_type), \
+                 .reverse_byte_order = _byte_order != __BYTE_ORDER, \
                  .base = _base,                                \
                  .encoding = lttng_encode_##_encoding,         \
                },                                              \
@@ -118,10 +119,12 @@ struct lttng_type {
                struct {
                        struct lttng_basic_type elem_type;
                        unsigned int length;            /* num. elems. */
+                       unsigned int elem_alignment;    /* alignment override */
                } array;
                struct {
                        struct lttng_basic_type length_type;
                        struct lttng_basic_type elem_type;
+                       unsigned int elem_alignment;    /* alignment override */
                } sequence;
        } u;
 };
index 69453ae63a0ca8555557810862d83cef20dde848..20034f385b449c06f0d72c002c4f42da59dbcdef 100644 (file)
 #define ctf_array_text_nowrite(_type, _item, _user_src, _length) \
        _ctf_array_encoded(_type, _item, _user_src, _length, UTF8, 0, 1)
 
+#undef ctf_array_bitfield_nowrite
+#define ctf_array_bitfield_nowrite(_type, _item, _src, _length)        \
+       _ctf_array_bitfield(_type, _item, _src, _length, 0, 1)
+
 #undef ctf_sequence_nowrite
 #define ctf_sequence_nowrite(_type, _item, _user_src, _length_type, _user_src_length) \
        _ctf_sequence_encoded(_type, _item, _user_src,          \
        _ctf_sequence_encoded(_type, _item, _user_src,          \
                        _length_type, _user_src_length, UTF8, __BYTE_ORDER, 10, 0, 1)
 
+#undef ctf_sequence_bitfield_nowrite
+#define ctf_sequence_bitfield_nowrite(_type, _item, _src, _length_type, _src_length) \
+       _ctf_sequence_bitfield(_type, _item, _src,              \
+                       _length_type, _src_length, 0, 1)
+
 #undef ctf_string_nowrite
 #define ctf_string_nowrite(_item, _user_src)                   \
        _ctf_string(_item, _user_src, 0, 1)
 #define ctf_user_array_text_nowrite(_type, _item, _user_src, _length) \
        _ctf_array_encoded(_type, _item, _user_src, _length, UTF8, 1, 1)
 
+#undef ctf_user_array_bitfield_nowrite
+#define ctf_user_array_bitfield_nowrite(_type, _item, _src, _length)   \
+       _ctf_array_bitfield(_type, _item, _src, _length, 1, 1)
+
 #undef ctf_user_sequence_nowrite
 #define ctf_user_sequence_nowrite(_type, _item, _user_src, _length_type, _user_src_length) \
        _ctf_sequence_encoded(_type, _item, _user_src,          \
        _ctf_sequence_encoded(_type, _item, _user_src,          \
                        _length_type, _user_src_length, UTF8, __BYTE_ORDER, 10, 1, 1)
 
+#undef ctf_user_sequence_bitfield_nowrite
+#define ctf_user_sequence_bitfield_nowrite(_type, _item, _src, _length_type, _src_length) \
+       _ctf_sequence_bitfield(_type, _item, _src,              \
+                       _length_type, _src_length, 1, 1)
+
 #undef ctf_user_string_nowrite
 #define ctf_user_string_nowrite(_item, _user_src)              \
        _ctf_string(_item, _user_src, 1, 1)
index bdd00cb6150fa33da716f3967a971a5502b090d7..1bc77820c20e73b11ebde2a379879c47be1af024 100644 (file)
 #define _ctf_array_encoded(_type, _item, _src, _length, _encoding, \
                        _user, _nowrite)
 
+#undef _ctf_array_bitfield
+#define _ctf_array_bitfield(_type, _item, _src, _length, _user, _nowrite)
+
 #undef _ctf_sequence_encoded
 #define _ctf_sequence_encoded(_type, _item, _src, _length_type, \
                        _src_length, _encoding, _byte_order, _base, _user, _nowrite)
 
+#undef _ctf_sequence_bitfield
+#define _ctf_sequence_bitfield(_type, _item, _src, _length_type, \
+                       _src_length, _byte_order, _user, _nowrite)
+
 #undef _ctf_string
 #define _ctf_string(_item, _src, _user, _nowrite)
 
 #undef ctf_array_text
 #define ctf_array_text(_type, _item, _src, _length)
 
+#undef ctf_array_bitfield
+#define ctf_array_bitfield(_type, _item, _src, _length)
+
 #undef ctf_sequence
 #define ctf_sequence(_type, _item, _src, _length_type, _src_length)
 
 #undef ctf_sequence_text
 #define ctf_sequence_text(_type, _item, _src, _length_type, _src_length)
 
+#undef ctf_sequence_bitfield
+#define ctf_sequence_bitfield(_type, _item, _src, _length_type, _src_length)
+
 #undef ctf_string
 #define ctf_string(_item, _src)
 
 #undef ctf_array_text_nowrite
 #define ctf_array_text_nowrite(_type, _item, _src, _length)
 
+#undef ctf_array_bitfield_nowrite
+#define ctf_array_bitfield_nowrite(_type, _item, _src, _length)
+
 #undef ctf_sequence_nowrite
 #define ctf_sequence_nowrite(_type, _item, _src, _length_type, _src_length)
 
 #undef ctf_sequence_text_nowrite
 #define ctf_sequence_text_nowrite(_type, _item, _src, _length_type, _src_length)
 
+#undef ctf_sequence_bitfield_nowrite
+#define ctf_sequence_bitfield_nowrite(_type, _item, _src, _length_type, _src_length)
+
 #undef ctf_string_nowrite
 #define ctf_string_nowrite(_item, _src)
 
 #undef ctf_user_array_text
 #define ctf_user_array_text(_type, _item, _user_src, _length)
 
+#undef ctf_user_array_bitfield
+#define ctf_user_array_bitfield(_type, _item, _src, _length)
+
 #undef ctf_user_sequence
 #define ctf_user_sequence(_type, _item, _user_src, _length_type, _user_src_length)
 
 #undef ctf_user_sequence_text
 #define ctf_user_sequence_text(_type, _item, _user_src, _length_type, _user_src_length)
 
+#undef ctf_user_sequence_bitfield
+#define ctf_user_sequence_bitfield(_type, _item, _src, _length_type, _src_length)
+
 #undef ctf_user_string
 #define ctf_user_string(_item, _user_src)
 
 #undef ctf_user_array_text_nowrite
 #define ctf_user_array_text_nowrite(_type, _item, _user_src, _length)
 
+#undef ctf_user_array_bitfield_nowrite
+#define ctf_user_array_bitfield_nowrite(_type, _item, _src, _length)
+
 #undef ctf_user_sequence_nowrite
 #define ctf_user_sequence_nowrite(_type, _item, _user_src, _length_type, _user_src_length)
 
 #undef ctf_user_sequence_text_nowrite
 #define ctf_user_sequence_text_nowrite(_type, _item, _user_src, _length_type, _user_src_length)
 
+#undef ctf_user_sequence_bitfield_nowrite
+#define ctf_user_sequence_bitfield_nowrite(_type, _item, _src, _length_type, _src_length)
+
 #undef ctf_user_string_nowrite
 #define ctf_user_string_nowrite(_item, _user_src)
index dde883eae4dd10479d4e2cb75119d3f783bf565f..19041e5d70d10cfbc0d1ce85b5a2f1019810a65a 100644 (file)
 #define ctf_array_text(_type, _item, _src, _length)            \
        _ctf_array_encoded(_type, _item, _src, _length, UTF8, 0, 0)
 
+#undef ctf_array_bitfield
+#define ctf_array_bitfield(_type, _item, _src, _length)                \
+       _ctf_array_bitfield(_type, _item, _src, _length, 0, 0)
+
 #undef ctf_sequence
 #define ctf_sequence(_type, _item, _src, _length_type, _src_length) \
        _ctf_sequence_encoded(_type, _item, _src,               \
        _ctf_sequence_encoded(_type, _item, _src,               \
                        _length_type, _src_length, UTF8, __BYTE_ORDER, 10, 0, 0)
 
+#undef ctf_sequence_bitfield
+#define ctf_sequence_bitfield(_type, _item, _src, _length_type, _src_length) \
+       _ctf_sequence_bitfield(_type, _item, _src,              \
+                       _length_type, _src_length, 0, 0)
+
 #undef ctf_string
 #define ctf_string(_item, _src)                                        \
        _ctf_string(_item, _src, 0, 0)
 #define ctf_user_array_text(_type, _item, _src, _length)               \
        _ctf_array_encoded(_type, _item, _src, _length, UTF8, 1, 0)
 
+#undef ctf_user_array_bitfield
+#define ctf_user_array_bitfield(_type, _item, _src, _length)           \
+       _ctf_array_bitfield(_type, _item, _src, _length, 1, 0)
+
 #undef ctf_user_sequence
 #define ctf_user_sequence(_type, _item, _src, _length_type, _src_length) \
        _ctf_sequence_encoded(_type, _item, _src,               \
        _ctf_sequence_encoded(_type, _item, _src,               \
                        _length_type, _src_length, UTF8, __BYTE_ORDER, 10, 1, 0)
 
+#undef ctf_user_sequence_bitfield
+#define ctf_user_sequence_bitfield(_type, _item, _src, _length_type, _src_length) \
+       _ctf_sequence_bitfield(_type, _item, _src,              \
+                       _length_type, _src_length, 1, 0)
+
 #undef ctf_user_string
 #define ctf_user_string(_item, _src)                                   \
        _ctf_string(_item, _src, 1, 0)
index a6c36b088dfba22ab12a7cf162c7880087dff578..35d6f790a7df7dbdb6188f87acd01d84a3408166 100644 (file)
@@ -22,6 +22,7 @@
 #include <linux/uaccess.h>
 #include <linux/debugfs.h>
 #include <linux/rculist.h>
+#include <asm/byteorder.h>
 #include "lttng.h"
 #include "lttng-types.h"
 #include "lttng-probe-user.h"
@@ -189,7 +190,7 @@ void __event_template_proto___##_name(void);
 #define _ctf_integer_ext(_type, _item, _src, _byte_order, _base, _user, _nowrite) \
        {                                                       \
          .name = #_item,                                       \
-         .type = __type_integer(_type, _byte_order, _base, none),\
+         .type = __type_integer(_type, 0, 0, -1, _byte_order, _base, none),\
          .nowrite = _nowrite,                                  \
          .user = _user,                                        \
        },
@@ -205,7 +206,7 @@ void __event_template_proto___##_name(void);
                        {                                       \
                          .array =                              \
                                {                               \
-                                 .elem_type = __type_integer(_type, __BYTE_ORDER, 10, _encoding), \
+                                 .elem_type = __type_integer(_type, 0, 0, 0, __BYTE_ORDER, 10, _encoding), \
                                  .length = _length,            \
                                }                               \
                        }                                       \
@@ -214,6 +215,28 @@ void __event_template_proto___##_name(void);
          .user = _user,                                        \
        },
 
+#undef _ctf_array_bitfield
+#define _ctf_array_bitfield(_type, _item, _src, _length, _user, _nowrite) \
+       {                                                       \
+         .name = #_item,                                       \
+         .type =                                               \
+               {                                               \
+                 .atype = atype_array,                         \
+                 .u =                                          \
+                       {                                       \
+                         .array =                              \
+                               {                               \
+                                 .elem_type = __type_integer(_type, 1, 1, 0, __LITTLE_ENDIAN, 10, none), \
+                                 .length = (_length) * sizeof(_type) * CHAR_BIT, \
+                                 .elem_alignment = lttng_alignof(_type), \
+                               }                               \
+                       }                                       \
+               },                                              \
+         .nowrite = _nowrite,                                  \
+         .user = _user,                                        \
+       },
+
+
 #undef _ctf_sequence_encoded
 #define _ctf_sequence_encoded(_type, _item, _src,              \
                        _length_type, _src_length, _encoding,   \
@@ -227,8 +250,31 @@ void __event_template_proto___##_name(void);
                        {                                       \
                          .sequence =                           \
                                {                               \
-                                 .length_type = __type_integer(_length_type, __BYTE_ORDER, 10, none), \
-                                 .elem_type = __type_integer(_type, _byte_order, _base, _encoding), \
+                                 .length_type = __type_integer(_length_type, 0, 0, 0, __BYTE_ORDER, 10, none), \
+                                 .elem_type = __type_integer(_type, 0, 0, -1, _byte_order, _base, _encoding), \
+                               },                              \
+                       },                                      \
+               },                                              \
+         .nowrite = _nowrite,                                  \
+         .user = _user,                                        \
+       },
+
+#undef _ctf_sequence_bitfield
+#define _ctf_sequence_bitfield(_type, _item, _src,             \
+                       _length_type, _src_length,              \
+                       _user, _nowrite)                        \
+       {                                                       \
+         .name = #_item,                                       \
+         .type =                                               \
+               {                                               \
+                 .atype = atype_sequence,                      \
+                 .u =                                          \
+                       {                                       \
+                         .sequence =                           \
+                               {                               \
+                                 .length_type = __type_integer(_length_type, 0, 0, 0, __BYTE_ORDER, 10, none), \
+                                 .elem_type = __type_integer(_type, 1, 1, 0, __LITTLE_ENDIAN, 10, none), \
+                                 .elem_alignment = lttng_alignof(_type), \
                                },                              \
                        },                                      \
                },                                              \
@@ -309,6 +355,10 @@ static void __event_probe__##_name(void *__data);
        __event_len += lib_ring_buffer_align(__event_len, lttng_alignof(_type)); \
        __event_len += sizeof(_type) * (_length);
 
+#undef _ctf_array_bitfield
+#define _ctf_array_bitfield(_type, _item, _src, _length, _user, _nowrite) \
+       _ctf_array_encoded(_type, _item, _src, _length, none, _user, _nowrite)
+
 #undef _ctf_sequence_encoded
 #define _ctf_sequence_encoded(_type, _item, _src, _length_type,                        \
                        _src_length, _encoding, _byte_order, _base, _user, _nowrite) \
@@ -319,6 +369,13 @@ static void __event_probe__##_name(void *__data);
        __event_len += sizeof(_type) * __dynamic_len[__dynamic_len_idx];       \
        __dynamic_len_idx++;
 
+#undef _ctf_sequence_bitfield
+#define _ctf_sequence_bitfield(_type, _item, _src,             \
+                       _length_type, _src_length,              \
+                       _user, _nowrite)                        \
+       _ctf_sequence_encoded(_type, _item, _src, _length_type, _src_length, \
+               none, __LITTLE_ENDIAN, 10, _user, _nowrite)
+
 /*
  * ctf_user_string includes \0. If returns 0, it faulted, so we set size to
  * 1 (\0 only).
@@ -477,6 +534,10 @@ static inline size_t __event_get_size__##_name(size_t *__dynamic_len,            \
                __stack_data += sizeof(void *);                                \
        }
 
+#undef _ctf_array_bitfield
+#define _ctf_array_bitfield(_type, _item, _src, _length, _user, _nowrite) \
+       _ctf_array_encoded(_type, _item, _src, _length, none, _user, _nowrite)
+
 #undef _ctf_sequence_encoded
 #define _ctf_sequence_encoded(_type, _item, _src, _length_type,                       \
                        _src_length, _encoding, _byte_order, _base, _user, _nowrite) \
@@ -489,6 +550,13 @@ static inline size_t __event_get_size__##_name(size_t *__dynamic_len,            \
                __stack_data += sizeof(void *);                                \
        }
 
+#undef _ctf_sequence_bitfield
+#define _ctf_sequence_bitfield(_type, _item, _src,             \
+                       _length_type, _src_length,              \
+                       _user, _nowrite)                        \
+       _ctf_sequence_encoded(_type, _item, _src, _length_type, _src_length, \
+               none, __LITTLE_ENDIAN, 10, _user, _nowrite)
+
 #undef _ctf_string
 #define _ctf_string(_item, _src, _user, _nowrite)                             \
        {                                                                      \
@@ -548,12 +616,23 @@ void __event_prepare_filter_stack__##_name(char *__stack_data,                  \
 #define _ctf_array_encoded(_type, _item, _src, _length, _encoding, _user, _nowrite) \
        __event_align = max_t(size_t, __event_align, lttng_alignof(_type));
 
+#undef _ctf_array_bitfield
+#define _ctf_array_bitfield(_type, _item, _src, _length, _user, _nowrite) \
+       _ctf_array_encoded(_type, _item, _src, _length, none, _user, _nowrite)
+
 #undef _ctf_sequence_encoded
 #define _ctf_sequence_encoded(_type, _item, _src, _length_type,                        \
                        _src_length, _encoding, _byte_order, _base, _user, _nowrite) \
        __event_align = max_t(size_t, __event_align, lttng_alignof(_length_type)); \
        __event_align = max_t(size_t, __event_align, lttng_alignof(_type));
 
+#undef _ctf_sequence_bitfield
+#define _ctf_sequence_bitfield(_type, _item, _src,             \
+                       _length_type, _src_length,              \
+                       _user, _nowrite)                        \
+       _ctf_sequence_encoded(_type, _item, _src, _length_type, _src_length, \
+               none, __LITTLE_ENDIAN, 10, _user, _nowrite)
+
 #undef _ctf_string
 #define _ctf_string(_item, _src, _user, _nowrite)
 
@@ -635,6 +714,54 @@ static inline size_t __event_get_align__##_name(void *__tp_locvar)       \
                __chan->ops->event_write(&__ctx, _src, sizeof(_type) * (_length)); \
        }
 
+#if (__BYTE_ORDER == __LITTLE_ENDIAN)
+#undef _ctf_array_bitfield
+#define _ctf_array_bitfield(_type, _item, _src, _length, _user, _nowrite) \
+       lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(_type));        \
+       if (_user) {                                                    \
+               __chan->ops->event_write_from_user(&__ctx, _src, sizeof(_type) * (_length)); \
+       } else {                                                        \
+               __chan->ops->event_write(&__ctx, _src, sizeof(_type) * (_length)); \
+       }
+#else /* #if (__BYTE_ORDER == __LITTLE_ENDIAN) */
+/*
+ * For big endian, we need to byteswap into little endian.
+ */
+#undef _ctf_array_bitfield
+#define _ctf_array_bitfield(_type, _item, _src, _length, _user, _nowrite) \
+       lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(_type));        \
+       {                                                               \
+               size_t _i;                                              \
+                                                                       \
+               for (_i = 0; _i < (_length); _i++) {                    \
+                       _type _tmp;                                     \
+                                                                       \
+                       if (_user) {                                    \
+                               if (get_user(_tmp, (_type *) _src + _i)) \
+                                       _tmp = 0;                       \
+                       } else {                                        \
+                               _tmp = ((_type *) _src)[_i];            \
+                       }                                               \
+                       switch (sizeof(_type)) {                        \
+                       case 1:                                         \
+                               break;                                  \
+                       case 2:                                         \
+                               _tmp = cpu_to_le16(_tmp);               \
+                               break;                                  \
+                       case 4:                                         \
+                               _tmp = cpu_to_le32(_tmp);               \
+                               break;                                  \
+                       case 8:                                         \
+                               _tmp = cpu_to_le64(_tmp);               \
+                               break;                                  \
+                       default:                                        \
+                               BUG_ON(1);                              \
+                       }                                               \
+                       __chan->ops->event_write(&__ctx, &_tmp, sizeof(_type)); \
+               }                                                       \
+       }
+#endif /* #else #if (__BYTE_ORDER == __LITTLE_ENDIAN) */
+
 #undef _ctf_sequence_encoded
 #define _ctf_sequence_encoded(_type, _item, _src, _length_type,                \
                        _src_length, _encoding, _byte_order, _base, _user, _nowrite) \
@@ -652,6 +779,71 @@ static inline size_t __event_get_align__##_name(void *__tp_locvar)       \
                        sizeof(_type) * __get_dynamic_len(dest));       \
        }
 
+#if (__BYTE_ORDER == __LITTLE_ENDIAN)
+#undef _ctf_sequence_bitfield
+#define _ctf_sequence_bitfield(_type, _item, _src,             \
+                       _length_type, _src_length,              \
+                       _user, _nowrite)                        \
+       {                                                               \
+               _length_type __tmpl = __stackvar.__dynamic_len[__dynamic_len_idx] * sizeof(_type) * CHAR_BIT; \
+               lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(_length_type));\
+               __chan->ops->event_write(&__ctx, &__tmpl, sizeof(_length_type));\
+       }                                                               \
+       lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(_type));        \
+       if (_user) {                                                    \
+               __chan->ops->event_write_from_user(&__ctx, _src,        \
+                       sizeof(_type) * __get_dynamic_len(dest));       \
+       } else {                                                        \
+               __chan->ops->event_write(&__ctx, _src,                  \
+                       sizeof(_type) * __get_dynamic_len(dest));       \
+       }
+#else /* #if (__BYTE_ORDER == __LITTLE_ENDIAN) */
+/*
+ * For big endian, we need to byteswap into little endian.
+ */
+#undef _ctf_sequence_bitfield
+#define _ctf_sequence_bitfield(_type, _item, _src,             \
+                       _length_type, _src_length,              \
+                       _user, _nowrite)                        \
+       {                                                       \
+               _length_type __tmpl = __stackvar.__dynamic_len[__dynamic_len_idx] * sizeof(_type) * CHAR_BIT; \
+               lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(_length_type));\
+               __chan->ops->event_write(&__ctx, &__tmpl, sizeof(_length_type));\
+       }                                                               \
+       lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(_type));        \
+       {                                                               \
+               size_t _i, _length;                                     \
+                                                                       \
+               _length = __get_dynamic_len(dest);                      \
+               for (_i = 0; _i < _length; _i++) {                      \
+                       _type _tmp;                                     \
+                                                                       \
+                       if (_user) {                                    \
+                               if (get_user(_tmp, (_type *) _src + _i)) \
+                                       _tmp = 0;                       \
+                       } else {                                        \
+                               _tmp = ((_type *) _src)[_i];            \
+                       }                                               \
+                       switch (sizeof(_type)) {                        \
+                       case 1:                                         \
+                               break;                                  \
+                       case 2:                                         \
+                               _tmp = cpu_to_le16(_tmp);               \
+                               break;                                  \
+                       case 4:                                         \
+                               _tmp = cpu_to_le32(_tmp);               \
+                               break;                                  \
+                       case 8:                                         \
+                               _tmp = cpu_to_le64(_tmp);               \
+                               break;                                  \
+                       default:                                        \
+                               BUG_ON(1);                              \
+                       }                                               \
+                       __chan->ops->event_write(&__ctx, &_tmp, sizeof(_type)); \
+               }                                                       \
+       }
+#endif /* #else #if (__BYTE_ORDER == __LITTLE_ENDIAN) */
+
 #undef _ctf_string
 #define _ctf_string(_item, _src, _user, _nowrite)                      \
        lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(*(_src)));      \
index 93760667697919f4f76ffd8663ef5617ea630e9e..3809414c0ce33164e693404844ccea35a11eeb7d 100644 (file)
@@ -68,7 +68,7 @@
 #define TRACE_EVENT_TYPE___enum(_name, _container_type)                        \
                {                                                       \
                  .name = #_name,                                       \
-                 .container_type = __type_integer(_container_type, __BYTE_ORDER, 10, none), \
+                 .container_type = __type_integer(_container_type, 0, 0, -1, __BYTE_ORDER, 10, none), \
                  .entries = __trace_event_enum_##_name, \
                  .len = ARRAY_SIZE(__trace_event_enum_##_name), \
                },
This page took 0.038169 seconds and 4 git commands to generate.