[Sheepdog] [PATCH 3/4] sheep: fix alignment of struct join_message
MORITA Kazutaka
morita.kazutaka at lab.ntt.co.jp
Thu Oct 20 13:33:14 CEST 2011
Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
sheep/group.c | 8 ++++----
sheep/sheep_priv.h | 4 ++--
sheep/store.c | 7 ++++---
3 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/sheep/group.c b/sheep/group.c
index 4968528..582c90a 100644
--- a/sheep/group.c
+++ b/sheep/group.c
@@ -30,17 +30,17 @@ struct node {
};
struct join_message {
+ uint8_t proto_ver;
+ uint8_t nr_sobjs;
uint16_t nr_nodes;
uint16_t nr_leave_nodes;
- uint32_t nr_sobjs;
- uint32_t cluster_status;
uint16_t cluster_flags;
+ uint32_t cluster_status;
uint32_t epoch;
uint64_t ctime;
uint32_t result;
uint8_t inc_epoch; /* set non-zero when we increment epoch of all nodes */
- uint8_t proto_ver;
- uint8_t pad[2];
+ uint8_t pad[3];
union {
struct sheepdog_node_list_entry nodes[0];
struct sheepdog_node_list_entry leave_nodes[0];
diff --git a/sheep/sheep_priv.h b/sheep/sheep_priv.h
index 3061801..1f0d265 100644
--- a/sheep/sheep_priv.h
+++ b/sheep/sheep_priv.h
@@ -198,8 +198,8 @@ void cluster_queue_request(struct work *work, int idx);
int update_epoch_store(uint32_t epoch);
-int set_cluster_copies(uint32_t copies);
-int get_cluster_copies(uint32_t *copies);
+int set_cluster_copies(uint8_t copies);
+int get_cluster_copies(uint8_t *copies);
int set_cluster_flags(uint16_t flags);
int get_cluster_flags(uint16_t *flags);
diff --git a/sheep/store.c b/sheep/store.c
index be8478f..3596ee0 100644
--- a/sheep/store.c
+++ b/sheep/store.c
@@ -26,8 +26,9 @@
struct sheepdog_config {
uint64_t ctime;
- uint32_t copies;
uint32_t flags;
+ uint8_t copies;
+ uint8_t pad[3];
};
static char *obj_path;
@@ -2043,7 +2044,7 @@ int read_epoch(uint32_t *epoch, uint64_t *ctime,
return SD_RES_SUCCESS;
}
-int set_cluster_copies(uint32_t copies)
+int set_cluster_copies(uint8_t copies)
{
int fd, ret;
@@ -2062,7 +2063,7 @@ int set_cluster_copies(uint32_t copies)
return SD_RES_SUCCESS;
}
-int get_cluster_copies(uint32_t *copies)
+int get_cluster_copies(uint8_t *copies)
{
int fd, ret;
--
1.7.2.5
More information about the sheepdog
mailing list