+#define __KERNEL__
+
#include <assert.h>
#include <sys/types.h>
#include <stdint.h>
#include <stdlib.h>
+#include <string.h>
+
+#include <linux/compiler.h>
#define min(a,b) (((a)<(b))?a:b)
#define max(a,b) (((a)>(b))?a:b)
#define BUG_ON(a) assert(!(a))
+// Useful outside __KERNEL__. Not used here because inline is already redefined.
+#define force_inline inline __attribute__((always_inline))
+
/* Calculate the offset needed to align the type */
static inline unsigned int ltt_align(size_t align_drift,
size_t size_of_type)
size_t *len,
struct lttng_mystruct2 *obj)
{
- size_t align, size, varalign;
+ size_t align, size;
align = lttng_get_alignment_mystruct2(obj);
size = lttng_get_size_mystruct2(obj);
locsize = sizeof(double);
size += ltt_align(size, locsize) + (obj->len * locsize);
+ /* Realign on arch size */
+ locsize = sizeof(void *);
+ size += ltt_align(size, locsize);
+
return size;
}
*to = ltt_align(*to, sizeof(void *));
*to_base = *to_base+*to;
*to = 0;
-
+
/* Put source *from just after the C sequence */
*from = obj+1;
}
/* Variable length field */
lttng_write_sequence_mystruct_mysequence(to_base, to, from, len, &obj->mysequence);
+ //*to = 0; /* Force the compiler to know it's 0 */
/* After this previous write, we are sure that *to is 0, and *to_base is
* aligned on the architecture size : to rest of alignment will be calculated
* statically. */
-
lttng_write_mystruct_myunion(to_base, to, from, len, &obj->myunion);
/* Don't forget to flush last write..... */