#include "activate.h"
#include "toolcontext.h"
+uint64_t lv_origin_size(const struct logical_volume *lv)
+{
+ if (lv_is_cow(lv))
+ return (uint64_t) find_cow(lv)->len * lv->vg->extent_size;
+ if (lv_is_origin(lv))
+ return lv->size;
+ return 0;
+}
+
char *lv_path_dup(struct dm_pool *mem, const struct logical_volume *lv)
{
char *repstr;
char *lv_uuid_dup(const struct logical_volume *lv);
char *lv_tags_dup(const struct logical_volume *lv);
char *lv_path_dup(struct dm_pool *mem, const struct logical_volume *lv);
+uint64_t lv_origin_size(const struct logical_volume *lv);
#endif
#define _seg_count_set _not_implemented_set
#define _origin_get _not_implemented_get
#define _origin_set _not_implemented_set
-#define _origin_size_get _not_implemented_get
+GET_LV_NUM_PROPERTY_FN(origin_size, lv_origin_size(lv))
#define _origin_size_set _not_implemented_set
#define _snap_percent_get _not_implemented_get
#define _snap_percent_set _not_implemented_set
const struct logical_volume *lv = (const struct logical_volume *) data;
uint64_t size;
- if (lv_is_cow(lv))
- size = (uint64_t) find_cow(lv)->len * lv->vg->extent_size;
- else if (lv_is_origin(lv))
- size = lv->size;
- else
- size = UINT64_C(0);
+ size = lv_origin_size(lv);
return _size64_disp(rh, mem, field, &size, private);
}