diff options
author | Luca Berra <bluca@comedia.it> | 2011-06-17 06:38:14 +0200 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2011-06-17 06:38:14 +0200 |
commit | 3b7e9d0cbeb91d8567a229f26326ec77053b90a2 (patch) | |
tree | 2e76acff823f19553bc4d1ef35c3dc5483679244 /super0.c | |
parent | Fix some compiler warnings. (diff) | |
download | mdadm-3b7e9d0cbeb91d8567a229f26326ec77053b90a2.tar.xz mdadm-3b7e9d0cbeb91d8567a229f26326ec77053b90a2.zip |
Fix some type-aliasing issues.
Warnings for these are reported with -Wstrict-aliasing=2, and
avoiding the cast is certainly an improvement.
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'super0.c')
-rw-r--r-- | super0.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -424,6 +424,7 @@ static int update_super0(struct supertype *st, struct mdinfo *info, * ignored. */ int rv = 0; + int uuid[4]; mdp_super_t *sb = st->sb; if (strcmp(update, "sparc2.2")==0 ) { /* 2.2 sparc put the events in the wrong place @@ -562,7 +563,8 @@ static int update_super0(struct supertype *st, struct mdinfo *info, if (sb->state & (1<<MD_SB_BITMAP_PRESENT)) { struct bitmap_super_s *bm; bm = (struct bitmap_super_s*)(sb+1); - uuid_from_super0(st, (int*)bm->uuid); + uuid_from_super0(st, uuid); + memcpy(bm->uuid, uuid, 16); } } else if (strcmp(update, "no-bitmap") == 0) { sb->state &= ~(1<<MD_SB_BITMAP_PRESENT); @@ -988,6 +990,7 @@ static int add_internal_bitmap0(struct supertype *st, int *chunkp, int chunk = *chunkp; mdp_super_t *sb = st->sb; bitmap_super_t *bms = (bitmap_super_t*)(((char*)sb) + MD_SB_BYTES); + int uuid[4]; min_chunk = 4096; /* sub-page chunks don't work yet.. */ @@ -1011,7 +1014,8 @@ static int add_internal_bitmap0(struct supertype *st, int *chunkp, memset(bms, 0, sizeof(*bms)); bms->magic = __cpu_to_le32(BITMAP_MAGIC); bms->version = __cpu_to_le32(major); - uuid_from_super0(st, (int*)bms->uuid); + uuid_from_super0(st, uuid); + memcpy(bms->uuid, uuid, 16); bms->chunksize = __cpu_to_le32(chunk); bms->daemon_sleep = __cpu_to_le32(delay); bms->sync_size = __cpu_to_le64(size); |