diff options
author | Alasdair Kergon <agk@redhat.com> | 2002-03-05 20:03:09 +0000 |
---|---|---|
committer | Alasdair Kergon <agk@redhat.com> | 2002-03-05 20:03:09 +0000 |
commit | 15c325f06aa0dad2145abf217af4fa082c214e36 (patch) | |
tree | 8737373bb3b3b7000b2e568f7ac9dabe73a82128 /lib/uuid/uuid.c | |
parent | 2731508b34b858e8204cb67b5f2b2f3780e9b3eb (diff) | |
download | lvm2-15c325f06aa0dad2145abf217af4fa082c214e36.tar.gz |
o Use new LCK_HOLD flag to indicate whether lock should be held on return
from lock_vol() - otherwise it now attempts to acquire the lock and then
immediately releases it.
o Extend the id field in struct logical_volume to hold VG uuid + LV uuid
for format1. This unique lvid can be used directly when calling lock_vol().
o Add the VG uuid to vgcache to make VG uuid lookups possible. (Another
step towards using them instead of VG names internally.)
Diffstat (limited to 'lib/uuid/uuid.c')
-rw-r--r-- | lib/uuid/uuid.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/uuid/uuid.c b/lib/uuid/uuid.c index 03cdea19d..bc13775a8 100644 --- a/lib/uuid/uuid.c +++ b/lib/uuid/uuid.c @@ -19,26 +19,30 @@ static unsigned char _c[] = static int _built_inverse; static unsigned char _inverse_c[256]; -int id_from_lvnum(struct id *id, int lv_num) +int lvid_from_lvnum(union lvid *lvid, struct id *vgid, int lv_num) { int i; + memcpy(lvid->id, vgid, sizeof(*lvid->id)); + for (i = ID_LEN; i; i--) { - id->uuid[i - 1] = _c[lv_num % (sizeof(_c) - 1)]; + lvid->id[1].uuid[i - 1] = _c[lv_num % (sizeof(_c) - 1)]; lv_num /= sizeof(_c) - 1; } + lvid->s[sizeof(lvid->s) - 1] = '\0'; + return 1; } -int lvnum_from_id(struct id *id) +int lvnum_from_lvid(union lvid *lvid) { int i, lv_num = 0; unsigned char *c; for (i = 0; i < ID_LEN; i++) { lv_num *= sizeof(_c) - 1; - if ((c = strchr(_c, id->uuid[i]))) + if ((c = strchr(_c, lvid->id[1].uuid[i]))) lv_num += (int) (c - _c); } |