summaryrefslogtreecommitdiff
path: root/libdm
diff options
context:
space:
mode:
authorPeter Rajnoha <prajnoha@redhat.com>2016-05-12 14:03:32 +0200
committerPeter Rajnoha <prajnoha@redhat.com>2016-06-20 11:33:42 +0200
commit102cc4c1e241ee7c3f6cc8c863a06dd29f373fbc (patch)
tree15fed18bb0257e162871f81bccba1299e7b5535f /libdm
parentf50d4011cdd3ef38c15b9dea05e73321592d93c2 (diff)
downloadlvm2-102cc4c1e241ee7c3f6cc8c863a06dd29f373fbc.tar.gz
libdm: report: remember special field to display selection status in struct row's field_sel_status variable
This allows for moving parts of the code from dm_report_object to dm_report_output which is important for subsequent patches that allow for repeated dm_report_output, not destroying rows on each dm_report_output call.
Diffstat (limited to 'libdm')
-rw-r--r--libdm/libdm-report.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/libdm/libdm-report.c b/libdm/libdm-report.c
index 3fa596e3b..13f202735 100644
--- a/libdm/libdm-report.c
+++ b/libdm/libdm-report.c
@@ -254,6 +254,7 @@ struct row {
struct dm_list fields; /* Fields in display order */
struct dm_report_field *(*sort_fields)[]; /* Fields in sort order */
int selected;
+ struct dm_report_field *field_sel_status;
};
/*
@@ -1910,7 +1911,7 @@ static int _do_report_object(struct dm_report *rh, void *object, int do_output,
const struct dm_report_field_type *fields;
struct field_properties *fp;
struct row *row = NULL;
- struct dm_report_field *field, *field_sel_status = NULL;
+ struct dm_report_field *field;
void *data = NULL;
int len;
int r = 0;
@@ -1962,7 +1963,7 @@ static int _do_report_object(struct dm_report *rh, void *object, int do_output,
if (fp->implicit) {
fields = _implicit_report_fields;
if (!strcmp(fields[fp->field_num].id, SPECIAL_FIELD_SELECTED_ID))
- field_sel_status = field;
+ row->field_sel_status = field;
} else
fields = rh->fields;
@@ -1994,7 +1995,7 @@ static int _do_report_object(struct dm_report *rh, void *object, int do_output,
if (!_check_report_selection(rh, &row->fields)) {
row->selected = 0;
- if (!field_sel_status)
+ if (!row->field_sel_status)
goto out;
/*
@@ -2004,14 +2005,14 @@ static int _do_report_object(struct dm_report *rh, void *object, int do_output,
* The "selected" field reports the result
* of the selection.
*/
- _implicit_report_fields[field_sel_status->props->field_num].report_fn(rh,
- rh->mem, field_sel_status, row, rh->private);
+ _implicit_report_fields[row->field_sel_status->props->field_num].report_fn(rh,
+ rh->mem, row->field_sel_status, row, rh->private);
/*
* If the "selected" field is not displayed, e.g.
* because it is part of the sort field list,
* skip the display of the row as usual.
*/
- if (field_sel_status->props->flags & FLD_HIDDEN)
+ if (row->field_sel_status->props->flags & FLD_HIDDEN)
goto out;
}