Move stream pos declaration into CTF header
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Sat, 30 Apr 2011 19:58:40 +0000 (15:58 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Sat, 30 Apr 2011 19:58:40 +0000 (15:58 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
include/babeltrace/ctf/metadata.h
include/babeltrace/ctf/types.h
include/babeltrace/types.h

index 91987a9b30db36016647bc4c20e8e7f381356f14..dea7ef7e99f5cccd830c5b486fe1940b0cd40382 100644 (file)
@@ -20,6 +20,7 @@
  */
 
 #include <babeltrace/types.h>
+#include <babeltrace/ctf/types.h>
 #include <sys/types.h>
 #include <dirent.h>
 #include <uuid/uuid.h>
index 73288ef6681117bb8b8bd839f5bf5fc3f5f738fd..c311b532738612fb2feeb31da1655755f610101a 100644 (file)
 #include <stdint.h>
 #include <glib.h>
 
+/*
+ * Always update stream_pos with move_pos and init_pos.
+ */
+struct stream_pos {
+       char *base;             /* Base address */
+       size_t offset;          /* Offset from base, in bits */
+       int dummy;              /* Dummy position, for length calculation */
+};
+
+static inline
+void init_pos(struct stream_pos *pos, char *base)
+{
+       pos->base = base;       /* initial base, page-aligned */
+       pos->offset = 0;
+       pos->dummy = false;
+}
+
+/*
+ * move_pos - move position of a relative bit offset
+ *
+ * TODO: allow larger files by updating base too.
+ */
+static inline
+void move_pos(struct stream_pos *pos, size_t offset)
+{
+       pos->offset = pos->offset + offset;
+}
+
+/*
+ * align_pos - align position on a bit offset (> 0)
+ *
+ * TODO: allow larger files by updating base too.
+ */
+static inline
+void align_pos(struct stream_pos *pos, size_t offset)
+{
+       pos->offset += offset_align(pos->offset, offset);
+}
+
+static inline
+void copy_pos(struct stream_pos *dest, struct stream_pos *src)
+{
+       memcpy(dest, src, sizeof(struct stream_pos));
+}
+
+static inline
+char *get_pos_addr(struct stream_pos *pos)
+{
+       /* Only makes sense to get the address after aligning on CHAR_BIT */
+       assert(!(pos->offset % CHAR_BIT));
+       return pos->base + (pos->offset / CHAR_BIT);
+}
+
 /*
  * IMPORTANT: All lengths (len) and offsets (start, end) are expressed in bits,
  *            *not* in bytes.
index 9704efed5e08229bc82243b30e715b1e2316e86e..3d2b70a4ed92d878588ff5547d7fc85537ac43b8 100644 (file)
 /* Preallocate this many fields for structures */
 #define DEFAULT_NR_STRUCT_FIELDS 8
 
-/*
- * Always update stream_pos with move_pos and init_pos.
- */
-struct stream_pos {
-       char *base;             /* Base address */
-       size_t offset;          /* Offset from base, in bits */
-       int dummy;              /* Dummy position, for length calculation */
-};
-
-static inline
-void init_pos(struct stream_pos *pos, char *base)
-{
-       pos->base = base;       /* initial base, page-aligned */
-       pos->offset = 0;
-       pos->dummy = false;
-}
-
-/*
- * move_pos - move position of a relative bit offset
- *
- * TODO: allow larger files by updating base too.
- */
-static inline
-void move_pos(struct stream_pos *pos, size_t offset)
-{
-       pos->offset = pos->offset + offset;
-}
-
-/*
- * align_pos - align position on a bit offset (> 0)
- *
- * TODO: allow larger files by updating base too.
- */
-static inline
-void align_pos(struct stream_pos *pos, size_t offset)
-{
-       pos->offset += offset_align(pos->offset, offset);
-}
-
-static inline
-void copy_pos(struct stream_pos *dest, struct stream_pos *src)
-{
-       memcpy(dest, src, sizeof(struct stream_pos));
-}
-
-static inline
-char *get_pos_addr(struct stream_pos *pos)
-{
-       /* Only makes sense to get the address after aligning on CHAR_BIT */
-       assert(!(pos->offset % CHAR_BIT));
-       return pos->base + (pos->offset / CHAR_BIT);
-}
-
+struct stream_pos;
 struct format;
 struct definition;
 
This page took 0.025675 seconds and 4 git commands to generate.