diff options
author | Neil Brown <neilb@suse.de> | 2006-05-23 04:51:39 +0000 |
---|---|---|
committer | Neil Brown <neilb@suse.de> | 2006-05-23 04:51:39 +0000 |
commit | e5eac01f3d52ceb932445f90c0aaa86f244e26e7 (patch) | |
tree | 39087cb96cd11788707b2fba41683ac6140f2e06 /super0.c | |
parent | a1cbd7d053e034bbfcf337bc9ee7b92ec4c6f6c0 (diff) | |
download | mdadm-e5eac01f3d52ceb932445f90c0aaa86f244e26e7.tar.gz mdadm-e5eac01f3d52ceb932445f90c0aaa86f244e26e7.tar.xz mdadm-e5eac01f3d52ceb932445f90c0aaa86f244e26e7.zip |
Make sure homehost is set correctly when --update=uuid
Signed-off-by: Neil Brown <neilb@suse.de>
Diffstat (limited to 'super0.c')
-rw-r--r-- | super0.c | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -334,7 +334,9 @@ static void getinfo_super0(struct mdinfo *info, void *sbv) } -static int update_super0(struct mdinfo *info, void *sbv, char *update, char *devname, int verbose) +static int update_super0(struct mdinfo *info, void *sbv, char *update, + char *devname, int verbose, + int uuid_set, char *homehost) { /* NOTE: for 'assemble' and 'force' we need to return non-zero if any change was made. * For others, the return value is ignored. @@ -441,6 +443,12 @@ static int update_super0(struct mdinfo *info, void *sbv, char *update, char *dev sb->recovery_cp = 0; } if (strcmp(update, "uuid") == 0) { + if (!uuid_set && homehost) { + unsigned char *hash = SHA1((unsigned char*)homehost, + strlen(homehost), + NULL); + memcpy(info->uuid+2, hash, 8); + } sb->set_uuid0 = info->uuid[0]; sb->set_uuid1 = info->uuid[1]; sb->set_uuid2 = info->uuid[2]; |