* LVM2/lib/report properties.c
@ 2010-09-30 14:08 wysochanski
0 siblings, 0 replies; 11+ messages in thread
From: wysochanski @ 2010-09-30 14:08 UTC (permalink / raw)
To: lvm-devel
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: wysochanski at sourceware.org 2010-09-30 14:08:58
Modified files:
lib/report : properties.c
Log message:
Add 'get' functions for vg fields.
Add 'get' functions based on generic macros for VG, PV, and LV.
Add 'get' functions for vg string fields, vg_name, vg_fmt, vg_sysid,
vg_uuid, vg_attr, and vg_tags, and all numeric fields.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/report/properties.c.diff?cvsroot=lvm2&r1=1.5&r2=1.6
--- LVM2/lib/report/properties.c 2010/09/30 14:08:46 1.5
+++ LVM2/lib/report/properties.c 2010/09/30 14:08:58 1.6
@@ -135,19 +135,19 @@
#define _modules_set _not_implemented
/* VG */
-#define _vg_fmt_get _not_implemented
+GET_VG_STR_PROPERTY_FN(vg_fmt, vg_fmt_dup(vg))
#define _vg_fmt_set _not_implemented
-#define _vg_uuid_get _not_implemented
+GET_VG_STR_PROPERTY_FN(vg_uuid, vg_uuid_dup(vg))
#define _vg_uuid_set _not_implemented
-#define _vg_name_get _not_implemented
+GET_VG_STR_PROPERTY_FN(vg_name, vg_name_dup(vg))
#define _vg_name_set _not_implemented
-#define _vg_attr_get _not_implemented
+GET_VG_STR_PROPERTY_FN(vg_attr, vg_attr_dup(vg->vgmem, vg))
#define _vg_attr_set _not_implemented
GET_VG_NUM_PROPERTY_FN(vg_size, (SECTOR_SIZE * vg_size(vg)))
#define _vg_size_set _not_implemented
GET_VG_NUM_PROPERTY_FN(vg_free, (SECTOR_SIZE * vg_free(vg)))
#define _vg_free_set _not_implemented
-#define _vg_sysid_get _not_implemented
+GET_VG_STR_PROPERTY_FN(vg_sysid, vg_system_id_dup(vg))
#define _vg_sysid_set _not_implemented
GET_VG_NUM_PROPERTY_FN(vg_extent_size, vg->extent_size)
#define _vg_extent_size_set _not_implemented
@@ -167,7 +167,7 @@
#define _snap_count_set _not_implemented
GET_VG_NUM_PROPERTY_FN(vg_seqno, vg->seqno)
#define _vg_seqno_set _not_implemented
-#define _vg_tags_get _not_implemented
+GET_VG_STR_PROPERTY_FN(vg_tags, vg_tags_dup(vg))
#define _vg_tags_set _not_implemented
GET_VG_NUM_PROPERTY_FN(vg_mda_count, (vg_mda_count(vg)))
#define _vg_mda_count_set _not_implemented
^ permalink raw reply [flat|nested] 11+ messages in thread
* LVM2/lib/report properties.c
@ 2010-11-25 14:39 mornfall
0 siblings, 0 replies; 11+ messages in thread
From: mornfall @ 2010-11-25 14:39 UTC (permalink / raw)
To: lvm-devel
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: mornfall at sourceware.org 2010-11-25 14:39:04
Modified files:
lib/report : properties.c
Log message:
All 'size' values of lvm2app properties should be in bytes.
Fix 'seg_size' to return bytes.
Signed-off-by: Dave Wysochanski <wysochanski@pobox.com>
Reviewed-by: Petr Rockai <prockai@redhat.com>
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/report/properties.c.diff?cvsroot=lvm2&r1=1.25&r2=1.26
--- LVM2/lib/report/properties.c 2010/11/17 20:11:27 1.25
+++ LVM2/lib/report/properties.c 2010/11/25 14:39:02 1.26
@@ -230,7 +230,7 @@
#define _seg_start_set _not_implemented_set
GET_LVSEG_NUM_PROPERTY_FN(seg_start_pe, lvseg->le)
#define _seg_start_pe_set _not_implemented_set
-GET_LVSEG_NUM_PROPERTY_FN(seg_size, lvseg_size(lvseg))
+GET_LVSEG_NUM_PROPERTY_FN(seg_size, (SECTOR_SIZE * lvseg_size(lvseg)))
#define _seg_size_set _not_implemented_set
GET_LVSEG_STR_PROPERTY_FN(seg_tags, lvseg_tags_dup(lvseg))
#define _seg_tags_set _not_implemented_set
^ permalink raw reply [flat|nested] 11+ messages in thread
* LVM2/lib/report properties.c
@ 2010-10-12 16:11 wysochanski
0 siblings, 0 replies; 11+ messages in thread
From: wysochanski @ 2010-10-12 16:11 UTC (permalink / raw)
To: lvm-devel
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: wysochanski at sourceware.org 2010-10-12 16:11:20
Modified files:
lib/report : properties.c
Log message:
Add some lv 'get' functions that require no refactoring.
Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
Reviewed-By: Petr Rockai <prockai@redhat.com>
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/report/properties.c.diff?cvsroot=lvm2&r1=1.8&r2=1.9
--- LVM2/lib/report/properties.c 2010/09/30 14:09:45 1.8
+++ LVM2/lib/report/properties.c 2010/10/12 16:11:20 1.9
@@ -97,17 +97,17 @@
#define _pv_mda_used_count_set _not_implemented_set
/* LV */
-#define _lv_uuid_get _not_implemented_get
+GET_LV_STR_PROPERTY_FN(lv_uuid, lv_uuid_dup(lv))
#define _lv_uuid_set _not_implemented_set
#define _lv_name_get _not_implemented_get
#define _lv_name_set _not_implemented_set
#define _lv_path_get _not_implemented_get
#define _lv_path_set _not_implemented_set
-#define _lv_attr_get _not_implemented_get
+GET_LV_STR_PROPERTY_FN(lv_attr, lv_attr_dup(lv->vg->vgmem, lv))
#define _lv_attr_set _not_implemented_set
-#define _lv_major_get _not_implemented_get
+GET_LV_NUM_PROPERTY_FN(lv_major, lv->major)
#define _lv_major_set _not_implemented_set
-#define _lv_minor_get _not_implemented_get
+GET_LV_NUM_PROPERTY_FN(lv_minor, lv->minor)
#define _lv_minor_set _not_implemented_set
#define _lv_read_ahead_get _not_implemented_get
#define _lv_read_ahead_set _not_implemented_set
@@ -117,9 +117,9 @@
#define _lv_kernel_minor_set _not_implemented_set
#define _lv_kernel_read_ahead_get _not_implemented_get
#define _lv_kernel_read_ahead_set _not_implemented_set
-#define _lv_size_get _not_implemented_get
+GET_LV_NUM_PROPERTY_FN(lv_size, lv->size * SECTOR_SIZE)
#define _lv_size_set _not_implemented_set
-#define _seg_count_get _not_implemented_get
+GET_LV_NUM_PROPERTY_FN(seg_count, dm_list_size(&lv->segments))
#define _seg_count_set _not_implemented_set
#define _origin_get _not_implemented_get
#define _origin_set _not_implemented_set
@@ -133,7 +133,7 @@
#define _move_pv_set _not_implemented_set
#define _convert_lv_get _not_implemented_get
#define _convert_lv_set _not_implemented_set
-#define _lv_tags_get _not_implemented_get
+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
#define _mirror_log_set _not_implemented_set
^ permalink raw reply [flat|nested] 11+ messages in thread
* LVM2/lib/report properties.c
@ 2010-09-30 14:09 wysochanski
0 siblings, 0 replies; 11+ messages in thread
From: wysochanski @ 2010-09-30 14:09 UTC (permalink / raw)
To: lvm-devel
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: wysochanski at sourceware.org 2010-09-30 14:09:33
Modified files:
lib/report : properties.c
Log message:
Add pv 'get' functions for all pv properties.
Add 'get' functions for all pv properties.
Multiply by SECTOR_SIZE for pv properties pv_mda_free, pv_mda_size,
pe_start, pv_size, pv_free, pv_used.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/report/properties.c.diff?cvsroot=lvm2&r1=1.6&r2=1.7
--- LVM2/lib/report/properties.c 2010/09/30 14:08:58 1.6
+++ LVM2/lib/report/properties.c 2010/09/30 14:09:33 1.7
@@ -57,37 +57,37 @@
}
/* PV */
-#define _pv_fmt_get _not_implemented
+GET_PV_STR_PROPERTY_FN(pv_fmt, pv_fmt_dup(pv))
#define _pv_fmt_set _not_implemented
-#define _pv_uuid_get _not_implemented
+GET_PV_STR_PROPERTY_FN(pv_uuid, pv_uuid_dup(pv))
#define _pv_uuid_set _not_implemented
-#define _dev_size_get _not_implemented
+GET_PV_NUM_PROPERTY_FN(dev_size, SECTOR_SIZE * pv_dev_size(pv))
#define _dev_size_set _not_implemented
-#define _pv_name_get _not_implemented
+GET_PV_STR_PROPERTY_FN(pv_name, pv_name_dup(pv))
#define _pv_name_set _not_implemented
-#define _pv_mda_free_get _not_implemented
+GET_PV_NUM_PROPERTY_FN(pv_mda_free, SECTOR_SIZE * pv_mda_free(pv))
#define _pv_mda_free_set _not_implemented
-#define _pv_mda_size_get _not_implemented
+GET_PV_NUM_PROPERTY_FN(pv_mda_size, SECTOR_SIZE * pv_mda_size(pv))
#define _pv_mda_size_set _not_implemented
-#define _pe_start_get _not_implemented
+GET_PV_NUM_PROPERTY_FN(pe_start, SECTOR_SIZE * pv->pe_start)
#define _pe_start_set _not_implemented
-#define _pv_size_get _not_implemented
+GET_PV_NUM_PROPERTY_FN(pv_size, SECTOR_SIZE * pv_size_field(pv))
#define _pv_size_set _not_implemented
-#define _pv_free_get _not_implemented
+GET_PV_NUM_PROPERTY_FN(pv_free, SECTOR_SIZE * pv_free(pv))
#define _pv_free_set _not_implemented
-#define _pv_used_get _not_implemented
+GET_PV_NUM_PROPERTY_FN(pv_used, SECTOR_SIZE * pv_used(pv))
#define _pv_used_set _not_implemented
-#define _pv_attr_get _not_implemented
+GET_PV_STR_PROPERTY_FN(pv_attr, pv_attr_dup(pv->vg->vgmem, pv))
#define _pv_attr_set _not_implemented
-#define _pv_pe_count_get _not_implemented
+GET_PV_NUM_PROPERTY_FN(pv_pe_count, pv->pe_count)
#define _pv_pe_count_set _not_implemented
-#define _pv_pe_alloc_count_get _not_implemented
+GET_PV_NUM_PROPERTY_FN(pv_pe_alloc_count, pv->pe_alloc_count)
#define _pv_pe_alloc_count_set _not_implemented
-#define _pv_tags_get _not_implemented
+GET_PV_STR_PROPERTY_FN(pv_tags, pv_tags_dup(pv))
#define _pv_tags_set _not_implemented
-#define _pv_mda_count_get _not_implemented
+GET_PV_NUM_PROPERTY_FN(pv_mda_count, pv_mda_count(pv))
#define _pv_mda_count_set _not_implemented
-#define _pv_mda_used_count_get _not_implemented
+GET_PV_NUM_PROPERTY_FN(pv_mda_used_count, pv_mda_used_count(pv))
#define _pv_mda_used_count_set _not_implemented
/* LV */
^ permalink raw reply [flat|nested] 11+ messages in thread
* LVM2/lib/report properties.c
@ 2010-09-30 14:08 wysochanski
0 siblings, 0 replies; 11+ messages in thread
From: wysochanski @ 2010-09-30 14:08 UTC (permalink / raw)
To: lvm-devel
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: wysochanski at sourceware.org 2010-09-30 14:08:46
Modified files:
lib/report : properties.c
Log message:
Make generic GET_*_PROPERTY_FN macros and define secondary macro for vg, pv, lv.
Will need similar macros for VG, PV and LV, so define a generic one, and just
pass in the struct name and variable name for the specific macro.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/report/properties.c.diff?cvsroot=lvm2&r1=1.4&r2=1.5
--- LVM2/lib/report/properties.c 2010/09/09 19:38:03 1.4
+++ LVM2/lib/report/properties.c 2010/09/30 14:08:46 1.5
@@ -20,14 +20,35 @@
#include "lvm-types.h"
#include "metadata.h"
-#define GET_NUM_PROPERTY_FN(NAME, VALUE) \
+#define GET_NUM_PROPERTY_FN(NAME, VALUE, TYPE, VAR) \
static int _ ## NAME ## _get (void *obj, struct lvm_property_type *prop) \
{ \
- struct volume_group *vg = (struct volume_group *)obj; \
+ struct TYPE *VAR = (struct TYPE *)obj; \
\
prop->v.n_val = VALUE; \
return 1; \
}
+#define GET_VG_NUM_PROPERTY_FN(NAME, VALUE) \
+ GET_NUM_PROPERTY_FN(NAME, VALUE, volume_group, vg)
+#define GET_PV_NUM_PROPERTY_FN(NAME, VALUE) \
+ GET_NUM_PROPERTY_FN(NAME, VALUE, physical_volume, pv)
+#define GET_LV_NUM_PROPERTY_FN(NAME, VALUE) \
+ GET_NUM_PROPERTY_FN(NAME, VALUE, logical_volume, lv)
+
+#define GET_STR_PROPERTY_FN(NAME, VALUE, TYPE, VAR) \
+static int _ ## NAME ## _get (void *obj, struct lvm_property_type *prop) \
+{ \
+ struct TYPE *VAR = (struct TYPE *)obj; \
+\
+ prop->v.s_val = (char *)VALUE; \
+ return 1; \
+}
+#define GET_VG_STR_PROPERTY_FN(NAME, VALUE) \
+ GET_STR_PROPERTY_FN(NAME, VALUE, volume_group, vg)
+#define GET_PV_STR_PROPERTY_FN(NAME, VALUE) \
+ GET_STR_PROPERTY_FN(NAME, VALUE, physical_volume, pv)
+#define GET_LV_STR_PROPERTY_FN(NAME, VALUE) \
+ GET_STR_PROPERTY_FN(NAME, VALUE, logical_volume, lv)
static int _not_implemented(void *obj, struct lvm_property_type *prop)
{
@@ -122,41 +143,41 @@
#define _vg_name_set _not_implemented
#define _vg_attr_get _not_implemented
#define _vg_attr_set _not_implemented
-GET_NUM_PROPERTY_FN(vg_size, (SECTOR_SIZE * vg_size(vg)))
+GET_VG_NUM_PROPERTY_FN(vg_size, (SECTOR_SIZE * vg_size(vg)))
#define _vg_size_set _not_implemented
-GET_NUM_PROPERTY_FN(vg_free, (SECTOR_SIZE * vg_free(vg)))
+GET_VG_NUM_PROPERTY_FN(vg_free, (SECTOR_SIZE * vg_free(vg)))
#define _vg_free_set _not_implemented
#define _vg_sysid_get _not_implemented
#define _vg_sysid_set _not_implemented
-GET_NUM_PROPERTY_FN(vg_extent_size, vg->extent_size)
+GET_VG_NUM_PROPERTY_FN(vg_extent_size, vg->extent_size)
#define _vg_extent_size_set _not_implemented
-GET_NUM_PROPERTY_FN(vg_extent_count, vg->extent_count)
+GET_VG_NUM_PROPERTY_FN(vg_extent_count, vg->extent_count)
#define _vg_extent_count_set _not_implemented
-GET_NUM_PROPERTY_FN(vg_free_count, vg->free_count)
+GET_VG_NUM_PROPERTY_FN(vg_free_count, vg->free_count)
#define _vg_free_count_set _not_implemented
-GET_NUM_PROPERTY_FN(max_lv, vg->max_lv)
+GET_VG_NUM_PROPERTY_FN(max_lv, vg->max_lv)
#define _max_lv_set _not_implemented
-GET_NUM_PROPERTY_FN(max_pv, vg->max_pv)
+GET_VG_NUM_PROPERTY_FN(max_pv, vg->max_pv)
#define _max_pv_set _not_implemented
-GET_NUM_PROPERTY_FN(pv_count, vg->pv_count)
+GET_VG_NUM_PROPERTY_FN(pv_count, vg->pv_count)
#define _pv_count_set _not_implemented
-GET_NUM_PROPERTY_FN(lv_count, (vg_visible_lvs(vg)))
+GET_VG_NUM_PROPERTY_FN(lv_count, (vg_visible_lvs(vg)))
#define _lv_count_set _not_implemented
-GET_NUM_PROPERTY_FN(snap_count, (snapshot_count(vg)))
+GET_VG_NUM_PROPERTY_FN(snap_count, (snapshot_count(vg)))
#define _snap_count_set _not_implemented
-GET_NUM_PROPERTY_FN(vg_seqno, vg->seqno)
+GET_VG_NUM_PROPERTY_FN(vg_seqno, vg->seqno)
#define _vg_seqno_set _not_implemented
#define _vg_tags_get _not_implemented
#define _vg_tags_set _not_implemented
-GET_NUM_PROPERTY_FN(vg_mda_count, (vg_mda_count(vg)))
+GET_VG_NUM_PROPERTY_FN(vg_mda_count, (vg_mda_count(vg)))
#define _vg_mda_count_set _not_implemented
-GET_NUM_PROPERTY_FN(vg_mda_used_count, (vg_mda_used_count(vg)))
+GET_VG_NUM_PROPERTY_FN(vg_mda_used_count, (vg_mda_used_count(vg)))
#define _vg_mda_used_count_set _not_implemented
-GET_NUM_PROPERTY_FN(vg_mda_free, (SECTOR_SIZE * vg_mda_free(vg)))
+GET_VG_NUM_PROPERTY_FN(vg_mda_free, (SECTOR_SIZE * vg_mda_free(vg)))
#define _vg_mda_free_set _not_implemented
-GET_NUM_PROPERTY_FN(vg_mda_size, (SECTOR_SIZE * vg_mda_size(vg)))
+GET_VG_NUM_PROPERTY_FN(vg_mda_size, (SECTOR_SIZE * vg_mda_size(vg)))
#define _vg_mda_size_set _not_implemented
-GET_NUM_PROPERTY_FN(vg_mda_copies, (vg_mda_copies(vg)))
+GET_VG_NUM_PROPERTY_FN(vg_mda_copies, (vg_mda_copies(vg)))
#define _vg_mda_copies_set _not_implemented
/* LVSEG */
^ permalink raw reply [flat|nested] 11+ messages in thread* LVM2/lib/report properties.c
@ 2010-09-09 19:38 wysochanski
0 siblings, 0 replies; 11+ messages in thread
From: wysochanski @ 2010-09-09 19:38 UTC (permalink / raw)
To: lvm-devel
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: wysochanski at sourceware.org 2010-09-09 19:38:03
Modified files:
lib/report : properties.c
Log message:
Update vg_mda_free 'get' function to multiply by SECTOR_SIZE.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/report/properties.c.diff?cvsroot=lvm2&r1=1.3&r2=1.4
--- LVM2/lib/report/properties.c 2010/08/20 13:02:39 1.3
+++ LVM2/lib/report/properties.c 2010/09/09 19:38:03 1.4
@@ -152,7 +152,7 @@
#define _vg_mda_count_set _not_implemented
GET_NUM_PROPERTY_FN(vg_mda_used_count, (vg_mda_used_count(vg)))
#define _vg_mda_used_count_set _not_implemented
-GET_NUM_PROPERTY_FN(vg_mda_free, (vg_mda_free(vg)))
+GET_NUM_PROPERTY_FN(vg_mda_free, (SECTOR_SIZE * vg_mda_free(vg)))
#define _vg_mda_free_set _not_implemented
GET_NUM_PROPERTY_FN(vg_mda_size, (SECTOR_SIZE * vg_mda_size(vg)))
#define _vg_mda_size_set _not_implemented
^ permalink raw reply [flat|nested] 11+ messages in thread
* LVM2/lib/report properties.c
@ 2010-08-20 13:02 wysochanski
2010-08-20 13:49 ` Zdenek Kabelac
0 siblings, 1 reply; 11+ messages in thread
From: wysochanski @ 2010-08-20 13:02 UTC (permalink / raw)
To: lvm-devel
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: wysochanski at sourceware.org 2010-08-20 13:02:39
Modified files:
lib/report : properties.c
Log message:
Define GET_NUM_PROPERTY_FN macro to simplify numeric property 'get' functions.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/report/properties.c.diff?cvsroot=lvm2&r1=1.2&r2=1.3
--- LVM2/lib/report/properties.c 2010/08/20 12:45:09 1.2
+++ LVM2/lib/report/properties.c 2010/08/20 13:02:39 1.3
@@ -20,6 +20,15 @@
#include "lvm-types.h"
#include "metadata.h"
+#define GET_NUM_PROPERTY_FN(NAME, VALUE) \
+static int _ ## NAME ## _get (void *obj, struct lvm_property_type *prop) \
+{ \
+ struct volume_group *vg = (struct volume_group *)obj; \
+\
+ prop->v.n_val = VALUE; \
+ return 1; \
+}
+
static int _not_implemented(void *obj, struct lvm_property_type *prop)
{
log_errno(ENOSYS, "Function not implemented");
^ permalink raw reply [flat|nested] 11+ messages in thread* LVM2/lib/report properties.c
2010-08-20 13:02 wysochanski
@ 2010-08-20 13:49 ` Zdenek Kabelac
2010-08-20 14:45 ` Dave Wysochanski
0 siblings, 1 reply; 11+ messages in thread
From: Zdenek Kabelac @ 2010-08-20 13:49 UTC (permalink / raw)
To: lvm-devel
Dne 20.8.2010 15:02, wysochanski at sourceware.org napsal(a):
> CVSROOT: /cvs/lvm2
> Module name: LVM2
> Changes by: wysochanski at sourceware.org 2010-08-20 13:02:39
>
> Modified files:
> lib/report : properties.c
>
> Log message:
> Define GET_NUM_PROPERTY_FN macro to simplify numeric property 'get' functions.
>
> Patches:
> http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/report/properties.c.diff?cvsroot=lvm2&r1=1.2&r2=1.3
>
> --- LVM2/lib/report/properties.c 2010/08/20 12:45:09 1.2
> +++ LVM2/lib/report/properties.c 2010/08/20 13:02:39 1.3
> @@ -20,6 +20,15 @@
> #include "lvm-types.h"
> #include "metadata.h"
>
> +#define GET_NUM_PROPERTY_FN(NAME, VALUE) \
> +static int _ ## NAME ## _get (void *obj, struct lvm_property_type *prop) \
> +{ \
> + struct volume_group *vg = (struct volume_group *)obj; \
> +\
> + prop->v.n_val = VALUE; \
> + return 1; \
> +}
> +
Is this going to be part of liblvm API - or it's only purpose is to be used
through liblvm2api - in that case it would be better to have this code
compiled as a part of liblvm2api library and not increasing size of liblvm ?
Zdenek
^ permalink raw reply [flat|nested] 11+ messages in thread* LVM2/lib/report properties.c
2010-08-20 13:49 ` Zdenek Kabelac
@ 2010-08-20 14:45 ` Dave Wysochanski
2010-08-20 17:08 ` Alasdair G Kergon
0 siblings, 1 reply; 11+ messages in thread
From: Dave Wysochanski @ 2010-08-20 14:45 UTC (permalink / raw)
To: lvm-devel
On Fri, 2010-08-20 at 15:49 +0200, Zdenek Kabelac wrote:
> Dne 20.8.2010 15:02, wysochanski at sourceware.org napsal(a):
> > CVSROOT: /cvs/lvm2
> > Module name: LVM2
> > Changes by: wysochanski at sourceware.org 2010-08-20 13:02:39
> >
> > Modified files:
> > lib/report : properties.c
> >
> > Log message:
> > Define GET_NUM_PROPERTY_FN macro to simplify numeric property 'get' functions.
> >
> > Patches:
> > http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/report/properties.c.diff?cvsroot=lvm2&r1=1.2&r2=1.3
> >
> > --- LVM2/lib/report/properties.c 2010/08/20 12:45:09 1.2
> > +++ LVM2/lib/report/properties.c 2010/08/20 13:02:39 1.3
> > @@ -20,6 +20,15 @@
> > #include "lvm-types.h"
> > #include "metadata.h"
> >
> > +#define GET_NUM_PROPERTY_FN(NAME, VALUE) \
> > +static int _ ## NAME ## _get (void *obj, struct lvm_property_type *prop) \
> > +{ \
> > + struct volume_group *vg = (struct volume_group *)obj; \
> > +\
> > + prop->v.n_val = VALUE; \
> > + return 1; \
> > +}
> > +
>
>
> Is this going to be part of liblvm API - or it's only purpose is to be used
> through liblvm2api - in that case it would be better to have this code
> compiled as a part of liblvm2api library and not increasing size of liblvm ?
>
I originally had properties.[ch] inside liblvm subdirectory, but then
reconsidered based on:
1) Longer term the goal is for tools to call the library. As a result,
I try to put only what is absolutely necessary inside liblvm.
2) Based on the fact properties.c included lib/report/columns.h, it
seemed like extending the reporting infrastructure was better done
inside lib instead of liblvm
That said, I had not considered size implications - can you be more
specific as to your concerns there? Is it something specific like
initrd, or a design concern?
^ permalink raw reply [flat|nested] 11+ messages in thread
* LVM2/lib/report properties.c
@ 2010-08-20 12:45 wysochanski
0 siblings, 0 replies; 11+ messages in thread
From: wysochanski @ 2010-08-20 12:45 UTC (permalink / raw)
To: lvm-devel
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: wysochanski at sourceware.org 2010-08-20 12:45:09
Modified files:
lib/report : properties.c
Log message:
Add implmentation for simple numeric 'get' property functions.
Add 'get' functions based on the simple macro function definition for a
numeric property.
Add 'get' functions for the following: _vg_extent_count_get,
_vg_free_count_get, _max_lv_get, _max_pv_get, _pv_count_get,
_lv_count_get, _snap_count_get, _vg_seqno_get, _vg_size_get,
_vg_free_get, vg_mda_*.
For size functions, multiply by SECTOR_SIZE to return the value in bytes.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/report/properties.c.diff?cvsroot=lvm2&r1=1.1&r2=1.2
--- LVM2/lib/report/properties.c 2010/08/20 12:44:58 1.1
+++ LVM2/lib/report/properties.c 2010/08/20 12:45:09 1.2
@@ -113,41 +113,41 @@
#define _vg_name_set _not_implemented
#define _vg_attr_get _not_implemented
#define _vg_attr_set _not_implemented
-#define _vg_size_get _not_implemented
+GET_NUM_PROPERTY_FN(vg_size, (SECTOR_SIZE * vg_size(vg)))
#define _vg_size_set _not_implemented
-#define _vg_free_get _not_implemented
+GET_NUM_PROPERTY_FN(vg_free, (SECTOR_SIZE * vg_free(vg)))
#define _vg_free_set _not_implemented
#define _vg_sysid_get _not_implemented
#define _vg_sysid_set _not_implemented
-#define _vg_extent_size_get _not_implemented
+GET_NUM_PROPERTY_FN(vg_extent_size, vg->extent_size)
#define _vg_extent_size_set _not_implemented
-#define _vg_extent_count_get _not_implemented
+GET_NUM_PROPERTY_FN(vg_extent_count, vg->extent_count)
#define _vg_extent_count_set _not_implemented
-#define _vg_free_count_get _not_implemented
+GET_NUM_PROPERTY_FN(vg_free_count, vg->free_count)
#define _vg_free_count_set _not_implemented
-#define _max_lv_get _not_implemented
+GET_NUM_PROPERTY_FN(max_lv, vg->max_lv)
#define _max_lv_set _not_implemented
-#define _max_pv_get _not_implemented
+GET_NUM_PROPERTY_FN(max_pv, vg->max_pv)
#define _max_pv_set _not_implemented
-#define _pv_count_get _not_implemented
+GET_NUM_PROPERTY_FN(pv_count, vg->pv_count)
#define _pv_count_set _not_implemented
-#define _lv_count_get _not_implemented
+GET_NUM_PROPERTY_FN(lv_count, (vg_visible_lvs(vg)))
#define _lv_count_set _not_implemented
-#define _snap_count_get _not_implemented
+GET_NUM_PROPERTY_FN(snap_count, (snapshot_count(vg)))
#define _snap_count_set _not_implemented
-#define _vg_seqno_get _not_implemented
+GET_NUM_PROPERTY_FN(vg_seqno, vg->seqno)
#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
+GET_NUM_PROPERTY_FN(vg_mda_count, (vg_mda_count(vg)))
#define _vg_mda_count_set _not_implemented
-#define _vg_mda_used_count_get _not_implemented
+GET_NUM_PROPERTY_FN(vg_mda_used_count, (vg_mda_used_count(vg)))
#define _vg_mda_used_count_set _not_implemented
-#define _vg_mda_free_get _not_implemented
+GET_NUM_PROPERTY_FN(vg_mda_free, (vg_mda_free(vg)))
#define _vg_mda_free_set _not_implemented
-#define _vg_mda_size_get _not_implemented
+GET_NUM_PROPERTY_FN(vg_mda_size, (SECTOR_SIZE * vg_mda_size(vg)))
#define _vg_mda_size_set _not_implemented
-#define _vg_mda_copies_get _not_implemented
+GET_NUM_PROPERTY_FN(vg_mda_copies, (vg_mda_copies(vg)))
#define _vg_mda_copies_set _not_implemented
/* LVSEG */
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2010-11-25 14:39 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-30 14:08 LVM2/lib/report properties.c wysochanski
-- strict thread matches above, loose matches on Subject: below --
2010-11-25 14:39 mornfall
2010-10-12 16:11 wysochanski
2010-09-30 14:09 wysochanski
2010-09-30 14:08 wysochanski
2010-09-09 19:38 wysochanski
2010-08-20 13:02 wysochanski
2010-08-20 13:49 ` Zdenek Kabelac
2010-08-20 14:45 ` Dave Wysochanski
2010-08-20 17:08 ` Alasdair G Kergon
2010-08-20 12:45 wysochanski
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.