diff options
author | NeilBrown <neilb@suse.de> | 2008-09-18 16:08:10 +1000 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2008-09-18 16:08:10 +1000 |
commit | d7288ddc3a06a0912f5f0a3f23ccca76a66ff332 (patch) | |
tree | cd9b208c1048a3b3c2e283379b9c2b4037eb08b3 /util.c | |
parent | 51006d85865f8fd1bb495bfc37fb83414117f149 (diff) | |
download | mdadm-d7288ddc3a06a0912f5f0a3f23ccca76a66ff332.tar.gz mdadm-d7288ddc3a06a0912f5f0a3f23ccca76a66ff332.tar.xz mdadm-d7288ddc3a06a0912f5f0a3f23ccca76a66ff332.zip |
Use uuid as /dev name when assembling array of uncertain origin.
If we aren't sure that the array belongs to 'this' host, use the
uuid to choose a name to avoid any conflict.
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -269,6 +269,25 @@ void copy_uuid(void *a, int b[4], int swapuuid) memcpy(a, b, 16); } +char *fname_from_uuid(struct supertype *st, struct mdinfo *info, char *buf) +{ + int i; + char uuid[16]; + char *c = buf; + strcpy(c, "UUID-"); + c += strlen(c); + copy_uuid(uuid, info->uuid, st->ss->swapuuid); + for (i=0; i<16; i++) { + if (i && (i&3)==0) { + strcpy(c, "-"); + c++; + } + sprintf(c,"%02x", (unsigned char)uuid[i]); + c+= 2; + } + return buf; +} + #ifndef MDASSEMBLE int check_ext2(int fd, char *name) { |