1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

Support device queries by uuid as well as by name. (Used by lvrename.)

This commit is contained in:
Alasdair Kergon 2002-03-18 23:39:42 +00:00
parent 2ed2a72439
commit 902098d615
2 changed files with 77 additions and 79 deletions

View File

@ -30,8 +30,7 @@ static char _dm_dir[PATH_MAX] = DEV_DIR DM_DIR;
* Library users can provide their own logging * Library users can provide their own logging
* function. * function.
*/ */
void _default_log(int level, const char *file, int line, void _default_log(int level, const char *file, int line, const char *f, ...)
const char *f, ...)
{ {
va_list ap; va_list ap;
@ -107,7 +106,8 @@ int dm_task_set_name(struct dm_task *dmt, const char *name)
if (stat(name, &st1) || stat(path, &st2) || if (stat(name, &st1) || stat(path, &st2) ||
!(st1.st_dev == st2.st_dev)) { !(st1.st_dev == st2.st_dev)) {
log_error("dm_task_set_name: Device %s not found", name); log_error("dm_task_set_name: Device %s not found",
name);
return 0; return 0;
} }
@ -119,7 +119,7 @@ int dm_task_set_name(struct dm_task *dmt, const char *name)
return 0; return 0;
} }
log_very_verbose("Setting name: %s", dmt->dev_name); log_debug("Setting name: %s", dmt->dev_name);
return 1; return 1;
} }
@ -136,7 +136,7 @@ int dm_task_set_uuid(struct dm_task *dmt, const char *uuid)
return 0; return 0;
} }
log_very_verbose("Setting uuid: %s", dmt->uuid); log_debug("Setting uuid: %s", dmt->uuid);
return 1; return 1;
} }
@ -144,15 +144,13 @@ int dm_task_set_uuid(struct dm_task *dmt, const char *uuid)
int dm_task_set_minor(struct dm_task *dmt, int minor) int dm_task_set_minor(struct dm_task *dmt, int minor)
{ {
dmt->minor = minor; dmt->minor = minor;
log_debug("Setting minor: %d", dmt->minor);
return 1; return 1;
} }
int dm_task_add_target(struct dm_task *dmt, uint64_t start, uint64_t size,
int dm_task_add_target(struct dm_task *dmt, const char *ttype, const char *params)
uint64_t start,
uint64_t size,
const char *ttype,
const char *params)
{ {
struct target *t = create_target(start, size, ttype, params); struct target *t = create_target(start, size, ttype, params);
@ -187,7 +185,8 @@ int add_dev_node(const char *dev_name, dev_t dev)
return 1; return 1;
if (unlink(path) < 0) { if (unlink(path) < 0) {
log_error("Unable to unlink device node for '%s'", dev_name); log_error("Unable to unlink device node for '%s'",
dev_name);
return 0; return 0;
} }
} }
@ -228,4 +227,3 @@ const char *dm_dir(void)
{ {
return _dm_dir; return _dm_dir;
} }

View File

@ -230,7 +230,7 @@ static int _resume(int argc, char **argv)
static int _info(int argc, char **argv) static int _info(int argc, char **argv)
{ {
int r = 0; int r = 0;
char *uuid; const char *uuid;
/* remove <dev_name> */ /* remove <dev_name> */
struct dm_task *dmt; struct dm_task *dmt;