diff options
author | Neil Brown <neilb@suse.de> | 2006-12-14 17:31:29 +1100 |
---|---|---|
committer | Neil Brown <neilb@suse.de> | 2006-12-14 17:31:29 +1100 |
commit | bf4fb153a4431ad3f91c3e72eebbd661b0455ed7 (patch) | |
tree | 3efe3fbe82794ed5b9834027518525b9bd5e2dcb /super1.c | |
parent | 37dfc3d638aee1fe3ae6d6b4aa0e648e1a9d61ca (diff) |
Fix and test --update=uuid
A number of odd bugs here, but now we have a regression test as well.
Diffstat (limited to 'super1.c')
-rw-r--r-- | super1.c | 16 |
1 files changed, 14 insertions, 2 deletions
@@ -536,11 +536,23 @@ static int update_super1(struct mdinfo *info, void *sbv, char *update, sb->resync_offset = 0ULL; } if (strcmp(update, "uuid") == 0) { - memcpy(sb->set_uuid, info->uuid, 16); + if (super1.swapuuid) { + unsigned char *ac = (unsigned char *)sb->set_uuid; + unsigned char *bc = (unsigned char *)info->uuid; + int i; + for (i=0; i<16; i+= 4) { + ac[i+0] = bc[i+3]; + ac[i+1] = bc[i+2]; + ac[i+2] = bc[i+1]; + ac[i+3] = bc[i+0]; + } + } else + memcpy(sb->set_uuid, info->uuid, 16); + if (__le32_to_cpu(sb->feature_map)&MD_FEATURE_BITMAP_OFFSET) { struct bitmap_super_s *bm; bm = (struct bitmap_super_s*)(sbv+1024); - memcpy(bm->uuid, info->uuid, 16); + memcpy(bm->uuid, sb->set_uuid, 16); } } if (strcmp(update, "homehost") == 0 && |