Remove the LTTNG_PACKED macro
authorMichael Jeanson <mjeanson@efficios.com>
Wed, 17 Mar 2021 20:31:53 +0000 (16:31 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 18 Mar 2021 12:28:35 +0000 (08:28 -0400)
We already use __attribute__((packed)) directly in some public headers.
Remove the LTTNG_PACKED macro and replace it with the literal attribute.

The LTTNG_PACKED macro was meant to support Cygwin, but the Cygwin
LTTng-UST support was never completed.

Change-Id: I8bf5d3db94b979e16bf9b9b5c582b85b6b73f10b
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
include/lttng/ust-abi.h
include/lttng/ust-compiler.h
include/lttng/ust-ctl.h
include/lttng/ust-events.h
include/ust-comm.h
liblttng-ust/bytecode.h

index fe2535668f674c66806b9e1384a2032e18e149e7..843fe4ed97c2fccf85e195b80578ca873f19cc5d 100644 (file)
 #include <stdint.h>
 #include <lttng/ust-compiler.h>
 
-#ifndef LTTNG_PACKED
-#error "LTTNG_PACKED should be defined"
-#endif
-
 #ifndef __ust_stringify
 #define __ust_stringify1(x)    #x
 #define __ust_stringify(x)     __ust_stringify1(x)
@@ -57,7 +53,7 @@ struct lttng_ust_abi_tracer_version {
        uint32_t major;
        uint32_t minor;
        uint32_t patchlevel;
-} LTTNG_PACKED;
+} __attribute__((packed));
 
 #define LTTNG_UST_ABI_CHANNEL_PADDING  (LTTNG_UST_ABI_SYM_NAME_LEN + 32)
 /*
@@ -72,7 +68,7 @@ struct lttng_ust_abi_channel {
        int32_t type;   /* enum lttng_ust_abi_chan_type */
        char padding[LTTNG_UST_ABI_CHANNEL_PADDING];
        char data[];    /* variable sized data */
-} LTTNG_PACKED;
+} __attribute__((packed));
 
 #define LTTNG_UST_ABI_STREAM_PADDING1  (LTTNG_UST_ABI_SYM_NAME_LEN + 32)
 struct lttng_ust_abi_stream {
@@ -83,7 +79,7 @@ struct lttng_ust_abi_stream {
         * shm_fd and wakeup_fd are send over unix socket as file
         * descriptors after this structure.
         */
-} LTTNG_PACKED;
+} __attribute__((packed));
 
 #define LTTNG_UST_ABI_COUNTER_DIMENSION_MAX 4
 
@@ -103,7 +99,7 @@ struct lttng_ust_abi_counter_dimension {
        uint64_t overflow_index;
        uint8_t has_underflow;
        uint8_t has_overflow;
-} LTTNG_PACKED;
+} __attribute__((packed));
 
 #define LTTNG_UST_ABI_COUNTER_CONF_PADDING1 67
 struct lttng_ust_abi_counter_conf {
@@ -114,13 +110,13 @@ struct lttng_ust_abi_counter_conf {
        struct lttng_ust_abi_counter_dimension dimensions[LTTNG_UST_ABI_COUNTER_DIMENSION_MAX];
        uint8_t coalesce_hits;
        char padding[LTTNG_UST_ABI_COUNTER_CONF_PADDING1];
-} LTTNG_PACKED;
+} __attribute__((packed));
 
 struct lttng_ust_abi_counter_value {
        uint32_t number_dimensions;
        uint64_t dimension_indexes[LTTNG_UST_ABI_COUNTER_DIMENSION_MAX];
        int64_t value;
-} LTTNG_PACKED;
+} __attribute__((packed));
 
 #define LTTNG_UST_ABI_EVENT_PADDING1   8
 #define LTTNG_UST_ABI_EVENT_PADDING2   (LTTNG_UST_ABI_SYM_NAME_LEN + 32)
@@ -137,21 +133,21 @@ struct lttng_ust_abi_event {
        union {
                char padding[LTTNG_UST_ABI_EVENT_PADDING2];
        } u;
-} LTTNG_PACKED;
+} __attribute__((packed));
 
 #define LTTNG_UST_ABI_EVENT_NOTIFIER_PADDING   32
 struct lttng_ust_abi_event_notifier {
        struct lttng_ust_abi_event event;
        uint64_t error_counter_index;
        char padding[LTTNG_UST_ABI_EVENT_NOTIFIER_PADDING];
-} LTTNG_PACKED;
+} __attribute__((packed));
 
 #define LTTNG_UST_ABI_EVENT_NOTIFIER_NOTIFICATION_PADDING 32
 struct lttng_ust_abi_event_notifier_notification {
        uint64_t token;
        uint16_t capture_buf_size;
        char padding[LTTNG_UST_ABI_EVENT_NOTIFIER_NOTIFICATION_PADDING];
-} LTTNG_PACKED;
+} __attribute__((packed));
 
 #define LTTNG_UST_ABI_COUNTER_PADDING1         (LTTNG_UST_ABI_SYM_NAME_LEN + 32)
 #define LTTNG_UST_ABI_COUNTER_DATA_MAX_LEN     4096U
@@ -159,20 +155,20 @@ struct lttng_ust_abi_counter {
        uint64_t len;
        char padding[LTTNG_UST_ABI_COUNTER_PADDING1];
        char data[];    /* variable sized data */
-} LTTNG_PACKED;
+} __attribute__((packed));
 
 #define LTTNG_UST_ABI_COUNTER_GLOBAL_PADDING1  (LTTNG_UST_ABI_SYM_NAME_LEN + 32)
 struct lttng_ust_abi_counter_global {
        uint64_t len;           /* shm len */
        char padding[LTTNG_UST_ABI_COUNTER_GLOBAL_PADDING1];
-} LTTNG_PACKED;
+} __attribute__((packed));
 
 #define LTTNG_UST_ABI_COUNTER_CPU_PADDING1     (LTTNG_UST_ABI_SYM_NAME_LEN + 32)
 struct lttng_ust_abi_counter_cpu {
        uint64_t len;           /* shm len */
        uint32_t cpu_nr;
        char padding[LTTNG_UST_ABI_COUNTER_CPU_PADDING1];
-} LTTNG_PACKED;
+} __attribute__((packed));
 
 enum lttng_ust_abi_field_type {
        LTTNG_UST_ABI_FIELD_OTHER                       = 0,
@@ -190,7 +186,7 @@ struct lttng_ust_abi_field_iter {
        int loglevel;                           /* event loglevel */
        int nowrite;
        char padding[LTTNG_UST_ABI_FIELD_ITER_PADDING];
-} LTTNG_PACKED;
+} __attribute__((packed));
 
 enum lttng_ust_abi_context_type {
        LTTNG_UST_ABI_CONTEXT_VTID                      = 0,
@@ -221,7 +217,7 @@ struct lttng_ust_abi_perf_counter_ctx {
        uint32_t type;
        uint64_t config;
        char name[LTTNG_UST_ABI_SYM_NAME_LEN];
-} LTTNG_PACKED;
+} __attribute__((packed));
 
 #define LTTNG_UST_ABI_CONTEXT_PADDING1 16
 #define LTTNG_UST_ABI_CONTEXT_PADDING2 (LTTNG_UST_ABI_SYM_NAME_LEN + 32)
@@ -238,7 +234,7 @@ struct lttng_ust_abi_context {
                } app_ctx;
                char padding[LTTNG_UST_ABI_CONTEXT_PADDING2];
        } u;
-} LTTNG_PACKED;
+} __attribute__((packed));
 
 /*
  * Tracer channel attributes.
@@ -257,14 +253,14 @@ struct lttng_ust_abi_channel_attr {
                } s;
                char padding[LTTNG_UST_ABI_CHANNEL_ATTR_PADDING];
        } u;
-} LTTNG_PACKED;
+} __attribute__((packed));
 
 #define LTTNG_UST_ABI_TRACEPOINT_ITER_PADDING  16
 struct lttng_ust_abi_tracepoint_iter {
        char name[LTTNG_UST_ABI_SYM_NAME_LEN];  /* provider:name */
        int loglevel;
        char padding[LTTNG_UST_ABI_TRACEPOINT_ITER_PADDING];
-} LTTNG_PACKED;
+} __attribute__((packed));
 
 enum lttng_ust_abi_object_type {
        LTTNG_UST_ABI_OBJECT_TYPE_UNKNOWN = -1,
@@ -310,7 +306,7 @@ struct lttng_ust_abi_object_data {
                } counter_cpu;
                char padding2[LTTNG_UST_ABI_OBJECT_DATA_PADDING2];
        } u;
-} LTTNG_PACKED;
+} __attribute__((packed));
 
 enum lttng_ust_calibrate_type {
        LTTNG_UST_ABI_CALIBRATE_TRACEPOINT,
@@ -325,7 +321,7 @@ struct lttng_ust_abi_calibrate {
        union {
                char padding[LTTNG_UST_ABI_CALIBRATE_PADDING2];
        } u;
-} LTTNG_PACKED;
+} __attribute__((packed));
 
 #define LTTNG_UST_ABI_FILTER_BYTECODE_MAX_LEN  65536
 #define LTTNG_UST_ABI_FILTER_PADDING           32
@@ -335,7 +331,7 @@ struct lttng_ust_abi_filter_bytecode {
        uint64_t seqnum;
        char padding[LTTNG_UST_ABI_FILTER_PADDING];
        char data[0];
-} LTTNG_PACKED;
+} __attribute__((packed));
 
 #define LTTNG_UST_ABI_CAPTURE_BYTECODE_MAX_LEN 65536
 #define LTTNG_UST_ABI_CAPTURE_PADDING          32
@@ -345,14 +341,14 @@ struct lttng_ust_abi_capture_bytecode {
        uint64_t seqnum;
        char padding[LTTNG_UST_ABI_CAPTURE_PADDING];
        char data[0];
-} LTTNG_PACKED;
+} __attribute__((packed));
 
 #define LTTNG_UST_ABI_EXCLUSION_PADDING        32
 struct lttng_ust_abi_event_exclusion {
        uint32_t count;
        char padding[LTTNG_UST_ABI_EXCLUSION_PADDING];
        char names[LTTNG_UST_ABI_SYM_NAME_LEN][0];
-} LTTNG_PACKED;
+} __attribute__((packed));
 
 #define LTTNG_UST_ABI_CMD(minor)               (minor)
 #define LTTNG_UST_ABI_CMDR(minor, type)                (minor)
index dcc72594858060a7a32aec36fb9a2cc19e89dfa0..f0ec8d0c41d86a73304f3a23b495840168d12537 100644 (file)
@@ -11,7 +11,6 @@
 #include <assert.h>
 
 #define lttng_ust_notrace __attribute__((no_instrument_function))
-#define LTTNG_PACKED   __attribute__((__packed__))
 
 /*
  * Clang supports the no_sanitize variable attribute on global variables.
index 8b040e2cdccfc30d874f3b464a9480a0f829c461..39952fa30db7fa9ee6a679d0ebcbfe3d7fd8d57f 100644 (file)
 
 #include <lttng/ust-abi.h>
 
-#ifndef LTTNG_PACKED
-#error "LTTNG_PACKED should be defined"
-#endif
-
 #ifndef LTTNG_UST_UUID_LEN
 #define LTTNG_UST_UUID_LEN     16
 #endif
@@ -51,7 +47,7 @@ struct ustctl_consumer_channel_attr {
        uint32_t chan_id;                       /* channel ID */
        unsigned char uuid[LTTNG_UST_UUID_LEN]; /* Trace session unique ID */
        int64_t blocking_timeout;                       /* Blocking timeout (usec) */
-} LTTNG_PACKED;
+} __attribute__((packed));
 
 /*
  * API used by sessiond.
@@ -358,7 +354,7 @@ struct ustctl_integer_type {
        int32_t encoding;       /* enum ustctl_string_encodings */
        uint16_t alignment;     /* in bits */
        char padding[USTCTL_UST_INTEGER_TYPE_PADDING];
-} LTTNG_PACKED;
+} __attribute__((packed));
 
 #define USTCTL_UST_FLOAT_TYPE_PADDING  24
 struct ustctl_float_type {
@@ -367,14 +363,14 @@ struct ustctl_float_type {
        uint32_t reverse_byte_order;
        uint16_t alignment;     /* in bits */
        char padding[USTCTL_UST_FLOAT_TYPE_PADDING];
-} LTTNG_PACKED;
+} __attribute__((packed));
 
 #define USTCTL_UST_ENUM_VALUE_PADDING  15
 struct ustctl_enum_value {
        uint64_t value;
        uint8_t signedness;
        char padding[USTCTL_UST_ENUM_VALUE_PADDING];
-} LTTNG_PACKED;
+} __attribute__((packed));
 
 enum ustctl_ust_enum_entry_options {
        USTCTL_UST_ENUM_ENTRY_OPTION_IS_AUTO = 1U << 0,
@@ -387,10 +383,10 @@ struct ustctl_enum_entry {
        union {
                struct {
                        uint32_t options;
-               } LTTNG_PACKED extra;
+               } __attribute__((packed)) extra;
                char padding[USTCTL_UST_ENUM_ENTRY_PADDING];
        } u;
-} LTTNG_PACKED;
+} __attribute__((packed));
 
 /* legacy */
 #define USTCTL_UST_BASIC_TYPE_PADDING  296
@@ -406,7 +402,7 @@ union _ustctl_basic_type {
        } string;
        struct ustctl_float_type _float;
        char padding[USTCTL_UST_BASIC_TYPE_PADDING];
-} LTTNG_PACKED;
+} __attribute__((packed));
 
 /* legacy */
 struct ustctl_basic_type {
@@ -414,7 +410,7 @@ struct ustctl_basic_type {
        union {
                union _ustctl_basic_type basic;
        } u;
-} LTTNG_PACKED;
+} __attribute__((packed));
 
 /*
  * Padding is derived from largest member: u.legacy.sequence which
@@ -479,14 +475,14 @@ struct ustctl_type {
                } legacy;
                char padding[USTCTL_UST_TYPE_PADDING];
        } u;
-} LTTNG_PACKED;
+} __attribute__((packed));
 
 #define USTCTL_UST_FIELD_PADDING       28
 struct ustctl_field {
        char name[LTTNG_UST_ABI_SYM_NAME_LEN];
        struct ustctl_type type;
        char padding[USTCTL_UST_FIELD_PADDING];
-} LTTNG_PACKED;
+} __attribute__((packed));
 
 /*
  * Returns 0 on success, negative error value on error.
index 107c746ef6d2426367e50bd787bcd3368971ed63..59446c4b783c77715e8048f85546a8846f03874e 100644 (file)
 #include <urcu/ref.h>
 #include <pthread.h>
 
-#ifndef LTTNG_PACKED
-#error "LTTNG_PACKED should be defined"
-#endif
-
 #ifdef __cplusplus
 extern "C" {
 #endif
index 39496921fc8ed8832a97e188d0fb0aecdeb7cc41..da3e2a184dd3ec52b481112e130d758ae36ad4ea 100644 (file)
 #include <lttng/ust-compiler.h>
 #include <lttng/ust-ctl.h>
 
-#ifndef LTTNG_PACKED
-#error "LTTNG_PACKED should be defined"
-#endif
-
 /*
  * Default timeout the application waits for the sessiond to send its
  * "register done" command. Can be overridden with the environment
@@ -64,7 +60,7 @@ struct ustctl_reg_msg {
        uint32_t socket_type;                   /* enum ustctl_socket_type */
        char name[LTTNG_UST_ABI_PROCNAME_LEN];  /* process name */
        char padding[LTTNG_UST_COMM_REG_MSG_PADDING];
-} LTTNG_PACKED;
+} __attribute__((packed));
 
 /*
  * Data structure for the commands sent from sessiond to UST.
@@ -86,15 +82,15 @@ struct ustcomm_ust_msg {
                        uint32_t data_size;     /* following filter data */
                        uint32_t reloc_offset;
                        uint64_t seqnum;
-               } LTTNG_PACKED filter;
+               } __attribute__((packed)) filter;
                struct {
                        uint32_t count; /* how many names follow */
-               } LTTNG_PACKED exclusion;
+               } __attribute__((packed)) exclusion;
                struct {
                        uint32_t data_size;     /* following capture data */
                        uint32_t reloc_offset;
                        uint64_t seqnum;
-               } LTTNG_PACKED capture;
+               } __attribute__((packed)) capture;
                struct lttng_ust_abi_counter counter;
                struct lttng_ust_abi_counter_global counter_global;
                struct lttng_ust_abi_counter_cpu counter_cpu;
@@ -109,7 +105,7 @@ struct ustcomm_ust_msg {
                } event_notifier;
                char padding[USTCOMM_MSG_PADDING2];
        } u;
-} LTTNG_PACKED;
+} __attribute__((packed));
 
 /*
  * Data structure for the response from UST to the session daemon.
@@ -126,19 +122,19 @@ struct ustcomm_ust_reply {
        union {
                struct {
                        uint64_t memory_map_size;
-               } LTTNG_PACKED channel;
+               } __attribute__((packed)) channel;
                struct {
                        uint64_t memory_map_size;
-               } LTTNG_PACKED stream;
+               } __attribute__((packed)) stream;
                struct lttng_ust_abi_tracer_version version;
                struct lttng_ust_abi_tracepoint_iter tracepoint;
                char padding[USTCOMM_REPLY_PADDING2];
        } u;
-} LTTNG_PACKED;
+} __attribute__((packed));
 
 struct ustcomm_notify_hdr {
        uint32_t notify_cmd;
-} LTTNG_PACKED;
+} __attribute__((packed));
 
 #define USTCOMM_NOTIFY_EVENT_MSG_PADDING       32
 struct ustcomm_notify_event_msg {
@@ -151,14 +147,14 @@ struct ustcomm_notify_event_msg {
        uint32_t model_emf_uri_len;
        char padding[USTCOMM_NOTIFY_EVENT_MSG_PADDING];
        /* followed by signature, fields, and model_emf_uri */
-} LTTNG_PACKED;
+} __attribute__((packed));
 
 #define USTCOMM_NOTIFY_EVENT_REPLY_PADDING     32
 struct ustcomm_notify_event_reply {
        int32_t ret_code;       /* 0: ok, negative: error code */
        uint32_t event_id;
        char padding[USTCOMM_NOTIFY_EVENT_REPLY_PADDING];
-} LTTNG_PACKED;
+} __attribute__((packed));
 
 #define USTCOMM_NOTIFY_ENUM_MSG_PADDING                32
 struct ustcomm_notify_enum_msg {
@@ -167,14 +163,14 @@ struct ustcomm_notify_enum_msg {
        uint32_t entries_len;
        char padding[USTCOMM_NOTIFY_ENUM_MSG_PADDING];
        /* followed by enum entries */
-} LTTNG_PACKED;
+} __attribute__((packed));
 
 #define USTCOMM_NOTIFY_EVENT_REPLY_PADDING     32
 struct ustcomm_notify_enum_reply {
        int32_t ret_code;       /* 0: ok, negative: error code */
        uint64_t enum_id;
        char padding[USTCOMM_NOTIFY_EVENT_REPLY_PADDING];
-} LTTNG_PACKED;
+} __attribute__((packed));
 
 #define USTCOMM_NOTIFY_CHANNEL_MSG_PADDING     32
 struct ustcomm_notify_channel_msg {
@@ -183,7 +179,7 @@ struct ustcomm_notify_channel_msg {
        uint32_t ctx_fields_len;
        char padding[USTCOMM_NOTIFY_CHANNEL_MSG_PADDING];
        /* followed by context fields */
-} LTTNG_PACKED;
+} __attribute__((packed));
 
 #define USTCOMM_NOTIFY_CHANNEL_REPLY_PADDING   32
 struct ustcomm_notify_channel_reply {
@@ -191,7 +187,7 @@ struct ustcomm_notify_channel_reply {
        uint32_t chan_id;
        uint32_t header_type;   /* enum ustctl_channel_header */
        char padding[USTCOMM_NOTIFY_CHANNEL_REPLY_PADDING];
-} LTTNG_PACKED;
+} __attribute__((packed));
 
 /*
  * LTTNG_UST_TRACEPOINT_FIELD_LIST reply is followed by a
index 4b4b33b62cf170fc1ae1dc3d5b9cac56f508b7c3..25ade988f8086fc8df53cda83addebb138dee5ea 100644 (file)
 #include <stdint.h>
 #include <lttng/ust-abi.h>
 
-#ifndef LTTNG_PACKED
-#error "LTTNG_PACKED should be defined"
-#endif
-
 /*
  * offsets are absolute from start of bytecode.
  */
@@ -26,15 +22,15 @@ struct field_ref {
 struct get_symbol {
        /* Symbol offset. */
        uint16_t offset;
-} LTTNG_PACKED;
+} __attribute__((packed));
 
 struct get_index_u16 {
        uint16_t index;
-} LTTNG_PACKED;
+} __attribute__((packed));
 
 struct get_index_u64 {
        uint64_t index;
-} LTTNG_PACKED;
+} __attribute__((packed));
 
 struct literal_numeric {
        int64_t v;
This page took 0.033252 seconds and 4 git commands to generate.