1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-02 01:18:26 +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:
Zdenek Kabelac 2014-07-02 00:01:46 +02:00
parent 6f6900d457
commit e21d0eb90e
2 changed files with 11 additions and 0 deletions

View File

@ -93,6 +93,15 @@ const char *get_percent_string(percent_type_t 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_SHARED 1
#define BASE_1024 8

View File

@ -22,6 +22,8 @@
#include <stdint.h>
const char *display_lvname(const struct logical_volume *lv);
/* Specify size in KB */
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);