[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[lvm-devel] [PATCH 07/11] Add implementation for vg_mda_*_get functions.



Add 'get' function implementation for vg_mda_count, vg_mda_used_count,
vg_mda_free, vg_mda_size.  These are read-only properties so the 'set'
functions are defined to the _not_implemented function.

Multiply SECTOR_SIZE to vg_mda_size to return the value in bytes.

Signed-off-by: Dave Wysochanski <dwysocha redhat com>
---
 lib/report/properties.c |   35 +++++++++++++++++++++++++++++++----
 1 files changed, 31 insertions(+), 4 deletions(-)

diff --git a/lib/report/properties.c b/lib/report/properties.c
index 9f06d9e..879f849 100644
--- a/lib/report/properties.c
+++ b/lib/report/properties.c
@@ -139,13 +139,40 @@ static int _not_implemented(void *obj, struct lvm_property_type *prop)
 #define _vg_seqno_set _not_implemented
 #define _vg_tags_get _not_implemented
 #define _vg_tags_set _not_implemented
-#define _vg_mda_count_get _not_implemented
+static int _vg_mda_count_get (void *obj, struct lvm_property_type *prop)
+{
+	struct volume_group *vg = (struct volume_group *)obj;
+
+	prop->v.n_val = vg_mda_count(vg);
+	return 1;
+}
 #define _vg_mda_count_set _not_implemented
-#define _vg_mda_used_count_get _not_implemented
+
+static int _vg_mda_used_count_get (void *obj, struct lvm_property_type *prop)
+{
+	struct volume_group *vg = (struct volume_group *)obj;
+
+	prop->v.n_val = vg_mda_used_count(vg);
+	return 1;
+}
 #define _vg_mda_used_count_set _not_implemented
-#define _vg_mda_free_get _not_implemented
+
+static int _vg_mda_free_get (void *obj, struct lvm_property_type *prop)
+{
+	struct volume_group *vg = (struct volume_group *)obj;
+
+	prop->v.n_val = vg_mda_free(vg);
+	return 1;
+}
 #define _vg_mda_free_set _not_implemented
-#define _vg_mda_size_get _not_implemented
+
+static int _vg_mda_size_get (void *obj, struct lvm_property_type *prop)
+{
+	struct volume_group *vg = (struct volume_group *)obj;
+
+	prop->v.n_val = SECTOR_SIZE * vg_mda_size(vg);
+	return 1;
+}
 #define _vg_mda_size_set _not_implemented
 
 static int _vg_mda_copies_get (void *obj, struct lvm_property_type *prop)
-- 
1.7.2.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]