struct dm_info info;
/* lvid plus layer */
- const char *dlid;
+ char *dlid;
struct logical_volume *lv;
int with_open_count, struct dm_info *info,
struct dm_pool *mem, char **uuid_out)
{
- if (!mknodes && dlid && *dlid &&
- _info_run(NULL, dlid, info, 0, with_open_count, mem, uuid_out) &&
- info->exists)
- return 1;
+ if (!mknodes && dlid && *dlid) {
+ if (_info_run(NULL, dlid, info, 0, with_open_count, mem,
+ uuid_out) &&
+ info->exists)
+ return 1;
+ else if (_info_run(NULL, dlid + sizeof(UUID_PREFIX), info,
+ 0, with_open_count, mem, uuid_out) &&
+ info->exists)
+ return 1;
+ }
if (name)
return _info_run(name, NULL, info, mknodes, with_open_count,
char **type, uint32_t type_size, char **params,
uint32_t param_size)
{
- if (uuid && *uuid && _status_run(NULL, uuid, start, length, type,
- type_size, params, param_size)
- && *params)
- return 1;
+ if (uuid && *uuid) {
+ if (_status_run(NULL, uuid, start, length, type,
+ type_size, params, param_size) &&
+ *params)
+ return 1;
+ else if (_status_run(NULL, uuid + sizeof(UUID_PREFIX), start,
+ length, type, type_size, params,
+ param_size) &&
+ *params)
+ return 1;
+ }
if (name && _status_run(name, NULL, start, length, type, type_size,
params, param_size))
struct logical_volume *lv, float *percent,
uint32_t *event_nr)
{
- if (dlid && *dlid
- && _percent_run(dm, NULL, dlid, target_type, wait, lv, percent,
- event_nr))
- return 1;
+ if (dlid && *dlid) {
+ if (_percent_run(dm, NULL, dlid, target_type, wait, lv, percent,
+ event_nr))
+ return 1;
+ else if (_percent_run(dm, NULL, dlid + sizeof(UUID_PREFIX),
+ target_type, wait, lv, percent,
+ event_nr))
+ return 1;
+ }
if (name && _percent_run(dm, name, NULL, target_type, wait, lv, percent,
event_nr))
}
static struct dev_layer *_create_dev(struct dev_manager *dm, char *name,
- const char *dlid)
+ char *dlid)
{
struct dev_layer *dl;
char *uuid;
return NULL;
}
- if (dl->info.exists)
- dl->dlid = uuid;
- else
+ if (dl->info.exists) {
+ /* If old-style UUID found, convert it. */
+ if (strncmp(uuid, UUID_PREFIX, sizeof(UUID_PREFIX) - 1)) {
+ if (!(dl->dlid = dm_pool_alloc(dm->mem, sizeof(UUID_PREFIX) + strlen(uuid)))) {
+ stack;
+ return NULL;
+ }
+ memcpy(dl->dlid, UUID_PREFIX, sizeof(UUID_PREFIX) - 1);
+ memcpy(dl->dlid + sizeof(UUID_PREFIX) - 1, uuid, strlen(uuid));
+ } else
+ dl->dlid = uuid;
+ } else
dl->dlid = dlid;
list_init(&dl->pre_create);
return 0;
}
- if (!(dl = _create_dev(dm, copy, ""))) {
+ if (!(dl = _create_dev(dm, copy, (char *)""))) {
stack;
return 0;
}