1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-03 05:18:29 +03:00

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

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
Reviewed-By: Petr Rockai <prockai@redhat.com>
This commit is contained in:
Dave Wysochanski 2010-10-12 16:12:50 +00:00
parent 40c6c80723
commit d88090b0ae
4 changed files with 18 additions and 8 deletions

View File

@ -17,6 +17,19 @@
#include "metadata.h"
#include "activate.h"
#include "toolcontext.h"
#include "segtype.h"
char *lv_mirror_log_dup(struct dm_pool *mem, const struct logical_volume *lv)
{
struct lv_segment *seg;
dm_list_iterate_items(seg, &lv->segments) {
if (!seg_is_mirrored(seg) || !seg->log_lv)
continue;
return dm_pool_strdup(mem, seg->log_lv->name);
}
return NULL;
}
int lv_kernel_minor(const struct logical_volume *lv)
{

View File

@ -58,5 +58,6 @@ char *lv_move_pv_dup(struct dm_pool *mem, const struct logical_volume *lv);
char *lv_convert_lv_dup(struct dm_pool *mem, const struct logical_volume *lv);
int lv_kernel_major(const struct logical_volume *lv);
int lv_kernel_minor(const struct logical_volume *lv);
char *lv_mirror_log_dup(struct dm_pool *mem, const struct logical_volume *lv);
#endif

View File

@ -135,7 +135,7 @@ GET_LV_STR_PROPERTY_FN(convert_lv, lv_convert_lv_dup(lv->vg->vgmem, lv))
#define _convert_lv_set _not_implemented_set
GET_LV_STR_PROPERTY_FN(lv_tags, lv_tags_dup(lv))
#define _lv_tags_set _not_implemented_set
#define _mirror_log_get _not_implemented_get
GET_LV_STR_PROPERTY_FN(mirror_log, lv_mirror_log_dup(lv->vg->vgmem, lv))
#define _mirror_log_set _not_implemented_set
#define _modules_get _not_implemented_get
#define _modules_set _not_implemented_set

View File

@ -297,14 +297,10 @@ static int _loglv_disp(struct dm_report *rh, struct dm_pool *mem __attribute__((
const void *data, void *private __attribute__((unused)))
{
const struct logical_volume *lv = (const struct logical_volume *) data;
struct lv_segment *seg;
const char *name;
dm_list_iterate_items(seg, &lv->segments) {
if (!seg_is_mirrored(seg) || !seg->log_lv)
continue;
return dm_report_field_string(rh, field,
(const char **) &seg->log_lv->name);
}
if ((name = lv_mirror_log_dup(mem, lv)))
return dm_report_field_string(rh, field, &name);
dm_report_field_set_value(field, "", NULL);
return 1;