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

Refactor and add code for (lv) 'lv_origin' get function.

This commit is contained in:
Dave Wysochanski 2010-10-21 14:49:20 +00:00
parent 6103254393
commit f1fc310730
3 changed files with 9 additions and 1 deletions

View File

@ -20,6 +20,13 @@
#include "segtype.h" #include "segtype.h"
#include "str_list.h" #include "str_list.h"
char *lv_origin_dup(struct dm_pool *mem, const struct logical_volume *lv)
{
if (lv_is_cow(lv))
return lv_name_dup(mem, origin_from_cow(lv));
return NULL;
}
char *lv_name_dup(struct dm_pool *mem, const struct logical_volume *lv) char *lv_name_dup(struct dm_pool *mem, const struct logical_volume *lv)
{ {
return dm_pool_strdup(mem, lv->name); return dm_pool_strdup(mem, lv->name);

View File

@ -61,5 +61,6 @@ int lv_kernel_minor(const struct logical_volume *lv);
char *lv_mirror_log_dup(struct dm_pool *mem, const struct logical_volume *lv); char *lv_mirror_log_dup(struct dm_pool *mem, const struct logical_volume *lv);
char *lv_modules_dup(struct dm_pool *mem, const struct logical_volume *lv); char *lv_modules_dup(struct dm_pool *mem, const struct logical_volume *lv);
char *lv_name_dup(struct dm_pool *mem, const struct logical_volume *lv); char *lv_name_dup(struct dm_pool *mem, const struct logical_volume *lv);
char *lv_origin_dup(struct dm_pool *mem, const struct logical_volume *lv);
#endif #endif

View File

@ -121,7 +121,7 @@ GET_LV_NUM_PROPERTY_FN(lv_size, lv->size * SECTOR_SIZE)
#define _lv_size_set _not_implemented_set #define _lv_size_set _not_implemented_set
GET_LV_NUM_PROPERTY_FN(seg_count, dm_list_size(&lv->segments)) GET_LV_NUM_PROPERTY_FN(seg_count, dm_list_size(&lv->segments))
#define _seg_count_set _not_implemented_set #define _seg_count_set _not_implemented_set
#define _origin_get _not_implemented_get GET_LV_STR_PROPERTY_FN(origin, lv_origin_dup(lv->vg->vgmem, lv))
#define _origin_set _not_implemented_set #define _origin_set _not_implemented_set
GET_LV_NUM_PROPERTY_FN(origin_size, lv_origin_size(lv)) GET_LV_NUM_PROPERTY_FN(origin_size, lv_origin_size(lv))
#define _origin_size_set _not_implemented_set #define _origin_size_set _not_implemented_set