Created
April 21, 2010 11:00
-
-
Save oza/373702 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 8e71cc1c52262eb1f6a467078788ac092a3b112d Mon Sep 17 00:00:00 2001 | |
From: ozawa <[email protected]> | |
Date: Sun, 18 Apr 2010 06:18:17 +0900 | |
Subject: [PATCH] define __le16, __le32, __le64 for type check | |
Signed-off-by: ozawa <[email protected]> | |
--- | |
block/sheepdog.c | 145 ++++++++++++++++++++++++++++-------------------------- | |
1 files changed, 75 insertions(+), 70 deletions(-) | |
diff --git a/block/sheepdog.c b/block/sheepdog.c | |
index c129d5d..439332d 100644 | |
--- a/block/sheepdog.c | |
+++ b/block/sheepdog.c | |
@@ -108,120 +108,125 @@ do { \ | |
type __min2 = (y); \ | |
__min1 < __min2 ? __min1: __min2; }) | |
+typedef __attribute__((bitwise))uint16_t __le16; | |
+typedef __attribute__((bitwise))uint32_t __le32; | |
+typedef __attribute__((bitwise))uint64_t __le64; | |
+ | |
+ | |
struct sd_req { | |
uint8_t proto_ver; | |
uint8_t opcode; | |
- uint16_t flags; | |
- uint32_t epoch; | |
- uint32_t id; | |
- uint32_t data_length; | |
- uint32_t opcode_specific[8]; | |
+ __le16 flags; | |
+ __le32 epoch; | |
+ __le32 id; | |
+ __le32 data_length; | |
+ __le32 opcode_specific[8]; | |
}; | |
struct sd_rsp { | |
uint8_t proto_ver; | |
uint8_t opcode; | |
- uint16_t flags; | |
- uint32_t epoch; | |
- uint32_t id; | |
- uint32_t data_length; | |
- uint32_t result; | |
- uint32_t opcode_specific[7]; | |
+ __le16 flags; | |
+ __le32 epoch; | |
+ __le32 id; | |
+ __le32 data_length; | |
+ __le32 result; | |
+ __le32 opcode_specific[7]; | |
}; | |
struct sd_obj_req { | |
uint8_t proto_ver; | |
uint8_t opcode; | |
- uint16_t flags; | |
- uint32_t epoch; | |
- uint32_t id; | |
- uint32_t data_length; | |
- uint64_t oid; | |
- uint64_t cow_oid; | |
- uint32_t copies; | |
- uint32_t obj_ver; | |
- uint64_t offset; | |
+ __le16 flags; | |
+ __le32 epoch; | |
+ __le32 id; | |
+ __le32 data_length; | |
+ __le64 oid; | |
+ __le64 cow_oid; | |
+ __le32 copies; | |
+ __le32 obj_ver; | |
+ __le64 offset; | |
}; | |
struct sd_obj_rsp { | |
uint8_t proto_ver; | |
uint8_t opcode; | |
- uint16_t flags; | |
- uint32_t epoch; | |
- uint32_t id; | |
- uint32_t data_length; | |
- uint32_t result; | |
- uint32_t obj_ver; | |
- uint32_t copies; | |
- uint32_t pad[5]; | |
+ __le16 flags; | |
+ __le32 epoch; | |
+ __le32 id; | |
+ __le32 data_length; | |
+ __le32 result; | |
+ __le32 obj_ver; | |
+ __le32 copies; | |
+ __le32 pad[5]; | |
}; | |
struct sd_vdi_req { | |
uint8_t proto_ver; | |
uint8_t opcode; | |
- uint16_t flags; | |
- uint32_t epoch; | |
- uint32_t id; | |
- uint32_t data_length; | |
- uint64_t base_oid; | |
- uint64_t vdi_size; | |
- uint32_t copies; | |
- uint32_t snapid; | |
- uint32_t pad[2]; | |
+ __le16 flags; | |
+ __le32 epoch; | |
+ __le32 id; | |
+ __le32 data_length; | |
+ __le64 base_oid; | |
+ __le64 vdi_size; | |
+ __le32 copies; | |
+ __le32 snapid; | |
+ __le32 pad[2]; | |
}; | |
struct sd_vdi_rsp { | |
uint8_t proto_ver; | |
uint8_t opcode; | |
- uint16_t flags; | |
- uint32_t epoch; | |
- uint32_t id; | |
- uint32_t data_length; | |
- uint32_t result; | |
- uint32_t rsvd; | |
- uint64_t oid; | |
- uint32_t pad[4]; | |
+ __le16 flags; | |
+ __le32 epoch; | |
+ __le32 id; | |
+ __le32 data_length; | |
+ __le32 result; | |
+ __le32 rsvd; | |
+ __le64 oid; | |
+ __le32 pad[4]; | |
}; | |
struct sd_node_req { | |
uint8_t proto_ver; | |
uint8_t opcode; | |
- uint16_t flags; | |
- uint32_t epoch; | |
- uint32_t id; | |
- uint32_t data_length; | |
- uint32_t pad[8]; | |
+ __le16 flags; | |
+ __le32 epoch; | |
+ __le32 id; | |
+ __le32 data_length; | |
+ __le32 pad[8]; | |
}; | |
struct sd_node_rsp { | |
uint8_t proto_ver; | |
uint8_t opcode; | |
- uint16_t flags; | |
- uint32_t epoch; | |
- uint32_t id; | |
- uint32_t data_length; | |
- uint32_t result; | |
- uint32_t nr_nodes; | |
- uint32_t local_idx; | |
- uint32_t master_idx; | |
- uint32_t pad[4]; | |
+ __le16 flags; | |
+ __le32 epoch; | |
+ __le32 id; | |
+ __le32 data_length; | |
+ __le32 result; | |
+ __le32 nr_nodes; | |
+ __le32 local_idx; | |
+ __le32 master_idx; | |
+ __le32 pad[4]; | |
}; | |
struct sd_inode { | |
char name[SD_MAX_VDI_LEN]; | |
- uint64_t oid; | |
- uint64_t ctime; | |
- uint64_t snap_ctime; | |
- uint64_t vm_clock_nsec; | |
- uint64_t vdi_size; | |
- uint64_t vm_state_size; | |
- uint16_t copy_policy; | |
+ __le64 oid; | |
+ __le64 ctime; | |
+ __le64 snap_ctime; | |
+ __le64 vm_clock_nsec; | |
+ __le64 vdi_size; | |
+ __le64 vm_state_size; | |
+ __le16 copy_policy; | |
uint8_t nr_copies; | |
uint8_t block_size_shift; | |
- uint32_t snap_id; | |
- uint64_t parent_oid; | |
- uint64_t child_oid[MAX_CHILDREN]; | |
- uint64_t data_oid[MAX_DATA_OBJS]; | |
+ __le32 snap_id; | |
+ __le64 parent_oid; | |
+ __le64 child_oid[MAX_CHILDREN]; | |
+ __le64 data_oid[MAX_DATA_OBJS]; | |
}; | |
struct aio_req { | |
-- | |
1.5.6.5 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment