+ struct definition_integer *integer_definition =
+ container_of(definition, struct definition_integer, p);
+ const struct declaration_integer *integer_declaration =
+ integer_definition->declaration;
+ struct ctf_stream_pos *pos = ctf_pos(ppos);
+
+ if (!(integer_declaration->p.alignment % CHAR_BIT)
+ && !(integer_declaration->len % CHAR_BIT)) {
+ return _aligned_integer_read(ppos, definition);
+ }
+
+ ctf_align_pos(pos, integer_declaration->p.alignment);
+
+ if (!ctf_pos_access_ok(pos, integer_declaration->len))
+ return -EFAULT;
+
+ if (!integer_declaration->signedness) {
+ if (integer_declaration->byte_order == LITTLE_ENDIAN)
+ bt_bitfield_read_le(mmap_align_addr(pos->base_mma) +
+ pos->mmap_base_offset, unsigned long,
+ pos->offset, integer_declaration->len,
+ &integer_definition->value._unsigned);
+ else
+ bt_bitfield_read_be(mmap_align_addr(pos->base_mma) +
+ pos->mmap_base_offset, unsigned long,
+ pos->offset, integer_declaration->len,
+ &integer_definition->value._unsigned);
+ } else {
+ if (integer_declaration->byte_order == LITTLE_ENDIAN)
+ bt_bitfield_read_le(mmap_align_addr(pos->base_mma) +
+ pos->mmap_base_offset, unsigned long,
+ pos->offset, integer_declaration->len,
+ &integer_definition->value._signed);
+ else
+ bt_bitfield_read_be(mmap_align_addr(pos->base_mma) +
+ pos->mmap_base_offset, unsigned long,
+ pos->offset, integer_declaration->len,
+ &integer_definition->value._signed);
+ }
+ ctf_move_pos(pos, integer_declaration->len);
+ return 0;
+}
+
+int ctf_integer_write(struct stream_pos *ppos, struct definition *definition)
+{
+ struct definition_integer *integer_definition =
+ container_of(definition, struct definition_integer, p);
+ const struct declaration_integer *integer_declaration =
+ integer_definition->declaration;
+ struct ctf_stream_pos *pos = ctf_pos(ppos);
+
+ if (!(integer_declaration->p.alignment % CHAR_BIT)
+ && !(integer_declaration->len % CHAR_BIT)) {
+ return _aligned_integer_write(ppos, definition);
+ }
+
+ ctf_align_pos(pos, integer_declaration->p.alignment);
+
+ if (!ctf_pos_access_ok(pos, integer_declaration->len))
+ return -EFAULT;