mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-04 09:18:36 +03:00
display: add display_lvname
Add simple function to print vg/lv name. Useful i.e. in error messages.
This commit is contained in:
parent
6f6900d457
commit
e21d0eb90e
@ -93,6 +93,15 @@ const char *get_percent_string(percent_type_t def)
|
|||||||
return _percent_types[def];
|
return _percent_types[def];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *display_lvname(const struct logical_volume *lv)
|
||||||
|
{
|
||||||
|
char buf[NAME_LEN * 2 + 2];
|
||||||
|
|
||||||
|
(void) snprintf(buf, sizeof(buf), "%s/%s", lv->vg->name, lv->name);
|
||||||
|
|
||||||
|
return dm_pool_strdup(lv->vg->cmd->mem, buf) ? : lv->name; /* at least LV name... */
|
||||||
|
}
|
||||||
|
|
||||||
#define BASE_UNKNOWN 0
|
#define BASE_UNKNOWN 0
|
||||||
#define BASE_SHARED 1
|
#define BASE_SHARED 1
|
||||||
#define BASE_1024 8
|
#define BASE_1024 8
|
||||||
|
@ -22,6 +22,8 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
const char *display_lvname(const struct logical_volume *lv);
|
||||||
|
|
||||||
/* Specify size in KB */
|
/* Specify size in KB */
|
||||||
const char *display_size(const struct cmd_context *cmd, uint64_t size);
|
const char *display_size(const struct cmd_context *cmd, uint64_t size);
|
||||||
const char *display_size_long(const struct cmd_context *cmd, uint64_t size);
|
const char *display_size_long(const struct cmd_context *cmd, uint64_t size);
|
||||||
|
Loading…
Reference in New Issue
Block a user