All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/30]: liblvm object property baseline, take2
@ 2009-05-11 13:01 Dave Wysochanski
  2009-05-11 13:01 ` [PATCH 01/30] Define handles to liblvm objects for pv, vg, lv, lvseg, pvseg Dave Wysochanski
  2009-05-14  3:33 ` [PATCH 0/30]: liblvm object property baseline, take2 Dave Wysochanski
  0 siblings, 2 replies; 32+ messages in thread
From: Dave Wysochanski @ 2009-05-11 13:01 UTC (permalink / raw)
  To: lvm-devel

The following 30 patches supercede the previous 8 patch posting and
implement a baseline for liblvm objects and their properties.  The primary
focus/goal of these patches are:
1. Define / clarify the main liblvm objects and their handles
2. Get the numeric object properties for a specific handle
3. Convert reporting commands to call liblvm 'get' functions for 'NUM' fields

Together with the handles, the 'get' functions will provide equivalent
functionality to the reporting commands (pvs, vgs, lvs) while keeping with
the object model of liblvm.

This set of patches converts most all numeric reporting field 'disp' functions
to call into liblvm 'get' property functions.  There should be no functional
change after this patch, and I believe this patchset, while lengthy, should
be relatively easy to review.

The bulk of this patchset involves a couple changes for each field:
1) moves the logic of the field data calculation from the 'disp' function
into liblvm 'get' function
2) adds a 'disp' function for fields with simple dereferences (these were
originally covered by the same 'disp' function (for example, _uint32_disp())

There are a few areas of particular interest in this patchset.  First, the
return types for all the 'get' functions are the same at uint64_t.  This would
allow internal changes to field sizes without making them visible in the API
but also obscures the internal type size.  I could easily make the internal
size match the return type of the 'get' function if this is deemed the better
tradeoff, but I thought fixed uint64_t was decided in a previous discussion.
Second, a couple numeric fields were ommitted from this patch: snap_percent,
and copy_percent.  These fields involve a float value and so will be dealt
with in a later patchset.

Along with this patchset I've been adding nightly tests to cover some of the
numeric reporting fields not yet covered.  We are still missing a few fields
in the nightly tests and some deserve better coverage but we are getting
closer to full coverage.

This set of patches pass the nightly test suite.
They apply cleanly against the following commit:
commit 97e41de23f5a021dfba8fb16692a9e2badec7d56
Author: Milan Broz <mbroz@redhat.com>
Date:   Mon May 11 10:35:00 2009 +0000

    Fix previous commit (scripts/Makefile targets order)




^ permalink raw reply	[flat|nested] 32+ messages in thread

* [PATCH 01/30] Define handles to liblvm objects for pv, vg, lv, lvseg, pvseg.
  2009-05-11 13:01 [PATCH 0/30]: liblvm object property baseline, take2 Dave Wysochanski
@ 2009-05-11 13:01 ` Dave Wysochanski
  2009-05-11 13:01   ` [PATCH 02/30] Add lvm_object_prop.pl to generate liblvm object property functions Dave Wysochanski
  2009-05-14  3:33 ` [PATCH 0/30]: liblvm object property baseline, take2 Dave Wysochanski
  1 sibling, 1 reply; 32+ messages in thread
From: Dave Wysochanski @ 2009-05-11 13:01 UTC (permalink / raw)
  To: lvm-devel

Define the 5 main liblvm objects to be the pv, vg, lv, lvseg, and pvseg.
We need handles defined to all these objects in order for liblvm to be
equivalent to the reporting commands pvs, vgs, and lvs.

- move vg_t, lv_t, and pv_t from metadata-exported.h into lvm.h
- move lv_segment and pv_segment forward declarations into lvm.h
- add lvseg_t and pvseg_t to lvm.h

NOTE: We currently have an inconsistency in handle definitions.
lvm_t is defined as a pointer, while these other handles are just
structures.  We should pick one scheme and be consistent - perhaps
define all handles as pointers (this is what I've seen elsewhere).

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
---
 lib/metadata/metadata-exported.h |   11 +----------
 liblvm/lvm.h                     |   15 +++++++++++++++
 2 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
index 3b13e37..6f5d73b 100644
--- a/lib/metadata/metadata-exported.h
+++ b/lib/metadata/metadata-exported.h
@@ -22,16 +22,7 @@
 #define _LVM_METADATA_EXPORTED_H
 
 #include "uuid.h"
-
-struct physical_volume;
-typedef struct physical_volume pv_t;
-struct volume_group;
-typedef struct volume_group vg_t;
-
-struct logical_volume;
-
-struct lv_segment;
-struct pv_segment;
+#include "lvm.h"
 
 #define MAX_STRIPES 128U
 #define SECTOR_SHIFT 9L
diff --git a/liblvm/lvm.h b/liblvm/lvm.h
index 3b60510..4e71e15 100644
--- a/liblvm/lvm.h
+++ b/liblvm/lvm.h
@@ -18,6 +18,20 @@
 
 #include <stdint.h>
 
+/* Internal object structures */
+struct volume_group;
+struct physical_volume;
+struct logical_volume;
+struct lv_segment;
+struct pv_segment;
+
+/* liblvm handles to objects pv, vg, lv, pvseg, lvseg */
+typedef struct volume_group vg_t;
+typedef struct physical_volume pv_t;
+typedef struct logical_volume lv_t;
+typedef struct pv_segment pvseg_t;
+typedef struct lv_segment lvseg_t;
+
 struct lvm; /* internal data */
 
 /**
@@ -54,4 +68,5 @@ void lvm_destroy(lvm_t libh);
  */
 int lvm_reload_config(lvm_t libh);
 
+
 #endif /* _LIB_LVM_H */
-- 
1.6.0.6



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 02/30] Add lvm_object_prop.pl to generate liblvm object property functions.
  2009-05-11 13:01 ` [PATCH 01/30] Define handles to liblvm objects for pv, vg, lv, lvseg, pvseg Dave Wysochanski
@ 2009-05-11 13:01   ` Dave Wysochanski
  2009-05-11 13:01     ` [PATCH 03/30] Add generated files, lvm_object_prop.[ch], to lib/report directory and build Dave Wysochanski
  0 siblings, 1 reply; 32+ messages in thread
From: Dave Wysochanski @ 2009-05-11 13:01 UTC (permalink / raw)
  To: lvm-devel

The intent of this perl code, lvm_object_prop.pl, is to help maintain
liblvm object property consistency with the reporting commands pvs, vgs, lvs.
As new fields get added to columns.h, we should re-run this script on the new
FIELD line(s), take the generated code, edit as appropriate, and place into
appropriate liblvm code file.

This patch adds the perl file, lvm_object_prop.pl.  A later patch will
add the files this code generates, namely the liblvm object property
function header and C file, lvm_object_prop.[ch].

NOTE: The term 'attribute' is used in some of the reporting fields (for
example, vg_attr), so we avoid it here and instead use the term 'properties'
or 'prop'.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
---
 lib/report/lvm_object_prop.pl |  232 +++++++++++++++++++++++++++++++++++++++++
 1 files changed, 232 insertions(+), 0 deletions(-)
 create mode 100644 lib/report/lvm_object_prop.pl

diff --git a/lib/report/lvm_object_prop.pl b/lib/report/lvm_object_prop.pl
new file mode 100644
index 0000000..824d33a
--- /dev/null
+++ b/lib/report/lvm_object_prop.pl
@@ -0,0 +1,232 @@
+#!/usr/bin/perl
+#
+# Take the colunms.h file as input and produce a header and
+# default code for liblvm object property accessor and mutator functions.
+# To run: perl lvm_object_prop.pl < columns.h
+#
+# For maintenance purposes, when adding a new line to columns.h,
+# we can pipe the diff to this program to generate the new prototypes
+# and C code, then cut/paste into the proper liblvm files.
+#
+
+sub write_code_header;
+sub write_code_body;
+sub write_code_body_get;
+sub write_code_footer;
+sub write_include_header;
+sub write_include_body;
+sub write_include_footer;
+
+#
+# Open the files and write the headers
+#
+$outfile = "lvm_object_prop";
+open(INCLUDE_FILE, ">./$outfile.h") || die "Cannot open $outfile.h!\n";
+write_include_header(INCLUDE_FILE);
+open(CODE_FILE, ">./$outfile.c") || die "Cannot open $outfile.c!\n";
+write_code_header(CODE_FILE);
+
+#
+# Write the include and code body
+#
+while(<>) {
+    # Skip if line does not begin w/"FIELD" - not perfect but does the job
+    if ($_ !~ /^FIELD/) {
+	next;
+    }
+    # Pull out the actual parameters to the FIELD macro
+    m%FIELD\((.*)\)%;
+    $_ = $1;
+
+    #FIELD(LVS, lv, STR, "LV UUID", lvid.id[1], 38, uuid, "lv_uuid", "Unique identifier")
+    # NOTE: I tried using Text:CSV but could not make it work.
+    # Parse using brute force regex
+    m%(\S+),\s*(\S+),\s*(\S+),\s*(\".*\"),\s*(\S+),\s*(\S+),\s*(\S+),\s*(\".*\"),\s*(\".*\")%;
+    ($type, $strct, $sorttype, $head, $field, $width, $func, $id, $desc) =
+	    ($1, $2, $3, $4, $5, $6, $7, $8, $9);
+
+    #
+    # Fixup the id / field name / attribute name
+    #
+
+    # Unquote 'id' (field name) and description
+    $id =~ tr/"//d;
+    $desc =~ tr/"//d;
+
+    # Skip redundant fields
+    if ($id =~ /^(stripesize|regionsize|chunksize)$/) {
+        next;
+    }
+
+    # Map report type to liblvm object name
+    # - PVS, VGS, LVS reports, the liblvm object is pv/vg/lv
+    # - PVSEG, the object is pvseg
+    # - SEG, the object is lvseg
+    # - LABEL, the object is pv
+    if ($type =~ /^PVS$/) {
+	$object = "pv";
+    } elsif ($type =~ /^VGS$/) {
+	$object = "vg";
+    } elsif ($type =~ /^LVS$/) {
+	$object = "lv";
+    } elsif ($type =~ /^LABEL$/) {
+	$object = "pv";
+    } elsif ($type =~ /^SEGS$/) {
+	$object = "lvseg";
+    } elsif ($type =~ /^PVSEGS$/) {
+	$object = "pvseg";
+    } else {
+	print "Skipping type: $type, line: $_\n"; #DEBUG
+	next;
+    }
+
+    # lv_kernel_major and lv_kernel_minor are 'STR' but we make them uint64_t here
+    # as this seems more appropriate and easier to manage.
+    if ($id =~ /^(lv_kernel_major|lv_kernel_minor)$/) {
+	$prop_type = "uint64_t ";
+    } elsif ($sorttype =~ m/STR/) {
+	$prop_type = "char *";
+    } else {
+	$prop_type = "uint64_t ";
+    }
+
+    # Some field names/ids contain the struct name, while others don't.
+    # For consistency, if the field name contains the struct name, remove
+    # it (we always put the object name in the function name.
+    #
+    if ($id =~ /^$strct/) {
+	$id = substr($id,length($strct)+1,length($id));
+    }
+
+    # Write 'get' prototype to header and code to C file.
+    write_include_body(INCLUDE_FILE, $object, $id, $desc, $prop_type);
+    write_code_body(CODE_FILE, $object, $id, $desc, $prop_type, $func, $field);
+}
+
+write_include_footer(INCLUDE_FILE);
+write_code_footer(CODE_FILE);
+close(INCLUDE_FILE);
+close(CODE_FILE);
+
+sub write_include_header
+{
+    my($file) = @_;
+    print $file <<END_INCLUDE_HEADER;
+/*
+ * Copyright (C) 2009 Red Hat, Inc. All rights reserved.
+ *
+ * This file is part of LVM2.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License v.2.1.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#ifndef _LVM_OBJECT_PROP_H
+#define _LVM_OBJECT_PROP_H
+
+END_INCLUDE_HEADER
+}
+
+sub write_include_body
+{
+    my($file, $object, $id, $desc, $prop_type) = @_;
+    #
+    # Use the description and field name in the comment
+    #
+    print $file "/**\n";
+    print $file " * "."lvm_"."$object"."_{get|set}_$id\n";
+    print $file " * $id - $desc\n";
+    print $file " */\n";
+    # Write out 'get' method prototype
+    $fun_name = "lvm_"."$object"."_get_$id";
+    $fun_args = "(const $object"."_t *$object)";
+    print $file "$prop_type"."$fun_name"."$fun_args".";\n";
+    # Write out 'set' method prototype
+    $fun_name = "lvm_"."$object"."_set_$id";
+    $fun_args = "($object"."_t *$object, const $prop_type"."value)";
+    print $file "int "."$fun_name"."$fun_args".";\n\n";
+}
+
+sub write_include_footer
+{
+    my($file) = @_;
+    print $file <<END_INCLUDE_FOOTER;
+#endif
+END_INCLUDE_FOOTER
+}
+
+sub write_code_header
+{
+    my($file) = @_;
+    print $file <<END_CODE_HEADER;
+/*
+ * Copyright (C) 2009 Red Hat, Inc. All rights reserved.
+ *
+ * This file is part of LVM2.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License v.2.1.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+#include "lvm.h"
+#include "lib.h"
+#include "metadata-exported.h"
+
+END_CODE_HEADER
+}
+
+sub write_code_body_get
+{
+    my($file, $object, $func, $field, $fun_name, $prop_type, $id) = @_;
+
+    if ($func =~ /^(int32|uint32|size32|size64)$/) {
+	$code = "\treturn $object->$field;";
+    } else {
+	$code = "\t/* FIXME: implement function body */\n\treturn 0;";
+    }
+    print $file <<END_CODE_GET;
+{
+$code
+}
+END_CODE_GET
+}
+
+sub write_code_body
+{
+    my($file, $object, $id, $desc, $prop_type, $func, $field) = @_;
+    print $file "/**\n";
+    print $file " * "."lvm_"."$object"."_{get|set}_$id\n";
+    print $file " * $id - $desc\n";
+    print $file " */\n";
+    # Write out 'get' method
+    $fun_name = "lvm_"."$object"."_get_$id";
+    $fun_args = "(const $object"."_t *$object)";
+    print $file "$prop_type"."$fun_name"."$fun_args"."\n";
+    write_code_body_get($file, $object, $func, $field, $fun_name, $prop_type, $id);
+
+    # Write out 'set' method; all sets require internal logic so no autogeneration
+    $fun_name = "lvm_"."$object"."_set_$id";
+    $fun_args = "($object"."_t *$object, const $prop_type"."value)";
+    print $file "int "."$fun_name"."$fun_args"."\n";
+    $code = "\t/* FIXME: implement function body */\n\treturn -1;";
+    print $file <<END_CODE_SET;
+{
+$code
+}
+END_CODE_SET
+}
+
+
+sub write_code_footer
+{
+# nothing to do
+}
-- 
1.6.0.6



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 03/30] Add generated files, lvm_object_prop.[ch], to lib/report directory and build
  2009-05-11 13:01   ` [PATCH 02/30] Add lvm_object_prop.pl to generate liblvm object property functions Dave Wysochanski
@ 2009-05-11 13:01     ` Dave Wysochanski
  2009-05-11 13:01       ` [PATCH 04/30] Update vg_size 'disp' function to call liblvm 'get' function Dave Wysochanski
  0 siblings, 1 reply; 32+ messages in thread
From: Dave Wysochanski @ 2009-05-11 13:01 UTC (permalink / raw)
  To: lvm-devel

These files were generated from using the current columns.h file as input
into lvm_object_prop.pl.  They are a starting point for liblvm object
property get/set functions.  The 'NUM' fields that are simple dereferences
are generated from the perl script.  Code implementing the functions for other
fields will be added later.

Include lvm_object_prop.h in lvm.h

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
---
 include/.symlinks            |    1 +
 lib/Makefile.in              |    1 +
 lib/report/lvm_object_prop.c |  950 ++++++++++++++++++++++++++++++++++++++++++
 lib/report/lvm_object_prop.h |  494 ++++++++++++++++++++++
 liblvm/lvm.h                 |    1 +
 5 files changed, 1447 insertions(+), 0 deletions(-)
 create mode 100644 lib/report/lvm_object_prop.c
 create mode 100644 lib/report/lvm_object_prop.h

diff --git a/include/.symlinks b/include/.symlinks
index 28da67f..4f79ec0 100644
--- a/include/.symlinks
+++ b/include/.symlinks
@@ -51,6 +51,7 @@
 ../lib/misc/lvm-wrappers.h
 ../lib/misc/sharedlib.h
 ../lib/report/report.h
+../lib/report/lvm_object_prop.h
 ../lib/uuid/uuid.h
 ../libdm/libdevmapper.h
 ../libdm/misc/dm-ioctl.h
diff --git a/lib/Makefile.in b/lib/Makefile.in
index e65d0c2..2ddb4ec 100644
--- a/lib/Makefile.in
+++ b/lib/Makefile.in
@@ -85,6 +85,7 @@ SOURCES =\
 	misc/util.c \
 	mm/memlock.c \
 	report/report.c \
+	report/lvm_object_prop.c \
 	striped/striped.c \
 	uuid/uuid.c \
 	zero/zero.c
diff --git a/lib/report/lvm_object_prop.c b/lib/report/lvm_object_prop.c
new file mode 100644
index 0000000..e353772
--- /dev/null
+++ b/lib/report/lvm_object_prop.c
@@ -0,0 +1,950 @@
+/*
+ * Copyright (C) 2009 Red Hat, Inc. All rights reserved.
+ *
+ * This file is part of LVM2.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License v.2.1.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+#include "lvm.h"
+#include "lib.h"
+#include "metadata-exported.h"
+
+/**
+ * lvm_lv_{get|set}_uuid
+ * uuid - Unique identifier.
+ */
+char *lvm_lv_get_uuid(const lv_t *lv)
+{
+	/* FIXME: implement function body */
+	return 0;
+}
+int lvm_lv_set_uuid(lv_t *lv, const char *value)
+{
+	/* FIXME: implement function body */
+	return -1;
+}
+/**
+ * lvm_lv_{get|set}_name
+ * name - Name.  LVs created for internal use are enclosed in brackets.
+ */
+char *lvm_lv_get_name(const lv_t *lv)
+{
+	/* FIXME: implement function body */
+	return 0;
+}
+int lvm_lv_set_name(lv_t *lv, const char *value)
+{
+	/* FIXME: implement function body */
+	return -1;
+}
+/**
+ * lvm_lv_{get|set}_attr
+ * attr - Various attributes - see man page.
+ */
+char *lvm_lv_get_attr(const lv_t *lv)
+{
+	/* FIXME: implement function body */
+	return 0;
+}
+int lvm_lv_set_attr(lv_t *lv, const char *value)
+{
+	/* FIXME: implement function body */
+	return -1;
+}
+/**
+ * lvm_lv_{get|set}_major
+ * major - Persistent major number or -1 if not persistent.
+ */
+uint64_t lvm_lv_get_major(const lv_t *lv)
+{
+	return lv->major;
+}
+int lvm_lv_set_major(lv_t *lv, const uint64_t value)
+{
+	/* FIXME: implement function body */
+	return -1;
+}
+/**
+ * lvm_lv_{get|set}_minor
+ * minor - Persistent minor number or -1 if not persistent.
+ */
+uint64_t lvm_lv_get_minor(const lv_t *lv)
+{
+	return lv->minor;
+}
+int lvm_lv_set_minor(lv_t *lv, const uint64_t value)
+{
+	/* FIXME: implement function body */
+	return -1;
+}
+/**
+ * lvm_lv_{get|set}_read_ahead
+ * read_ahead - Read ahead setting in current units.
+ */
+uint64_t lvm_lv_get_read_ahead(const lv_t *lv)
+{
+	/* FIXME: implement function body */
+	return 0;
+}
+int lvm_lv_set_read_ahead(lv_t *lv, const uint64_t value)
+{
+	/* FIXME: implement function body */
+	return -1;
+}
+/**
+ * lvm_lv_{get|set}_kernel_major
+ * kernel_major - Currently assigned major number or -1 if LV is not active.
+ */
+uint64_t lvm_lv_get_kernel_major(const lv_t *lv)
+{
+	/* FIXME: implement function body */
+	return 0;
+}
+int lvm_lv_set_kernel_major(lv_t *lv, const uint64_t value)
+{
+	/* FIXME: implement function body */
+	return -1;
+}
+/**
+ * lvm_lv_{get|set}_kernel_minor
+ * kernel_minor - Currently assigned minor number or -1 if LV is not active.
+ */
+uint64_t lvm_lv_get_kernel_minor(const lv_t *lv)
+{
+	/* FIXME: implement function body */
+	return 0;
+}
+int lvm_lv_set_kernel_minor(lv_t *lv, const uint64_t value)
+{
+	/* FIXME: implement function body */
+	return -1;
+}
+/**
+ * lvm_lv_{get|set}_kernel_read_ahead
+ * kernel_read_ahead - Currently-in-use read ahead setting in current units.
+ */
+uint64_t lvm_lv_get_kernel_read_ahead(const lv_t *lv)
+{
+	/* FIXME: implement function body */
+	return 0;
+}
+int lvm_lv_set_kernel_read_ahead(lv_t *lv, const uint64_t value)
+{
+	/* FIXME: implement function body */
+	return -1;
+}
+/**
+ * lvm_lv_{get|set}_size
+ * size - Size of LV in current units.
+ */
+uint64_t lvm_lv_get_size(const lv_t *lv)
+{
+	return lv->size;
+}
+int lvm_lv_set_size(lv_t *lv, const uint64_t value)
+{
+	/* FIXME: implement function body */
+	return -1;
+}
+/**
+ * lvm_lv_{get|set}_seg_count
+ * seg_count - Number of segments in LV.
+ */
+uint64_t lvm_lv_get_seg_count(const lv_t *lv)
+{
+	/* FIXME: implement function body */
+	return 0;
+}
+int lvm_lv_set_seg_count(lv_t *lv, const uint64_t value)
+{
+	/* FIXME: implement function body */
+	return -1;
+}
+/**
+ * lvm_lv_{get|set}_origin
+ * origin - For snapshots, the origin device of this LV.
+ */
+char *lvm_lv_get_origin(const lv_t *lv)
+{
+	/* FIXME: implement function body */
+	return 0;
+}
+int lvm_lv_set_origin(lv_t *lv, const char *value)
+{
+	/* FIXME: implement function body */
+	return -1;
+}
+/**
+ * lvm_lv_{get|set}_origin_size
+ * origin_size - For snapshots, the size of the origin device of this LV.
+ */
+uint64_t lvm_lv_get_origin_size(const lv_t *lv)
+{
+	/* FIXME: implement function body */
+	return 0;
+}
+int lvm_lv_set_origin_size(lv_t *lv, const uint64_t value)
+{
+	/* FIXME: implement function body */
+	return -1;
+}
+/**
+ * lvm_lv_{get|set}_snap_percent
+ * snap_percent - For snapshots, the percentage full if LV is active.
+ */
+uint64_t lvm_lv_get_snap_percent(const lv_t *lv)
+{
+	/* FIXME: implement function body */
+	return 0;
+}
+int lvm_lv_set_snap_percent(lv_t *lv, const uint64_t value)
+{
+	/* FIXME: implement function body */
+	return -1;
+}
+/**
+ * lvm_lv_{get|set}_copy_percent
+ * copy_percent - For mirrors and pvmove, current percentage in-sync.
+ */
+uint64_t lvm_lv_get_copy_percent(const lv_t *lv)
+{
+	/* FIXME: implement function body */
+	return 0;
+}
+int lvm_lv_set_copy_percent(lv_t *lv, const uint64_t value)
+{
+	/* FIXME: implement function body */
+	return -1;
+}
+/**
+ * lvm_lv_{get|set}_move_pv
+ * move_pv - For pvmove, Source PV of temporary LV created by pvmove.
+ */
+char *lvm_lv_get_move_pv(const lv_t *lv)
+{
+	/* FIXME: implement function body */
+	return 0;
+}
+int lvm_lv_set_move_pv(lv_t *lv, const char *value)
+{
+	/* FIXME: implement function body */
+	return -1;
+}
+/**
+ * lvm_lv_{get|set}_convert_lv
+ * convert_lv - For lvconvert, Name of temporary LV created by lvconvert.
+ */
+char *lvm_lv_get_convert_lv(const lv_t *lv)
+{
+	/* FIXME: implement function body */
+	return 0;
+}
+int lvm_lv_set_convert_lv(lv_t *lv, const char *value)
+{
+	/* FIXME: implement function body */
+	return -1;
+}
+/**
+ * lvm_lv_{get|set}_tags
+ * tags - Tags, if any.
+ */
+char *lvm_lv_get_tags(const lv_t *lv)
+{
+	/* FIXME: implement function body */
+	return 0;
+}
+int lvm_lv_set_tags(lv_t *lv, const char *value)
+{
+	/* FIXME: implement function body */
+	return -1;
+}
+/**
+ * lvm_lv_{get|set}_mirror_log
+ * mirror_log - For mirrors, the LV holding the synchronisation log.
+ */
+char *lvm_lv_get_mirror_log(const lv_t *lv)
+{
+	/* FIXME: implement function body */
+	return 0;
+}
+int lvm_lv_set_mirror_log(lv_t *lv, const char *value)
+{
+	/* FIXME: implement function body */
+	return -1;
+}
+/**
+ * lvm_lv_{get|set}_modules
+ * modules - Kernel device-mapper modules required for this LV.
+ */
+char *lvm_lv_get_modules(const lv_t *lv)
+{
+	/* FIXME: implement function body */
+	return 0;
+}
+int lvm_lv_set_modules(lv_t *lv, const char *value)
+{
+	/* FIXME: implement function body */
+	return -1;
+}
+/**
+ * lvm_pv_{get|set}_fmt
+ * fmt - Type of metadata.
+ */
+char *lvm_pv_get_fmt(const pv_t *pv)
+{
+	/* FIXME: implement function body */
+	return 0;
+}
+int lvm_pv_set_fmt(pv_t *pv, const char *value)
+{
+	/* FIXME: implement function body */
+	return -1;
+}
+/**
+ * lvm_pv_{get|set}_uuid
+ * uuid - Unique identifier.
+ */
+char *lvm_pv_get_uuid(const pv_t *pv)
+{
+	/* FIXME: implement function body */
+	return 0;
+}
+int lvm_pv_set_uuid(pv_t *pv, const char *value)
+{
+	/* FIXME: implement function body */
+	return -1;
+}
+/**
+ * lvm_pv_{get|set}_dev_size
+ * dev_size - Size of underlying device in current units.
+ */
+uint64_t lvm_pv_get_dev_size(const pv_t *pv)
+{
+	/* FIXME: implement function body */
+	return 0;
+}
+int lvm_pv_set_dev_size(pv_t *pv, const uint64_t value)
+{
+	/* FIXME: implement function body */
+	return -1;
+}
+/**
+ * lvm_pv_{get|set}_name
+ * name - Name.
+ */
+char *lvm_pv_get_name(const pv_t *pv)
+{
+	/* FIXME: implement function body */
+	return 0;
+}
+int lvm_pv_set_name(pv_t *pv, const char *value)
+{
+	/* FIXME: implement function body */
+	return -1;
+}
+/**
+ * lvm_pv_{get|set}_mda_free
+ * mda_free - Free metadata area space on this device in current units.
+ */
+uint64_t lvm_pv_get_mda_free(const pv_t *pv)
+{
+	/* FIXME: implement function body */
+	return 0;
+}
+int lvm_pv_set_mda_free(pv_t *pv, const uint64_t value)
+{
+	/* FIXME: implement function body */
+	return -1;
+}
+/**
+ * lvm_pv_{get|set}_mda_size
+ * mda_size - Size of smallest metadata area on this device in current units.
+ */
+uint64_t lvm_pv_get_mda_size(const pv_t *pv)
+{
+	/* FIXME: implement function body */
+	return 0;
+}
+int lvm_pv_set_mda_size(pv_t *pv, const uint64_t value)
+{
+	/* FIXME: implement function body */
+	return -1;
+}
+/**
+ * lvm_pv_{get|set}_pe_start
+ * pe_start - Offset to the start of data on the underlying device.
+ */
+uint64_t lvm_pv_get_pe_start(const pv_t *pv)
+{
+	return pv->pe_start;
+}
+int lvm_pv_set_pe_start(pv_t *pv, const uint64_t value)
+{
+	/* FIXME: implement function body */
+	return -1;
+}
+/**
+ * lvm_pv_{get|set}_size
+ * size - Size of PV in current units.
+ */
+uint64_t lvm_pv_get_size(const pv_t *pv)
+{
+	/* FIXME: implement function body */
+	return 0;
+}
+int lvm_pv_set_size(pv_t *pv, const uint64_t value)
+{
+	/* FIXME: implement function body */
+	return -1;
+}
+/**
+ * lvm_pv_{get|set}_free
+ * free - Total amount of unallocated space in current units.
+ */
+uint64_t lvm_pv_get_free(const pv_t *pv)
+{
+	/* FIXME: implement function body */
+	return 0;
+}
+int lvm_pv_set_free(pv_t *pv, const uint64_t value)
+{
+	/* FIXME: implement function body */
+	return -1;
+}
+/**
+ * lvm_pv_{get|set}_used
+ * used - Total amount of allocated space in current units.
+ */
+uint64_t lvm_pv_get_used(const pv_t *pv)
+{
+	/* FIXME: implement function body */
+	return 0;
+}
+int lvm_pv_set_used(pv_t *pv, const uint64_t value)
+{
+	/* FIXME: implement function body */
+	return -1;
+}
+/**
+ * lvm_pv_{get|set}_attr
+ * attr - Various attributes - see man page.
+ */
+char *lvm_pv_get_attr(const pv_t *pv)
+{
+	/* FIXME: implement function body */
+	return 0;
+}
+int lvm_pv_set_attr(pv_t *pv, const char *value)
+{
+	/* FIXME: implement function body */
+	return -1;
+}
+/**
+ * lvm_pv_{get|set}_pe_count
+ * pe_count - Total number of Physical Extents.
+ */
+uint64_t lvm_pv_get_pe_count(const pv_t *pv)
+{
+	return pv->pe_count;
+}
+int lvm_pv_set_pe_count(pv_t *pv, const uint64_t value)
+{
+	/* FIXME: implement function body */
+	return -1;
+}
+/**
+ * lvm_pv_{get|set}_pe_alloc_count
+ * pe_alloc_count - Total number of allocated Physical Extents.
+ */
+uint64_t lvm_pv_get_pe_alloc_count(const pv_t *pv)
+{
+	return pv->pe_alloc_count;
+}
+int lvm_pv_set_pe_alloc_count(pv_t *pv, const uint64_t value)
+{
+	/* FIXME: implement function body */
+	return -1;
+}
+/**
+ * lvm_pv_{get|set}_tags
+ * tags - Tags, if any.
+ */
+char *lvm_pv_get_tags(const pv_t *pv)
+{
+	/* FIXME: implement function body */
+	return 0;
+}
+int lvm_pv_set_tags(pv_t *pv, const char *value)
+{
+	/* FIXME: implement function body */
+	return -1;
+}
+/**
+ * lvm_pv_{get|set}_mda_count
+ * mda_count - Number of metadata areas on this device.
+ */
+uint64_t lvm_pv_get_mda_count(const pv_t *pv)
+{
+	/* FIXME: implement function body */
+	return 0;
+}
+int lvm_pv_set_mda_count(pv_t *pv, const uint64_t value)
+{
+	/* FIXME: implement function body */
+	return -1;
+}
+/**
+ * lvm_vg_{get|set}_fmt
+ * fmt - Type of metadata.
+ */
+char *lvm_vg_get_fmt(const vg_t *vg)
+{
+	/* FIXME: implement function body */
+	return 0;
+}
+int lvm_vg_set_fmt(vg_t *vg, const char *value)
+{
+	/* FIXME: implement function body */
+	return -1;
+}
+/**
+ * lvm_vg_{get|set}_uuid
+ * uuid - Unique identifier.
+ */
+char *lvm_vg_get_uuid(const vg_t *vg)
+{
+	/* FIXME: implement function body */
+	return 0;
+}
+int lvm_vg_set_uuid(vg_t *vg, const char *value)
+{
+	/* FIXME: implement function body */
+	return -1;
+}
+/**
+ * lvm_vg_{get|set}_name
+ * name - Name.
+ */
+char *lvm_vg_get_name(const vg_t *vg)
+{
+	/* FIXME: implement function body */
+	return 0;
+}
+int lvm_vg_set_name(vg_t *vg, const char *value)
+{
+	/* FIXME: implement function body */
+	return -1;
+}
+/**
+ * lvm_vg_{get|set}_attr
+ * attr - Various attributes - see man page.
+ */
+char *lvm_vg_get_attr(const vg_t *vg)
+{
+	/* FIXME: implement function body */
+	return 0;
+}
+int lvm_vg_set_attr(vg_t *vg, const char *value)
+{
+	/* FIXME: implement function body */
+	return -1;
+}
+/**
+ * lvm_vg_{get|set}_size
+ * size - Total size of VG in current units.
+ */
+uint64_t lvm_vg_get_size(const vg_t *vg)
+{
+	/* FIXME: implement function body */
+	return 0;
+}
+int lvm_vg_set_size(vg_t *vg, const uint64_t value)
+{
+	/* FIXME: implement function body */
+	return -1;
+}
+/**
+ * lvm_vg_{get|set}_free
+ * free - Total amount of free space in current units.
+ */
+uint64_t lvm_vg_get_free(const vg_t *vg)
+{
+	/* FIXME: implement function body */
+	return 0;
+}
+int lvm_vg_set_free(vg_t *vg, const uint64_t value)
+{
+	/* FIXME: implement function body */
+	return -1;
+}
+/**
+ * lvm_vg_{get|set}_sysid
+ * sysid - System ID indicating when and where it was created.
+ */
+char *lvm_vg_get_sysid(const vg_t *vg)
+{
+	/* FIXME: implement function body */
+	return 0;
+}
+int lvm_vg_set_sysid(vg_t *vg, const char *value)
+{
+	/* FIXME: implement function body */
+	return -1;
+}
+/**
+ * lvm_vg_{get|set}_extent_size
+ * extent_size - Size of Physical Extents in current units.
+ */
+uint64_t lvm_vg_get_extent_size(const vg_t *vg)
+{
+	return vg->extent_size;
+}
+int lvm_vg_set_extent_size(vg_t *vg, const uint64_t value)
+{
+	/* FIXME: implement function body */
+	return -1;
+}
+/**
+ * lvm_vg_{get|set}_extent_count
+ * extent_count - Total number of Physical Extents.
+ */
+uint64_t lvm_vg_get_extent_count(const vg_t *vg)
+{
+	return vg->extent_count;
+}
+int lvm_vg_set_extent_count(vg_t *vg, const uint64_t value)
+{
+	/* FIXME: implement function body */
+	return -1;
+}
+/**
+ * lvm_vg_{get|set}_free_count
+ * free_count - Total number of unallocated Physical Extents.
+ */
+uint64_t lvm_vg_get_free_count(const vg_t *vg)
+{
+	return vg->free_count;
+}
+int lvm_vg_set_free_count(vg_t *vg, const uint64_t value)
+{
+	/* FIXME: implement function body */
+	return -1;
+}
+/**
+ * lvm_vg_{get|set}_max_lv
+ * max_lv - Maximum number of LVs allowed in VG or 0 if unlimited.
+ */
+uint64_t lvm_vg_get_max_lv(const vg_t *vg)
+{
+	return vg->max_lv;
+}
+int lvm_vg_set_max_lv(vg_t *vg, const uint64_t value)
+{
+	/* FIXME: implement function body */
+	return -1;
+}
+/**
+ * lvm_vg_{get|set}_max_pv
+ * max_pv - Maximum number of PVs allowed in VG or 0 if unlimited.
+ */
+uint64_t lvm_vg_get_max_pv(const vg_t *vg)
+{
+	return vg->max_pv;
+}
+int lvm_vg_set_max_pv(vg_t *vg, const uint64_t value)
+{
+	/* FIXME: implement function body */
+	return -1;
+}
+/**
+ * lvm_vg_{get|set}_pv_count
+ * pv_count - Number of PVs.
+ */
+uint64_t lvm_vg_get_pv_count(const vg_t *vg)
+{
+	return vg->pv_count;
+}
+int lvm_vg_set_pv_count(vg_t *vg, const uint64_t value)
+{
+	/* FIXME: implement function body */
+	return -1;
+}
+/**
+ * lvm_vg_{get|set}_lv_count
+ * lv_count - Number of LVs.
+ */
+uint64_t lvm_vg_get_lv_count(const vg_t *vg)
+{
+	/* FIXME: implement function body */
+	return 0;
+}
+int lvm_vg_set_lv_count(vg_t *vg, const uint64_t value)
+{
+	/* FIXME: implement function body */
+	return -1;
+}
+/**
+ * lvm_vg_{get|set}_snap_count
+ * snap_count - Number of snapshots.
+ */
+uint64_t lvm_vg_get_snap_count(const vg_t *vg)
+{
+	return vg->snapshot_count;
+}
+int lvm_vg_set_snap_count(vg_t *vg, const uint64_t value)
+{
+	/* FIXME: implement function body */
+	return -1;
+}
+/**
+ * lvm_vg_{get|set}_seqno
+ * seqno - Revision number of internal metadata.  Incremented whenever it changes.
+ */
+uint64_t lvm_vg_get_seqno(const vg_t *vg)
+{
+	return vg->seqno;
+}
+int lvm_vg_set_seqno(vg_t *vg, const uint64_t value)
+{
+	/* FIXME: implement function body */
+	return -1;
+}
+/**
+ * lvm_vg_{get|set}_tags
+ * tags - Tags, if any.
+ */
+char *lvm_vg_get_tags(const vg_t *vg)
+{
+	/* FIXME: implement function body */
+	return 0;
+}
+int lvm_vg_set_tags(vg_t *vg, const char *value)
+{
+	/* FIXME: implement function body */
+	return -1;
+}
+/**
+ * lvm_vg_{get|set}_mda_count
+ * mda_count - Number of metadata areas in use by this VG.
+ */
+uint64_t lvm_vg_get_mda_count(const vg_t *vg)
+{
+	/* FIXME: implement function body */
+	return 0;
+}
+int lvm_vg_set_mda_count(vg_t *vg, const uint64_t value)
+{
+	/* FIXME: implement function body */
+	return -1;
+}
+/**
+ * lvm_vg_{get|set}_mda_free
+ * mda_free - Free metadata area space for this VG in current units.
+ */
+uint64_t lvm_vg_get_mda_free(const vg_t *vg)
+{
+	/* FIXME: implement function body */
+	return 0;
+}
+int lvm_vg_set_mda_free(vg_t *vg, const uint64_t value)
+{
+	/* FIXME: implement function body */
+	return -1;
+}
+/**
+ * lvm_vg_{get|set}_mda_size
+ * mda_size - Size of smallest metadata area for this VG in current units.
+ */
+uint64_t lvm_vg_get_mda_size(const vg_t *vg)
+{
+	/* FIXME: implement function body */
+	return 0;
+}
+int lvm_vg_set_mda_size(vg_t *vg, const uint64_t value)
+{
+	/* FIXME: implement function body */
+	return -1;
+}
+/**
+ * lvm_lvseg_{get|set}_ype
+ * ype - Type of LV segment.
+ */
+char *lvm_lvseg_get_ype(const lvseg_t *lvseg)
+{
+	/* FIXME: implement function body */
+	return 0;
+}
+int lvm_lvseg_set_ype(lvseg_t *lvseg, const char *value)
+{
+	/* FIXME: implement function body */
+	return -1;
+}
+/**
+ * lvm_lvseg_{get|set}_stripes
+ * stripes - Number of stripes or mirror legs.
+ */
+uint64_t lvm_lvseg_get_stripes(const lvseg_t *lvseg)
+{
+	return lvseg->area_count;
+}
+int lvm_lvseg_set_stripes(lvseg_t *lvseg, const uint64_t value)
+{
+	/* FIXME: implement function body */
+	return -1;
+}
+/**
+ * lvm_lvseg_{get|set}_stripe_size
+ * stripe_size - For stripes, amount of data placed on one device before switching to the next.
+ */
+uint64_t lvm_lvseg_get_stripe_size(const lvseg_t *lvseg)
+{
+	return lvseg->stripe_size;
+}
+int lvm_lvseg_set_stripe_size(lvseg_t *lvseg, const uint64_t value)
+{
+	/* FIXME: implement function body */
+	return -1;
+}
+/**
+ * lvm_lvseg_{get|set}_region_size
+ * region_size - For mirrors, the unit of data copied when synchronising devices.
+ */
+uint64_t lvm_lvseg_get_region_size(const lvseg_t *lvseg)
+{
+	return lvseg->region_size;
+}
+int lvm_lvseg_set_region_size(lvseg_t *lvseg, const uint64_t value)
+{
+	/* FIXME: implement function body */
+	return -1;
+}
+/**
+ * lvm_lvseg_{get|set}_chunk_size
+ * chunk_size - For snapshots, the unit of data used when tracking changes.
+ */
+uint64_t lvm_lvseg_get_chunk_size(const lvseg_t *lvseg)
+{
+	/* FIXME: implement function body */
+	return 0;
+}
+int lvm_lvseg_set_chunk_size(lvseg_t *lvseg, const uint64_t value)
+{
+	/* FIXME: implement function body */
+	return -1;
+}
+/**
+ * lvm_lvseg_{get|set}_start
+ * start - Offset within the LV to the start of the segment in current units.
+ */
+uint64_t lvm_lvseg_get_start(const lvseg_t *lvseg)
+{
+	/* FIXME: implement function body */
+	return 0;
+}
+int lvm_lvseg_set_start(lvseg_t *lvseg, const uint64_t value)
+{
+	/* FIXME: implement function body */
+	return -1;
+}
+/**
+ * lvm_lvseg_{get|set}_start_pe
+ * start_pe - Offset within the LV to the start of the segment in physical extents.
+ */
+uint64_t lvm_lvseg_get_start_pe(const lvseg_t *lvseg)
+{
+	/* FIXME: implement function body */
+	return 0;
+}
+int lvm_lvseg_set_start_pe(lvseg_t *lvseg, const uint64_t value)
+{
+	/* FIXME: implement function body */
+	return -1;
+}
+/**
+ * lvm_lvseg_{get|set}_size
+ * size - Size of segment in current units.
+ */
+uint64_t lvm_lvseg_get_size(const lvseg_t *lvseg)
+{
+	/* FIXME: implement function body */
+	return 0;
+}
+int lvm_lvseg_set_size(lvseg_t *lvseg, const uint64_t value)
+{
+	/* FIXME: implement function body */
+	return -1;
+}
+/**
+ * lvm_lvseg_{get|set}_tags
+ * tags - Tags, if any.
+ */
+char *lvm_lvseg_get_tags(const lvseg_t *lvseg)
+{
+	/* FIXME: implement function body */
+	return 0;
+}
+int lvm_lvseg_set_tags(lvseg_t *lvseg, const char *value)
+{
+	/* FIXME: implement function body */
+	return -1;
+}
+/**
+ * lvm_lvseg_{get|set}_pe_ranges
+ * pe_ranges - Ranges of Physical Extents of underlying devices in command line format.
+ */
+char *lvm_lvseg_get_pe_ranges(const lvseg_t *lvseg)
+{
+	/* FIXME: implement function body */
+	return 0;
+}
+int lvm_lvseg_set_pe_ranges(lvseg_t *lvseg, const char *value)
+{
+	/* FIXME: implement function body */
+	return -1;
+}
+/**
+ * lvm_lvseg_{get|set}_devices
+ * devices - Underlying devices used with starting extent numbers.
+ */
+char *lvm_lvseg_get_devices(const lvseg_t *lvseg)
+{
+	/* FIXME: implement function body */
+	return 0;
+}
+int lvm_lvseg_set_devices(lvseg_t *lvseg, const char *value)
+{
+	/* FIXME: implement function body */
+	return -1;
+}
+/**
+ * lvm_pvseg_{get|set}_start
+ * start - Physical Extent number of start of segment.
+ */
+uint64_t lvm_pvseg_get_start(const pvseg_t *pvseg)
+{
+	return pvseg->pe;
+}
+int lvm_pvseg_set_start(pvseg_t *pvseg, const uint64_t value)
+{
+	/* FIXME: implement function body */
+	return -1;
+}
+/**
+ * lvm_pvseg_{get|set}_size
+ * size - Number of extents in segment.
+ */
+uint64_t lvm_pvseg_get_size(const pvseg_t *pvseg)
+{
+	return pvseg->len;
+}
+int lvm_pvseg_set_size(pvseg_t *pvseg, const uint64_t value)
+{
+	/* FIXME: implement function body */
+	return -1;
+}
diff --git a/lib/report/lvm_object_prop.h b/lib/report/lvm_object_prop.h
new file mode 100644
index 0000000..c674d64
--- /dev/null
+++ b/lib/report/lvm_object_prop.h
@@ -0,0 +1,494 @@
+/*
+ * Copyright (C) 2009 Red Hat, Inc. All rights reserved.
+ *
+ * This file is part of LVM2.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License v.2.1.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#ifndef _LVM_OBJECT_PROP_H
+#define _LVM_OBJECT_PROP_H
+
+/**
+ * lvm_lv_{get|set}_uuid
+ * uuid - Unique identifier.
+ */
+char *lvm_lv_get_uuid(const lv_t *lv);
+int lvm_lv_set_uuid(lv_t *lv, const char *value);
+
+/**
+ * lvm_lv_{get|set}_name
+ * name - Name.  LVs created for internal use are enclosed in brackets.
+ */
+char *lvm_lv_get_name(const lv_t *lv);
+int lvm_lv_set_name(lv_t *lv, const char *value);
+
+/**
+ * lvm_lv_{get|set}_attr
+ * attr - Various attributes - see man page.
+ */
+char *lvm_lv_get_attr(const lv_t *lv);
+int lvm_lv_set_attr(lv_t *lv, const char *value);
+
+/**
+ * lvm_lv_{get|set}_major
+ * major - Persistent major number or -1 if not persistent.
+ */
+uint64_t lvm_lv_get_major(const lv_t *lv);
+int lvm_lv_set_major(lv_t *lv, const uint64_t value);
+
+/**
+ * lvm_lv_{get|set}_minor
+ * minor - Persistent minor number or -1 if not persistent.
+ */
+uint64_t lvm_lv_get_minor(const lv_t *lv);
+int lvm_lv_set_minor(lv_t *lv, const uint64_t value);
+
+/**
+ * lvm_lv_{get|set}_read_ahead
+ * read_ahead - Read ahead setting in current units.
+ */
+uint64_t lvm_lv_get_read_ahead(const lv_t *lv);
+int lvm_lv_set_read_ahead(lv_t *lv, const uint64_t value);
+
+/**
+ * lvm_lv_{get|set}_kernel_major
+ * kernel_major - Currently assigned major number or -1 if LV is not active.
+ */
+uint64_t lvm_lv_get_kernel_major(const lv_t *lv);
+int lvm_lv_set_kernel_major(lv_t *lv, const uint64_t value);
+
+/**
+ * lvm_lv_{get|set}_kernel_minor
+ * kernel_minor - Currently assigned minor number or -1 if LV is not active.
+ */
+uint64_t lvm_lv_get_kernel_minor(const lv_t *lv);
+int lvm_lv_set_kernel_minor(lv_t *lv, const uint64_t value);
+
+/**
+ * lvm_lv_{get|set}_kernel_read_ahead
+ * kernel_read_ahead - Currently-in-use read ahead setting in current units.
+ */
+uint64_t lvm_lv_get_kernel_read_ahead(const lv_t *lv);
+int lvm_lv_set_kernel_read_ahead(lv_t *lv, const uint64_t value);
+
+/**
+ * lvm_lv_{get|set}_size
+ * size - Size of LV in current units.
+ */
+uint64_t lvm_lv_get_size(const lv_t *lv);
+int lvm_lv_set_size(lv_t *lv, const uint64_t value);
+
+/**
+ * lvm_lv_{get|set}_seg_count
+ * seg_count - Number of segments in LV.
+ */
+uint64_t lvm_lv_get_seg_count(const lv_t *lv);
+int lvm_lv_set_seg_count(lv_t *lv, const uint64_t value);
+
+/**
+ * lvm_lv_{get|set}_origin
+ * origin - For snapshots, the origin device of this LV.
+ */
+char *lvm_lv_get_origin(const lv_t *lv);
+int lvm_lv_set_origin(lv_t *lv, const char *value);
+
+/**
+ * lvm_lv_{get|set}_origin_size
+ * origin_size - For snapshots, the size of the origin device of this LV.
+ */
+uint64_t lvm_lv_get_origin_size(const lv_t *lv);
+int lvm_lv_set_origin_size(lv_t *lv, const uint64_t value);
+
+/**
+ * lvm_lv_{get|set}_snap_percent
+ * snap_percent - For snapshots, the percentage full if LV is active.
+ */
+uint64_t lvm_lv_get_snap_percent(const lv_t *lv);
+int lvm_lv_set_snap_percent(lv_t *lv, const uint64_t value);
+
+/**
+ * lvm_lv_{get|set}_copy_percent
+ * copy_percent - For mirrors and pvmove, current percentage in-sync.
+ */
+uint64_t lvm_lv_get_copy_percent(const lv_t *lv);
+int lvm_lv_set_copy_percent(lv_t *lv, const uint64_t value);
+
+/**
+ * lvm_lv_{get|set}_move_pv
+ * move_pv - For pvmove, Source PV of temporary LV created by pvmove.
+ */
+char *lvm_lv_get_move_pv(const lv_t *lv);
+int lvm_lv_set_move_pv(lv_t *lv, const char *value);
+
+/**
+ * lvm_lv_{get|set}_convert_lv
+ * convert_lv - For lvconvert, Name of temporary LV created by lvconvert.
+ */
+char *lvm_lv_get_convert_lv(const lv_t *lv);
+int lvm_lv_set_convert_lv(lv_t *lv, const char *value);
+
+/**
+ * lvm_lv_{get|set}_tags
+ * tags - Tags, if any.
+ */
+char *lvm_lv_get_tags(const lv_t *lv);
+int lvm_lv_set_tags(lv_t *lv, const char *value);
+
+/**
+ * lvm_lv_{get|set}_mirror_log
+ * mirror_log - For mirrors, the LV holding the synchronisation log.
+ */
+char *lvm_lv_get_mirror_log(const lv_t *lv);
+int lvm_lv_set_mirror_log(lv_t *lv, const char *value);
+
+/**
+ * lvm_lv_{get|set}_modules
+ * modules - Kernel device-mapper modules required for this LV.
+ */
+char *lvm_lv_get_modules(const lv_t *lv);
+int lvm_lv_set_modules(lv_t *lv, const char *value);
+
+/**
+ * lvm_pv_{get|set}_fmt
+ * fmt - Type of metadata.
+ */
+char *lvm_pv_get_fmt(const pv_t *pv);
+int lvm_pv_set_fmt(pv_t *pv, const char *value);
+
+/**
+ * lvm_pv_{get|set}_uuid
+ * uuid - Unique identifier.
+ */
+char *lvm_pv_get_uuid(const pv_t *pv);
+int lvm_pv_set_uuid(pv_t *pv, const char *value);
+
+/**
+ * lvm_pv_{get|set}_dev_size
+ * dev_size - Size of underlying device in current units.
+ */
+uint64_t lvm_pv_get_dev_size(const pv_t *pv);
+int lvm_pv_set_dev_size(pv_t *pv, const uint64_t value);
+
+/**
+ * lvm_pv_{get|set}_name
+ * name - Name.
+ */
+char *lvm_pv_get_name(const pv_t *pv);
+int lvm_pv_set_name(pv_t *pv, const char *value);
+
+/**
+ * lvm_pv_{get|set}_mda_free
+ * mda_free - Free metadata area space on this device in current units.
+ */
+uint64_t lvm_pv_get_mda_free(const pv_t *pv);
+int lvm_pv_set_mda_free(pv_t *pv, const uint64_t value);
+
+/**
+ * lvm_pv_{get|set}_mda_size
+ * mda_size - Size of smallest metadata area on this device in current units.
+ */
+uint64_t lvm_pv_get_mda_size(const pv_t *pv);
+int lvm_pv_set_mda_size(pv_t *pv, const uint64_t value);
+
+/**
+ * lvm_pv_{get|set}_pe_start
+ * pe_start - Offset to the start of data on the underlying device.
+ */
+uint64_t lvm_pv_get_pe_start(const pv_t *pv);
+int lvm_pv_set_pe_start(pv_t *pv, const uint64_t value);
+
+/**
+ * lvm_pv_{get|set}_size
+ * size - Size of PV in current units.
+ */
+uint64_t lvm_pv_get_size(const pv_t *pv);
+int lvm_pv_set_size(pv_t *pv, const uint64_t value);
+
+/**
+ * lvm_pv_{get|set}_free
+ * free - Total amount of unallocated space in current units.
+ */
+uint64_t lvm_pv_get_free(const pv_t *pv);
+int lvm_pv_set_free(pv_t *pv, const uint64_t value);
+
+/**
+ * lvm_pv_{get|set}_used
+ * used - Total amount of allocated space in current units.
+ */
+uint64_t lvm_pv_get_used(const pv_t *pv);
+int lvm_pv_set_used(pv_t *pv, const uint64_t value);
+
+/**
+ * lvm_pv_{get|set}_attr
+ * attr - Various attributes - see man page.
+ */
+char *lvm_pv_get_attr(const pv_t *pv);
+int lvm_pv_set_attr(pv_t *pv, const char *value);
+
+/**
+ * lvm_pv_{get|set}_pe_count
+ * pe_count - Total number of Physical Extents.
+ */
+uint64_t lvm_pv_get_pe_count(const pv_t *pv);
+int lvm_pv_set_pe_count(pv_t *pv, const uint64_t value);
+
+/**
+ * lvm_pv_{get|set}_pe_alloc_count
+ * pe_alloc_count - Total number of allocated Physical Extents.
+ */
+uint64_t lvm_pv_get_pe_alloc_count(const pv_t *pv);
+int lvm_pv_set_pe_alloc_count(pv_t *pv, const uint64_t value);
+
+/**
+ * lvm_pv_{get|set}_tags
+ * tags - Tags, if any.
+ */
+char *lvm_pv_get_tags(const pv_t *pv);
+int lvm_pv_set_tags(pv_t *pv, const char *value);
+
+/**
+ * lvm_pv_{get|set}_mda_count
+ * mda_count - Number of metadata areas on this device.
+ */
+uint64_t lvm_pv_get_mda_count(const pv_t *pv);
+int lvm_pv_set_mda_count(pv_t *pv, const uint64_t value);
+
+/**
+ * lvm_vg_{get|set}_fmt
+ * fmt - Type of metadata.
+ */
+char *lvm_vg_get_fmt(const vg_t *vg);
+int lvm_vg_set_fmt(vg_t *vg, const char *value);
+
+/**
+ * lvm_vg_{get|set}_uuid
+ * uuid - Unique identifier.
+ */
+char *lvm_vg_get_uuid(const vg_t *vg);
+int lvm_vg_set_uuid(vg_t *vg, const char *value);
+
+/**
+ * lvm_vg_{get|set}_name
+ * name - Name.
+ */
+char *lvm_vg_get_name(const vg_t *vg);
+int lvm_vg_set_name(vg_t *vg, const char *value);
+
+/**
+ * lvm_vg_{get|set}_attr
+ * attr - Various attributes - see man page.
+ */
+char *lvm_vg_get_attr(const vg_t *vg);
+int lvm_vg_set_attr(vg_t *vg, const char *value);
+
+/**
+ * lvm_vg_{get|set}_size
+ * size - Total size of VG in current units.
+ */
+uint64_t lvm_vg_get_size(const vg_t *vg);
+int lvm_vg_set_size(vg_t *vg, const uint64_t value);
+
+/**
+ * lvm_vg_{get|set}_free
+ * free - Total amount of free space in current units.
+ */
+uint64_t lvm_vg_get_free(const vg_t *vg);
+int lvm_vg_set_free(vg_t *vg, const uint64_t value);
+
+/**
+ * lvm_vg_{get|set}_sysid
+ * sysid - System ID indicating when and where it was created.
+ */
+char *lvm_vg_get_sysid(const vg_t *vg);
+int lvm_vg_set_sysid(vg_t *vg, const char *value);
+
+/**
+ * lvm_vg_{get|set}_extent_size
+ * extent_size - Size of Physical Extents in current units.
+ */
+uint64_t lvm_vg_get_extent_size(const vg_t *vg);
+int lvm_vg_set_extent_size(vg_t *vg, const uint64_t value);
+
+/**
+ * lvm_vg_{get|set}_extent_count
+ * extent_count - Total number of Physical Extents.
+ */
+uint64_t lvm_vg_get_extent_count(const vg_t *vg);
+int lvm_vg_set_extent_count(vg_t *vg, const uint64_t value);
+
+/**
+ * lvm_vg_{get|set}_free_count
+ * free_count - Total number of unallocated Physical Extents.
+ */
+uint64_t lvm_vg_get_free_count(const vg_t *vg);
+int lvm_vg_set_free_count(vg_t *vg, const uint64_t value);
+
+/**
+ * lvm_vg_{get|set}_max_lv
+ * max_lv - Maximum number of LVs allowed in VG or 0 if unlimited.
+ */
+uint64_t lvm_vg_get_max_lv(const vg_t *vg);
+int lvm_vg_set_max_lv(vg_t *vg, const uint64_t value);
+
+/**
+ * lvm_vg_{get|set}_max_pv
+ * max_pv - Maximum number of PVs allowed in VG or 0 if unlimited.
+ */
+uint64_t lvm_vg_get_max_pv(const vg_t *vg);
+int lvm_vg_set_max_pv(vg_t *vg, const uint64_t value);
+
+/**
+ * lvm_vg_{get|set}_pv_count
+ * pv_count - Number of PVs.
+ */
+uint64_t lvm_vg_get_pv_count(const vg_t *vg);
+int lvm_vg_set_pv_count(vg_t *vg, const uint64_t value);
+
+/**
+ * lvm_vg_{get|set}_lv_count
+ * lv_count - Number of LVs.
+ */
+uint64_t lvm_vg_get_lv_count(const vg_t *vg);
+int lvm_vg_set_lv_count(vg_t *vg, const uint64_t value);
+
+/**
+ * lvm_vg_{get|set}_snap_count
+ * snap_count - Number of snapshots.
+ */
+uint64_t lvm_vg_get_snap_count(const vg_t *vg);
+int lvm_vg_set_snap_count(vg_t *vg, const uint64_t value);
+
+/**
+ * lvm_vg_{get|set}_seqno
+ * seqno - Revision number of internal metadata.  Incremented whenever it changes.
+ */
+uint64_t lvm_vg_get_seqno(const vg_t *vg);
+int lvm_vg_set_seqno(vg_t *vg, const uint64_t value);
+
+/**
+ * lvm_vg_{get|set}_tags
+ * tags - Tags, if any.
+ */
+char *lvm_vg_get_tags(const vg_t *vg);
+int lvm_vg_set_tags(vg_t *vg, const char *value);
+
+/**
+ * lvm_vg_{get|set}_mda_count
+ * mda_count - Number of metadata areas in use by this VG.
+ */
+uint64_t lvm_vg_get_mda_count(const vg_t *vg);
+int lvm_vg_set_mda_count(vg_t *vg, const uint64_t value);
+
+/**
+ * lvm_vg_{get|set}_mda_free
+ * mda_free - Free metadata area space for this VG in current units.
+ */
+uint64_t lvm_vg_get_mda_free(const vg_t *vg);
+int lvm_vg_set_mda_free(vg_t *vg, const uint64_t value);
+
+/**
+ * lvm_vg_{get|set}_mda_size
+ * mda_size - Size of smallest metadata area for this VG in current units.
+ */
+uint64_t lvm_vg_get_mda_size(const vg_t *vg);
+int lvm_vg_set_mda_size(vg_t *vg, const uint64_t value);
+
+/**
+ * lvm_lvseg_{get|set}_ype
+ * ype - Type of LV segment.
+ */
+char *lvm_lvseg_get_ype(const lvseg_t *lvseg);
+int lvm_lvseg_set_ype(lvseg_t *lvseg, const char *value);
+
+/**
+ * lvm_lvseg_{get|set}_stripes
+ * stripes - Number of stripes or mirror legs.
+ */
+uint64_t lvm_lvseg_get_stripes(const lvseg_t *lvseg);
+int lvm_lvseg_set_stripes(lvseg_t *lvseg, const uint64_t value);
+
+/**
+ * lvm_lvseg_{get|set}_stripe_size
+ * stripe_size - For stripes, amount of data placed on one device before switching to the next.
+ */
+uint64_t lvm_lvseg_get_stripe_size(const lvseg_t *lvseg);
+int lvm_lvseg_set_stripe_size(lvseg_t *lvseg, const uint64_t value);
+
+/**
+ * lvm_lvseg_{get|set}_region_size
+ * region_size - For mirrors, the unit of data copied when synchronising devices.
+ */
+uint64_t lvm_lvseg_get_region_size(const lvseg_t *lvseg);
+int lvm_lvseg_set_region_size(lvseg_t *lvseg, const uint64_t value);
+
+/**
+ * lvm_lvseg_{get|set}_chunk_size
+ * chunk_size - For snapshots, the unit of data used when tracking changes.
+ */
+uint64_t lvm_lvseg_get_chunk_size(const lvseg_t *lvseg);
+int lvm_lvseg_set_chunk_size(lvseg_t *lvseg, const uint64_t value);
+
+/**
+ * lvm_lvseg_{get|set}_start
+ * start - Offset within the LV to the start of the segment in current units.
+ */
+uint64_t lvm_lvseg_get_start(const lvseg_t *lvseg);
+int lvm_lvseg_set_start(lvseg_t *lvseg, const uint64_t value);
+
+/**
+ * lvm_lvseg_{get|set}_start_pe
+ * start_pe - Offset within the LV to the start of the segment in physical extents.
+ */
+uint64_t lvm_lvseg_get_start_pe(const lvseg_t *lvseg);
+int lvm_lvseg_set_start_pe(lvseg_t *lvseg, const uint64_t value);
+
+/**
+ * lvm_lvseg_{get|set}_size
+ * size - Size of segment in current units.
+ */
+uint64_t lvm_lvseg_get_size(const lvseg_t *lvseg);
+int lvm_lvseg_set_size(lvseg_t *lvseg, const uint64_t value);
+
+/**
+ * lvm_lvseg_{get|set}_tags
+ * tags - Tags, if any.
+ */
+char *lvm_lvseg_get_tags(const lvseg_t *lvseg);
+int lvm_lvseg_set_tags(lvseg_t *lvseg, const char *value);
+
+/**
+ * lvm_lvseg_{get|set}_pe_ranges
+ * pe_ranges - Ranges of Physical Extents of underlying devices in command line format.
+ */
+char *lvm_lvseg_get_pe_ranges(const lvseg_t *lvseg);
+int lvm_lvseg_set_pe_ranges(lvseg_t *lvseg, const char *value);
+
+/**
+ * lvm_lvseg_{get|set}_devices
+ * devices - Underlying devices used with starting extent numbers.
+ */
+char *lvm_lvseg_get_devices(const lvseg_t *lvseg);
+int lvm_lvseg_set_devices(lvseg_t *lvseg, const char *value);
+
+/**
+ * lvm_pvseg_{get|set}_start
+ * start - Physical Extent number of start of segment.
+ */
+uint64_t lvm_pvseg_get_start(const pvseg_t *pvseg);
+int lvm_pvseg_set_start(pvseg_t *pvseg, const uint64_t value);
+
+/**
+ * lvm_pvseg_{get|set}_size
+ * size - Number of extents in segment.
+ */
+uint64_t lvm_pvseg_get_size(const pvseg_t *pvseg);
+int lvm_pvseg_set_size(pvseg_t *pvseg, const uint64_t value);
+
+#endif
diff --git a/liblvm/lvm.h b/liblvm/lvm.h
index 4e71e15..55dcb68 100644
--- a/liblvm/lvm.h
+++ b/liblvm/lvm.h
@@ -68,5 +68,6 @@ void lvm_destroy(lvm_t libh);
  */
 int lvm_reload_config(lvm_t libh);
 
+#include "lvm_object_prop.h"
 
 #endif /* _LIB_LVM_H */
-- 
1.6.0.6



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 04/30] Update vg_size 'disp' function to call liblvm 'get' function.
  2009-05-11 13:01     ` [PATCH 03/30] Add generated files, lvm_object_prop.[ch], to lib/report directory and build Dave Wysochanski
@ 2009-05-11 13:01       ` Dave Wysochanski
  2009-05-11 13:01         ` [PATCH 05/30] Modify lv_major and lv_minor fields to call liblvm 'get' functions Dave Wysochanski
  0 siblings, 1 reply; 32+ messages in thread
From: Dave Wysochanski @ 2009-05-11 13:01 UTC (permalink / raw)
  To: lvm-devel

Move 'disp' function logic that calculates vg_size inside liblvm 'get'
function.

Should be no functional change.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
---
 lib/report/lvm_object_prop.c |    3 +--
 lib/report/report.c          |    3 ++-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/report/lvm_object_prop.c b/lib/report/lvm_object_prop.c
index e353772..15b7991 100644
--- a/lib/report/lvm_object_prop.c
+++ b/lib/report/lvm_object_prop.c
@@ -561,8 +561,7 @@ int lvm_vg_set_attr(vg_t *vg, const char *value)
  */
 uint64_t lvm_vg_get_size(const vg_t *vg)
 {
-	/* FIXME: implement function body */
-	return 0;
+	return (uint64_t) vg->extent_count * vg->extent_size;
 }
 int lvm_vg_set_size(vg_t *vg, const uint64_t value)
 {
diff --git a/lib/report/report.c b/lib/report/report.c
index 91e2b98..6865c20 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -23,6 +23,7 @@
 #include "segtype.h"
 #include "str_list.h"
 #include "lvmcache.h"
+#include "lvm_object_prop.h"
 
 struct lvm_report_object {
 	struct volume_group *vg;
@@ -672,7 +673,7 @@ static int _vgsize_disp(struct dm_report *rh, struct dm_pool *mem,
 	const struct volume_group *vg = (const struct volume_group *) data;
 	uint64_t size;
 
-	size = (uint64_t) vg->extent_count * vg->extent_size;
+	size = lvm_vg_get_size(vg);
 
 	return _size64_disp(rh, mem, field, &size, private);
 }
-- 
1.6.0.6



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 05/30] Modify lv_major and lv_minor fields to call liblvm 'get' functions.
  2009-05-11 13:01       ` [PATCH 04/30] Update vg_size 'disp' function to call liblvm 'get' function Dave Wysochanski
@ 2009-05-11 13:01         ` Dave Wysochanski
  2009-05-11 13:01           ` [PATCH 06/30] Update lvreadahead_disp to call liblvm 'get' function Dave Wysochanski
  0 siblings, 1 reply; 32+ messages in thread
From: Dave Wysochanski @ 2009-05-11 13:01 UTC (permalink / raw)
  To: lvm-devel

We'd like to call liblvm 'get' functions from the reporting commands in
all cases.  This allows for nice code re-use, as well as free testing.
In the case of simple fields that are dereferences, we must modify the
'disp' function from a generic one (e.g. _int32_disp()) to a specific one.
The reason for this is that the generic one relies on the dereference of
the base object pointer + field data value, which is done in libdm.
If we call the liblvm 'get' functions, the dereference is done in there.
So for each field, we remove the generic "int32" disp function and replace
it with a specific one.  Note that we change the data pointer argument to
the FIELD macro to 'lvid', which makes the base + offset calculation in
libdm yield the pointer to the object for the value of 'data' pointer
being passed into the 'disp' function.

Should be no functional change.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
---
 lib/report/columns.h |    4 ++--
 lib/report/report.c  |   32 +++++++++++++++++++++++++-------
 2 files changed, 27 insertions(+), 9 deletions(-)

diff --git a/lib/report/columns.h b/lib/report/columns.h
index d1dbc1c..60a9bfb 100644
--- a/lib/report/columns.h
+++ b/lib/report/columns.h
@@ -59,8 +59,8 @@
 FIELD(LVS, lv, STR, "LV UUID", lvid.id[1], 38, uuid, "lv_uuid", "Unique identifier.")
 FIELD(LVS, lv, STR, "LV", lvid, 4, lvname, "lv_name", "Name.  LVs created for internal use are enclosed in brackets.")
 FIELD(LVS, lv, STR, "Attr", lvid, 4, lvstatus, "lv_attr", "Various attributes - see man page.")
-FIELD(LVS, lv, NUM, "Maj", major, 3, int32, "lv_major", "Persistent major number or -1 if not persistent.")
-FIELD(LVS, lv, NUM, "Min", minor, 3, int32, "lv_minor", "Persistent minor number or -1 if not persistent.")
+FIELD(LVS, lv, NUM, "Maj", lvid, 3, lvmajor, "lv_major", "Persistent major number or -1 if not persistent.")
+FIELD(LVS, lv, NUM, "Min", lvid, 3, lvminor, "lv_minor", "Persistent minor number or -1 if not persistent.")
 FIELD(LVS, lv, NUM, "Rahead", lvid, 6, lvreadahead, "lv_read_ahead", "Read ahead setting in current units.")
 FIELD(LVS, lv, STR, "KMaj", lvid, 4, lvkmaj, "lv_kernel_major", "Currently assigned major number or -1 if LV is not active.")
 FIELD(LVS, lv, STR, "KMin", lvid, 4, lvkmin, "lv_kernel_minor", "Currently assigned minor number or -1 if LV is not active.")
diff --git a/lib/report/report.c b/lib/report/report.c
index 6865c20..e43f9b4 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -247,6 +247,31 @@ static int _pvfmt_disp(struct dm_report *rh, struct dm_pool *mem,
 	return _string_disp(rh, mem, field, &pv->fmt->name, private);
 }
 
+
+static int _lvmajor_disp(struct dm_report *rh, struct dm_pool *mem __attribute((unused)),
+			 struct dm_report_field *field,
+			 const void *data, void *private __attribute((unused)))
+{
+	const struct logical_volume *lv = (const struct logical_volume *) data;
+	int32_t value;
+
+	value = lvm_lv_get_major(lv);
+	return dm_report_field_int32(rh, field, &value);
+}
+
+
+static int _lvminor_disp(struct dm_report *rh, struct dm_pool *mem __attribute((unused)),
+			 struct dm_report_field *field,
+			 const void *data, void *private __attribute((unused)))
+{
+	const struct logical_volume *lv = (const struct logical_volume *) data;
+	int32_t value;
+
+	value = lvm_lv_get_minor(lv);
+	return dm_report_field_int32(rh, field, &value);
+}
+
+
 static int _lvkmaj_disp(struct dm_report *rh, struct dm_pool *mem __attribute((unused)),
 			struct dm_report_field *field,
 			const void *data, void *private __attribute((unused)))
@@ -843,13 +868,6 @@ static int _uint32_disp(struct dm_report *rh, struct dm_pool *mem __attribute((u
 	return dm_report_field_uint32(rh, field, data);
 }
 
-static int _int32_disp(struct dm_report *rh, struct dm_pool *mem __attribute((unused)),
-		       struct dm_report_field *field,
-		       const void *data, void *private __attribute((unused)))
-{
-	return dm_report_field_int32(rh, field, data);
-}
-
 static int _pvmdas_disp(struct dm_report *rh, struct dm_pool *mem,
 			struct dm_report_field *field,
 			const void *data, void *private)
-- 
1.6.0.6



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 06/30] Update lvreadahead_disp to call liblvm 'get' function.
  2009-05-11 13:01         ` [PATCH 05/30] Modify lv_major and lv_minor fields to call liblvm 'get' functions Dave Wysochanski
@ 2009-05-11 13:01           ` Dave Wysochanski
  2009-05-11 13:01             ` [PATCH 07/30] Update lvkreadhead_disp " Dave Wysochanski
  0 siblings, 1 reply; 32+ messages in thread
From: Dave Wysochanski @ 2009-05-11 13:01 UTC (permalink / raw)
  To: lvm-devel

Should be no functional change.  Just move the dereference inside 'get'
function and call from 'disp' function.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
---
 lib/report/lvm_object_prop.c |    3 +--
 lib/report/report.c          |    6 ++++--
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/lib/report/lvm_object_prop.c b/lib/report/lvm_object_prop.c
index 15b7991..c92bc2b 100644
--- a/lib/report/lvm_object_prop.c
+++ b/lib/report/lvm_object_prop.c
@@ -89,8 +89,7 @@ int lvm_lv_set_minor(lv_t *lv, const uint64_t value)
  */
 uint64_t lvm_lv_get_read_ahead(const lv_t *lv)
 {
-	/* FIXME: implement function body */
-	return 0;
+	return lv->read_ahead;
 }
 int lvm_lv_set_read_ahead(lv_t *lv, const uint64_t value)
 {
diff --git a/lib/report/report.c b/lib/report/report.c
index e43f9b4..e933453 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -668,13 +668,15 @@ static int _lvreadahead_disp(struct dm_report *rh, struct dm_pool *mem,
 			     const void *data, void *private __attribute((unused)))
 {
 	const struct logical_volume *lv = (const struct logical_volume *) data;
+	uint32_t value;
 
-	if (lv->read_ahead == DM_READ_AHEAD_AUTO) {
+	value = lvm_lv_get_read_ahead(lv);
+	if (value == DM_READ_AHEAD_AUTO) {
 		dm_report_field_set_value(field, "auto", &_minusone);
 		return 1;
 	}
 
-	return _size32_disp(rh, mem, field, &lv->read_ahead, private);
+	return _size32_disp(rh, mem, field, &value, private);
 }
 
 static int _lvkreadahead_disp(struct dm_report *rh, struct dm_pool *mem,
-- 
1.6.0.6



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 07/30] Update lvkreadhead_disp to call liblvm 'get' function.
  2009-05-11 13:01           ` [PATCH 06/30] Update lvreadahead_disp to call liblvm 'get' function Dave Wysochanski
@ 2009-05-11 13:01             ` Dave Wysochanski
  2009-05-11 13:01               ` [PATCH 08/30] Update lv_size field - create lvsize_disp() and " Dave Wysochanski
  0 siblings, 1 reply; 32+ messages in thread
From: Dave Wysochanski @ 2009-05-11 13:01 UTC (permalink / raw)
  To: lvm-devel

Should be no functional change.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
---
 lib/report/lvm_object_prop.c |    7 +++++--
 lib/report/report.c          |    7 ++++---
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/lib/report/lvm_object_prop.c b/lib/report/lvm_object_prop.c
index c92bc2b..e4b66b2 100644
--- a/lib/report/lvm_object_prop.c
+++ b/lib/report/lvm_object_prop.c
@@ -14,6 +14,7 @@
 #include "lvm.h"
 #include "lib.h"
 #include "metadata-exported.h"
+#include "activate.h"
 
 /**
  * lvm_lv_{get|set}_uuid
@@ -130,8 +131,10 @@ int lvm_lv_set_kernel_minor(lv_t *lv, const uint64_t value)
  */
 uint64_t lvm_lv_get_kernel_read_ahead(const lv_t *lv)
 {
-	/* FIXME: implement function body */
-	return 0;
+	struct lvinfo info;
+	if (!lv_info(lv->vg->cmd, lv, &info, 0, 1) || !info.exists)
+		return -1;
+	return info.read_ahead;
 }
 int lvm_lv_set_kernel_read_ahead(lv_t *lv, const uint64_t value)
 {
diff --git a/lib/report/report.c b/lib/report/report.c
index e933453..3bd4c45 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -685,12 +685,13 @@ static int _lvkreadahead_disp(struct dm_report *rh, struct dm_pool *mem,
 			      void *private)
 {
 	const struct logical_volume *lv = (const struct logical_volume *) data;
-	struct lvinfo info;
+	uint32_t value;
 
-	if (!lv_info(lv->vg->cmd, lv, &info, 0, 1) || !info.exists)
+	value = lvm_lv_get_kernel_read_ahead(lv);
+	if (value == -1)
 		return dm_report_field_uint64(rh, field, &_minusone);
 
-	return _size32_disp(rh, mem, field, &info.read_ahead, private);
+	return _size32_disp(rh, mem, field, &value, private);
 }
 
 static int _vgsize_disp(struct dm_report *rh, struct dm_pool *mem,
-- 
1.6.0.6



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 08/30] Update lv_size field - create lvsize_disp() and call liblvm 'get' function.
  2009-05-11 13:01             ` [PATCH 07/30] Update lvkreadhead_disp " Dave Wysochanski
@ 2009-05-11 13:01               ` Dave Wysochanski
  2009-05-11 13:01                 ` [PATCH 09/30] Update lvsegcount_disp() to " Dave Wysochanski
  0 siblings, 1 reply; 32+ messages in thread
From: Dave Wysochanski @ 2009-05-11 13:01 UTC (permalink / raw)
  To: lvm-devel

Should be no functional change.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
---
 lib/report/columns.h |    2 +-
 lib/report/report.c  |   12 ++++++++++++
 2 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/lib/report/columns.h b/lib/report/columns.h
index 60a9bfb..7e9c95d 100644
--- a/lib/report/columns.h
+++ b/lib/report/columns.h
@@ -65,7 +65,7 @@ FIELD(LVS, lv, NUM, "Rahead", lvid, 6, lvreadahead, "lv_read_ahead", "Read ahead
 FIELD(LVS, lv, STR, "KMaj", lvid, 4, lvkmaj, "lv_kernel_major", "Currently assigned major number or -1 if LV is not active.")
 FIELD(LVS, lv, STR, "KMin", lvid, 4, lvkmin, "lv_kernel_minor", "Currently assigned minor number or -1 if LV is not active.")
 FIELD(LVS, lv, NUM, "KRahead", lvid, 7, lvkreadahead, "lv_kernel_read_ahead", "Currently-in-use read ahead setting in current units.")
-FIELD(LVS, lv, NUM, "LSize", size, 5, size64, "lv_size", "Size of LV in current units.")
+FIELD(LVS, lv, NUM, "LSize", lvid, 5, lvsize, "lv_size", "Size of LV in current units.")
 FIELD(LVS, lv, NUM, "#Seg", lvid, 4, lvsegcount, "seg_count", "Number of segments in LV.")
 FIELD(LVS, lv, STR, "Origin", lvid, 6, origin, "origin", "For snapshots, the origin device of this LV.")
 FIELD(LVS, lv, NUM, "OSize", lvid, 5, originsize, "origin_size", "For snapshots, the size of the origin device of this LV.")
diff --git a/lib/report/report.c b/lib/report/report.c
index 3bd4c45..cc522c4 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -706,6 +706,18 @@ static int _vgsize_disp(struct dm_report *rh, struct dm_pool *mem,
 	return _size64_disp(rh, mem, field, &size, private);
 }
 
+static int _lvsize_disp(struct dm_report *rh, struct dm_pool *mem,
+			struct dm_report_field *field,
+			const void *data, void *private)
+{
+	const struct logical_volume *lv = (const struct logical_volume *) data;
+	uint64_t size;
+
+	size = lvm_lv_get_size(lv);
+
+	return _size64_disp(rh, mem, field, &size, private);
+}
+
 static int _segstart_disp(struct dm_report *rh, struct dm_pool *mem,
 			  struct dm_report_field *field,
 			  const void *data, void *private)
-- 
1.6.0.6



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 09/30] Update lvsegcount_disp() to call liblvm 'get' function.
  2009-05-11 13:01               ` [PATCH 08/30] Update lv_size field - create lvsize_disp() and " Dave Wysochanski
@ 2009-05-11 13:01                 ` Dave Wysochanski
  2009-05-11 13:01                   ` [PATCH 10/30] Update originsize_disp() " Dave Wysochanski
  0 siblings, 1 reply; 32+ messages in thread
From: Dave Wysochanski @ 2009-05-11 13:01 UTC (permalink / raw)
  To: lvm-devel


Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
---
 lib/report/lvm_object_prop.c |    3 +--
 lib/report/report.c          |    2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/lib/report/lvm_object_prop.c b/lib/report/lvm_object_prop.c
index e4b66b2..071d9ce 100644
--- a/lib/report/lvm_object_prop.c
+++ b/lib/report/lvm_object_prop.c
@@ -160,8 +160,7 @@ int lvm_lv_set_size(lv_t *lv, const uint64_t value)
  */
 uint64_t lvm_lv_get_seg_count(const lv_t *lv)
 {
-	/* FIXME: implement function body */
-	return 0;
+	return dm_list_size(&lv->segments);
 }
 int lvm_lv_set_seg_count(lv_t *lv, const uint64_t value)
 {
diff --git a/lib/report/report.c b/lib/report/report.c
index cc522c4..78aea9b 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -1020,7 +1020,7 @@ static int _lvsegcount_disp(struct dm_report *rh, struct dm_pool *mem,
 	const struct logical_volume *lv = (const struct logical_volume *) data;
 	uint32_t count;
 
-	count = dm_list_size(&lv->segments);
+	count = lvm_lv_get_seg_count(lv);
 
 	return _uint32_disp(rh, mem, field, &count, private);
 }
-- 
1.6.0.6



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 10/30] Update originsize_disp() to call liblvm 'get' function.
  2009-05-11 13:01                 ` [PATCH 09/30] Update lvsegcount_disp() to " Dave Wysochanski
@ 2009-05-11 13:01                   ` Dave Wysochanski
  2009-05-11 13:01                     ` [PATCH 11/30] Update devsize_disp() " Dave Wysochanski
  0 siblings, 1 reply; 32+ messages in thread
From: Dave Wysochanski @ 2009-05-11 13:01 UTC (permalink / raw)
  To: lvm-devel

Should be no functional change.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
---
 lib/report/lvm_object_prop.c |   11 +++++++++--
 lib/report/report.c          |    7 +------
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/lib/report/lvm_object_prop.c b/lib/report/lvm_object_prop.c
index 071d9ce..ab8cc9c 100644
--- a/lib/report/lvm_object_prop.c
+++ b/lib/report/lvm_object_prop.c
@@ -187,8 +187,15 @@ int lvm_lv_set_origin(lv_t *lv, const char *value)
  */
 uint64_t lvm_lv_get_origin_size(const lv_t *lv)
 {
-	/* FIXME: implement function body */
-	return 0;
+	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);
+	return size;
 }
 int lvm_lv_set_origin_size(lv_t *lv, const uint64_t value)
 {
diff --git a/lib/report/report.c b/lib/report/report.c
index 78aea9b..85addc9 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -775,12 +775,7 @@ static int _originsize_disp(struct dm_report *rh, struct dm_pool *mem,
 	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 = lvm_lv_get_origin_size(lv);
 
 	return _size64_disp(rh, mem, field, &size, private);
 }
-- 
1.6.0.6



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 11/30] Update devsize_disp() to call liblvm 'get' function.
  2009-05-11 13:01                   ` [PATCH 10/30] Update originsize_disp() " Dave Wysochanski
@ 2009-05-11 13:01                     ` Dave Wysochanski
  2009-05-11 13:01                       ` [PATCH 12/30] Update pvmdafree_disp() " Dave Wysochanski
  0 siblings, 1 reply; 32+ messages in thread
From: Dave Wysochanski @ 2009-05-11 13:01 UTC (permalink / raw)
  To: lvm-devel

Should be no functional change.
Note again we change the field data pointer from 'dev' to 'id' so that
the 'data' pointer value is simply the pointer to the 'pv'.  We can then
call the liblvm 'get' function to retrieve the value.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
---
 lib/report/columns.h         |    2 +-
 lib/report/lvm_object_prop.c |    8 ++++++--
 lib/report/report.c          |    5 ++---
 3 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/lib/report/columns.h b/lib/report/columns.h
index 7e9c95d..fc79d62 100644
--- a/lib/report/columns.h
+++ b/lib/report/columns.h
@@ -79,7 +79,7 @@ FIELD(LVS, lv, STR, "Modules", lvid, 7, modules, "modules", "Kernel device-mappe
 
 FIELD(LABEL, pv, STR, "Fmt", id, 3, pvfmt, "pv_fmt", "Type of metadata.")
 FIELD(LABEL, pv, STR, "PV UUID", id, 38, uuid, "pv_uuid", "Unique identifier.")
-FIELD(LABEL, pv, NUM, "DevSize", dev, 7, devsize, "dev_size", "Size of underlying device in current units.")
+FIELD(LABEL, pv, NUM, "DevSize", id, 7, devsize, "dev_size", "Size of underlying device in current units.")
 FIELD(LABEL, pv, STR, "PV", dev, 10, dev_name, "pv_name", "Name.")
 FIELD(LABEL, pv, NUM, "PMdaFree", id, 9, pvmdafree, "pv_mda_free", "Free metadata area space on this device in current units.")
 FIELD(LABEL, pv, NUM, "PMdaSize", id, 9, pvmdasize, "pv_mda_size", "Size of smallest metadata area on this device in current units.")
diff --git a/lib/report/lvm_object_prop.c b/lib/report/lvm_object_prop.c
index ab8cc9c..27690a6 100644
--- a/lib/report/lvm_object_prop.c
+++ b/lib/report/lvm_object_prop.c
@@ -15,6 +15,7 @@
 #include "lib.h"
 #include "metadata-exported.h"
 #include "activate.h"
+#include "device.h"
 
 /**
  * lvm_lv_{get|set}_uuid
@@ -334,8 +335,11 @@ int lvm_pv_set_uuid(pv_t *pv, const char *value)
  */
 uint64_t lvm_pv_get_dev_size(const pv_t *pv)
 {
-	/* FIXME: implement function body */
-	return 0;
+	uint64_t size;
+
+	if (!dev_get_size(pv->dev, &size))
+		size = 0;
+	return size;
 }
 int lvm_pv_set_dev_size(pv_t *pv, const uint64_t value)
 {
diff --git a/lib/report/report.c b/lib/report/report.c
index 85addc9..02e61de 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -832,11 +832,10 @@ static int _devsize_disp(struct dm_report *rh, struct dm_pool *mem,
 			 struct dm_report_field *field,
 			 const void *data, void *private)
 {
-	const struct device *dev = *(const struct device **) data;
+	const struct physical_volume *pv = (const struct physical_volume *) data;
 	uint64_t size;
 
-	if (!dev_get_size(dev, &size))
-		size = 0;
+	size = lvm_pv_get_dev_size(pv);
 
 	return _size64_disp(rh, mem, field, &size, private);
 }
-- 
1.6.0.6



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 12/30] Update pvmdafree_disp() to call liblvm 'get' function.
  2009-05-11 13:01                     ` [PATCH 11/30] Update devsize_disp() " Dave Wysochanski
@ 2009-05-11 13:01                       ` Dave Wysochanski
  2009-05-11 13:01                         ` [PATCH 13/30] Update pvmdasize_disp and vgmdasize_disp " Dave Wysochanski
  0 siblings, 1 reply; 32+ messages in thread
From: Dave Wysochanski @ 2009-05-11 13:01 UTC (permalink / raw)
  To: lvm-devel

Move the guts of pvmadfree_disp() inside liblvm 'get' function.
As we do this, we must add a few more includes into lvm_object_prop.c
as we are now dereferencing internal lvm types to get the field values.

Should be no functional change.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
---
 lib/report/lvm_object_prop.c |   22 ++++++++++++++++++++--
 lib/report/report.c          |   18 +++---------------
 2 files changed, 23 insertions(+), 17 deletions(-)

diff --git a/lib/report/lvm_object_prop.c b/lib/report/lvm_object_prop.c
index 27690a6..8f8b5d7 100644
--- a/lib/report/lvm_object_prop.c
+++ b/lib/report/lvm_object_prop.c
@@ -16,6 +16,9 @@
 #include "metadata-exported.h"
 #include "activate.h"
 #include "device.h"
+#include "lvmcache.h"
+#include "uuid.h"
+#include "metadata.h"
 
 /**
  * lvm_lv_{get|set}_uuid
@@ -366,8 +369,23 @@ int lvm_pv_set_name(pv_t *pv, const char *value)
  */
 uint64_t lvm_pv_get_mda_free(const pv_t *pv)
 {
-	/* FIXME: implement function body */
-	return 0;
+	struct lvmcache_info *info;
+	uint64_t freespace = UINT64_MAX, mda_free;
+	const char *pvid = (const char *)pv->id.uuid;
+	struct metadata_area *mda;
+
+	if ((info = info_from_pvid(pvid, 0)))
+		dm_list_iterate_items(mda, &info->mdas) {
+			if (!mda->ops->mda_free_sectors)
+				continue;
+			mda_free = mda->ops->mda_free_sectors(mda);
+			if (mda_free < freespace)
+				freespace = mda_free;
+		}
+
+	if (freespace == UINT64_MAX)
+		freespace = UINT64_C(0);
+	return freespace;
 }
 int lvm_pv_set_mda_free(pv_t *pv, const uint64_t value)
 {
diff --git a/lib/report/report.c b/lib/report/report.c
index 02e61de..1fa7aa6 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -907,22 +907,10 @@ static int _pvmdafree_disp(struct dm_report *rh, struct dm_pool *mem,
 			   struct dm_report_field *field,
 			   const void *data, void *private)
 {
-	struct lvmcache_info *info;
-	uint64_t freespace = UINT64_MAX, mda_free;
-	const char *pvid = (const char *)(&((struct id *) data)->uuid);
-	struct metadata_area *mda;
-
-	if ((info = info_from_pvid(pvid, 0)))
-		dm_list_iterate_items(mda, &info->mdas) {
-			if (!mda->ops->mda_free_sectors)
-				continue;
-			mda_free = mda->ops->mda_free_sectors(mda);
-			if (mda_free < freespace)
-				freespace = mda_free;
-		}
+	const struct physical_volume *pv = (const struct physical_volume *) data;
+	uint64_t freespace;
 
-	if (freespace == UINT64_MAX)
-		freespace = UINT64_C(0);
+	freespace = lvm_pv_get_mda_free(pv);
 
 	return _size64_disp(rh, mem, field, &freespace, private);
 }
-- 
1.6.0.6



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 13/30] Update pvmdasize_disp and vgmdasize_disp to call liblvm 'get' function.
  2009-05-11 13:01                       ` [PATCH 12/30] Update pvmdafree_disp() " Dave Wysochanski
@ 2009-05-11 13:01                         ` Dave Wysochanski
  2009-05-11 13:01                           ` [PATCH 14/30] Update pe_start field - create pestart_disp which calls " Dave Wysochanski
  0 siblings, 1 reply; 32+ messages in thread
From: Dave Wysochanski @ 2009-05-11 13:01 UTC (permalink / raw)
  To: lvm-devel

Should be no functional change.
We must move both pvmdasize and vgmdasize at the same time since they both
use the _find_min_mda_size() code.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
---
 lib/report/lvm_object_prop.c |   33 +++++++++++++++++++++++++++++----
 lib/report/report.c          |   30 ++++--------------------------
 2 files changed, 33 insertions(+), 30 deletions(-)

diff --git a/lib/report/lvm_object_prop.c b/lib/report/lvm_object_prop.c
index 8f8b5d7..726d2b6 100644
--- a/lib/report/lvm_object_prop.c
+++ b/lib/report/lvm_object_prop.c
@@ -392,14 +392,40 @@ int lvm_pv_set_mda_free(pv_t *pv, const uint64_t value)
 	/* FIXME: implement function body */
 	return -1;
 }
+
+static uint64_t _find_min_mda_size(struct dm_list *mdas)
+{
+	uint64_t min_mda_size = UINT64_MAX, mda_size;
+	struct metadata_area *mda;
+
+	dm_list_iterate_items(mda, mdas) {
+		if (!mda->ops->mda_total_sectors)
+			continue;
+		mda_size = mda->ops->mda_total_sectors(mda);
+		if (mda_size < min_mda_size)
+			min_mda_size = mda_size;
+	}
+
+	if (min_mda_size == UINT64_MAX)
+		min_mda_size = UINT64_C(0);
+
+	return min_mda_size;
+}
+
 /**
  * lvm_pv_{get|set}_mda_size
  * mda_size - Size of smallest metadata area on this device in current units.
  */
 uint64_t lvm_pv_get_mda_size(const pv_t *pv)
 {
-	/* FIXME: implement function body */
-	return 0;
+	struct lvmcache_info *info;
+	uint64_t min_mda_size = 0;
+	const char *pvid = (const char *)pv->id.uuid;
+
+	/* PVs could have 2 mdas of different sizes (rounding effect) */
+	if ((info = info_from_pvid(pvid, 0)))
+		min_mda_size = _find_min_mda_size(&info->mdas);
+	return min_mda_size;
 }
 int lvm_pv_set_mda_size(pv_t *pv, const uint64_t value)
 {
@@ -792,8 +818,7 @@ int lvm_vg_set_mda_free(vg_t *vg, const uint64_t value)
  */
 uint64_t lvm_vg_get_mda_size(const vg_t *vg)
 {
-	/* FIXME: implement function body */
-	return 0;
+	return _find_min_mda_size(&vg->fid->metadata_areas);;
 }
 int lvm_vg_set_mda_size(vg_t *vg, const uint64_t value)
 {
diff --git a/lib/report/report.c b/lib/report/report.c
index 1fa7aa6..da694a5 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -915,36 +915,14 @@ static int _pvmdafree_disp(struct dm_report *rh, struct dm_pool *mem,
 	return _size64_disp(rh, mem, field, &freespace, private);
 }
 
-static uint64_t _find_min_mda_size(struct dm_list *mdas)
-{
-	uint64_t min_mda_size = UINT64_MAX, mda_size;
-	struct metadata_area *mda;
-
-	dm_list_iterate_items(mda, mdas) {
-		if (!mda->ops->mda_total_sectors)
-			continue;
-		mda_size = mda->ops->mda_total_sectors(mda);
-		if (mda_size < min_mda_size)
-			min_mda_size = mda_size;
-	}
-
-	if (min_mda_size == UINT64_MAX)
-		min_mda_size = UINT64_C(0);
-
-	return min_mda_size;
-}
-
 static int _pvmdasize_disp(struct dm_report *rh, struct dm_pool *mem,
 			   struct dm_report_field *field,
 			   const void *data, void *private)
 {
-	struct lvmcache_info *info;
-	uint64_t min_mda_size = 0;
-	const char *pvid = (const char *)(&((struct id *) data)->uuid);
+	const struct physical_volume *pv = (const struct physical_volume *) data;
+	uint64_t min_mda_size;
 
-	/* PVs could have 2 mdas of different sizes (rounding effect) */
-	if ((info = info_from_pvid(pvid, 0)))
-		min_mda_size = _find_min_mda_size(&info->mdas);
+	min_mda_size = lvm_pv_get_mda_size(pv);
 
 	return _size64_disp(rh, mem, field, &min_mda_size, private);
 }
@@ -956,7 +934,7 @@ static int _vgmdasize_disp(struct dm_report *rh, struct dm_pool *mem,
 	const struct volume_group *vg = (const struct volume_group *) data;
 	uint64_t min_mda_size;
 
-	min_mda_size = _find_min_mda_size(&vg->fid->metadata_areas);
+	min_mda_size = lvm_vg_get_mda_size(vg);
 
 	return _size64_disp(rh, mem, field, &min_mda_size, private);
 }
-- 
1.6.0.6



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 14/30] Update pe_start field - create pestart_disp which calls liblvm 'get' function.
  2009-05-11 13:01                         ` [PATCH 13/30] Update pvmdasize_disp and vgmdasize_disp " Dave Wysochanski
@ 2009-05-11 13:01                           ` Dave Wysochanski
  2009-05-11 13:01                             ` [PATCH 15/30] Update pvsize_disp to call " Dave Wysochanski
  0 siblings, 1 reply; 32+ messages in thread
From: Dave Wysochanski @ 2009-05-11 13:01 UTC (permalink / raw)
  To: lvm-devel

Note that the liblvm 'get' function was one of the autogenerated ones
(simple field dereference).

Should be no functional change.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
---
 lib/report/columns.h |    2 +-
 lib/report/report.c  |   13 +++++++++++++
 2 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/lib/report/columns.h b/lib/report/columns.h
index fc79d62..22b6ee0 100644
--- a/lib/report/columns.h
+++ b/lib/report/columns.h
@@ -84,7 +84,7 @@ FIELD(LABEL, pv, STR, "PV", dev, 10, dev_name, "pv_name", "Name.")
 FIELD(LABEL, pv, NUM, "PMdaFree", id, 9, pvmdafree, "pv_mda_free", "Free metadata area space on this device in current units.")
 FIELD(LABEL, pv, NUM, "PMdaSize", id, 9, pvmdasize, "pv_mda_size", "Size of smallest metadata area on this device in current units.")
 
-FIELD(PVS, pv, NUM, "1st PE", pe_start, 7, size64, "pe_start", "Offset to the start of data on the underlying device.")
+FIELD(PVS, pv, NUM, "1st PE", id, 7, pestart, "pe_start", "Offset to the start of data on the underlying device.")
 FIELD(PVS, pv, NUM, "PSize", id, 5, pvsize, "pv_size", "Size of PV in current units.")
 FIELD(PVS, pv, NUM, "PFree", id, 5, pvfree, "pv_free", "Total amount of unallocated space in current units.")
 FIELD(PVS, pv, NUM, "Used", id, 4, pvused, "pv_used", "Total amount of allocated space in current units.")
diff --git a/lib/report/report.c b/lib/report/report.c
index da694a5..fc54f96 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -812,6 +812,19 @@ static int _pvfree_disp(struct dm_report *rh, struct dm_pool *mem,
 	return _size64_disp(rh, mem, field, &freespace, private);
 }
 
+static int _pestart_disp(struct dm_report *rh, struct dm_pool *mem,
+			 struct dm_report_field *field,
+			 const void *data, void *private)
+{
+	const struct physical_volume *pv =
+	    (const struct physical_volume *) data;
+	uint64_t value;
+
+	value = lvm_pv_get_pe_start(pv);
+
+	return _size64_disp(rh, mem, field, &value, private);
+}
+
 static int _pvsize_disp(struct dm_report *rh, struct dm_pool *mem,
 			struct dm_report_field *field,
 			const void *data, void *private)
-- 
1.6.0.6



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 15/30] Update pvsize_disp to call liblvm 'get' function.
  2009-05-11 13:01                           ` [PATCH 14/30] Update pe_start field - create pestart_disp which calls " Dave Wysochanski
@ 2009-05-11 13:01                             ` Dave Wysochanski
  2009-05-11 13:01                               ` [PATCH 16/30] Update pvfree_disp " Dave Wysochanski
  0 siblings, 1 reply; 32+ messages in thread
From: Dave Wysochanski @ 2009-05-11 13:01 UTC (permalink / raw)
  To: lvm-devel

Should be no functional change.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
---
 lib/report/lvm_object_prop.c |    9 +++++++--
 lib/report/report.c          |    5 +----
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/lib/report/lvm_object_prop.c b/lib/report/lvm_object_prop.c
index 726d2b6..0c79258 100644
--- a/lib/report/lvm_object_prop.c
+++ b/lib/report/lvm_object_prop.c
@@ -451,8 +451,13 @@ int lvm_pv_set_pe_start(pv_t *pv, const uint64_t value)
  */
 uint64_t lvm_pv_get_size(const pv_t *pv)
 {
-	/* FIXME: implement function body */
-	return 0;
+	uint64_t size;
+
+	if (!pv->pe_count)
+		size = pv->size;
+	else
+		size = (uint64_t) pv->pe_count * pv->pe_size;
+	return size;
 }
 int lvm_pv_set_size(pv_t *pv, const uint64_t value)
 {
diff --git a/lib/report/report.c b/lib/report/report.c
index fc54f96..a5d4a69 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -833,10 +833,7 @@ static int _pvsize_disp(struct dm_report *rh, struct dm_pool *mem,
 	    (const struct physical_volume *) data;
 	uint64_t size;
 
-	if (!pv->pe_count)
-		size = pv->size;
-	else
-		size = (uint64_t) pv->pe_count * pv->pe_size;
+	size = lvm_pv_get_size(pv);
 
 	return _size64_disp(rh, mem, field, &size, private);
 }
-- 
1.6.0.6



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 16/30] Update pvfree_disp to call liblvm 'get' function.
  2009-05-11 13:01                             ` [PATCH 15/30] Update pvsize_disp to call " Dave Wysochanski
@ 2009-05-11 13:01                               ` Dave Wysochanski
  2009-05-11 13:01                                 ` [PATCH 17/30] Update pvused_disp " Dave Wysochanski
  0 siblings, 1 reply; 32+ messages in thread
From: Dave Wysochanski @ 2009-05-11 13:01 UTC (permalink / raw)
  To: lvm-devel

Should be no functional change.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
---
 lib/report/lvm_object_prop.c |   10 ++++++++--
 lib/report/report.c          |    5 +----
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/lib/report/lvm_object_prop.c b/lib/report/lvm_object_prop.c
index 0c79258..a205801 100644
--- a/lib/report/lvm_object_prop.c
+++ b/lib/report/lvm_object_prop.c
@@ -470,8 +470,14 @@ int lvm_pv_set_size(pv_t *pv, const uint64_t value)
  */
 uint64_t lvm_pv_get_free(const pv_t *pv)
 {
-	/* FIXME: implement function body */
-	return 0;
+	uint64_t freespace;
+
+	if (!pv->pe_count)
+		freespace = pv->size;
+	else
+		freespace = (uint64_t) (pv->pe_count - pv->pe_alloc_count) * pv->pe_size;
+
+	return freespace;
 }
 int lvm_pv_set_free(pv_t *pv, const uint64_t value)
 {
diff --git a/lib/report/report.c b/lib/report/report.c
index a5d4a69..b2568b2 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -804,10 +804,7 @@ static int _pvfree_disp(struct dm_report *rh, struct dm_pool *mem,
 	    (const struct physical_volume *) data;
 	uint64_t freespace;
 
-	if (!pv->pe_count)
-		freespace = pv->size;
-	else
-		freespace = (uint64_t) (pv->pe_count - pv->pe_alloc_count) * pv->pe_size;
+	freespace = lvm_pv_get_free(pv);
 
 	return _size64_disp(rh, mem, field, &freespace, private);
 }
-- 
1.6.0.6



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 17/30] Update pvused_disp to call liblvm 'get' function.
  2009-05-11 13:01                               ` [PATCH 16/30] Update pvfree_disp " Dave Wysochanski
@ 2009-05-11 13:01                                 ` Dave Wysochanski
  2009-05-11 13:01                                   ` [PATCH 18/30] Update pv_pe_count and pv_pe_alloc_count fields to call liblvm 'get' functions Dave Wysochanski
  0 siblings, 1 reply; 32+ messages in thread
From: Dave Wysochanski @ 2009-05-11 13:01 UTC (permalink / raw)
  To: lvm-devel

Should be no functional change.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
---
 lib/report/lvm_object_prop.c |    9 +++++++--
 lib/report/report.c          |    5 +----
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/lib/report/lvm_object_prop.c b/lib/report/lvm_object_prop.c
index a205801..bed92b1 100644
--- a/lib/report/lvm_object_prop.c
+++ b/lib/report/lvm_object_prop.c
@@ -490,8 +490,13 @@ int lvm_pv_set_free(pv_t *pv, const uint64_t value)
  */
 uint64_t lvm_pv_get_used(const pv_t *pv)
 {
-	/* FIXME: implement function body */
-	return 0;
+	uint64_t used;
+
+	if (!pv->pe_count)
+		used = 0LL;
+	else
+		used = (uint64_t) pv->pe_alloc_count * pv->pe_size;
+	return used;
 }
 int lvm_pv_set_used(pv_t *pv, const uint64_t value)
 {
diff --git a/lib/report/report.c b/lib/report/report.c
index b2568b2..d2a5c0a 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -788,10 +788,7 @@ static int _pvused_disp(struct dm_report *rh, struct dm_pool *mem,
 	    (const struct physical_volume *) data;
 	uint64_t used;
 
-	if (!pv->pe_count)
-		used = 0LL;
-	else
-		used = (uint64_t) pv->pe_alloc_count * pv->pe_size;
+	used = lvm_pv_get_used(pv);
 
 	return _size64_disp(rh, mem, field, &used, private);
 }
-- 
1.6.0.6



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 18/30] Update pv_pe_count and pv_pe_alloc_count fields to call liblvm 'get' functions.
  2009-05-11 13:01                                 ` [PATCH 17/30] Update pvused_disp " Dave Wysochanski
@ 2009-05-11 13:01                                   ` Dave Wysochanski
  2009-05-11 13:01                                     ` [PATCH 19/30] Update pvmdas_disp to call liblvm 'get' function Dave Wysochanski
  0 siblings, 1 reply; 32+ messages in thread
From: Dave Wysochanski @ 2009-05-11 13:01 UTC (permalink / raw)
  To: lvm-devel

Implement specific 'disp' functions for these two fields, and call into
already generated liblvm 'get' functions.

Should be no functional change.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
---
 lib/report/columns.h |    4 ++--
 lib/report/report.c  |   26 ++++++++++++++++++++++++++
 2 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/lib/report/columns.h b/lib/report/columns.h
index 22b6ee0..f8d3516 100644
--- a/lib/report/columns.h
+++ b/lib/report/columns.h
@@ -89,8 +89,8 @@ FIELD(PVS, pv, NUM, "PSize", id, 5, pvsize, "pv_size", "Size of PV in current un
 FIELD(PVS, pv, NUM, "PFree", id, 5, pvfree, "pv_free", "Total amount of unallocated space in current units.")
 FIELD(PVS, pv, NUM, "Used", id, 4, pvused, "pv_used", "Total amount of allocated space in current units.")
 FIELD(PVS, pv, STR, "Attr", status, 4, pvstatus, "pv_attr", "Various attributes - see man page.")
-FIELD(PVS, pv, NUM, "PE", pe_count, 3, uint32, "pv_pe_count", "Total number of Physical Extents.")
-FIELD(PVS, pv, NUM, "Alloc", pe_alloc_count, 5, uint32, "pv_pe_alloc_count", "Total number of allocated Physical Extents.")
+FIELD(PVS, pv, NUM, "PE", id, 3, pecount, "pv_pe_count", "Total number of Physical Extents.")
+FIELD(PVS, pv, NUM, "Alloc", id, 5, pealloccount, "pv_pe_alloc_count", "Total number of allocated Physical Extents.")
 FIELD(PVS, pv, STR, "PV Tags", tags, 7, tags, "pv_tags", "Tags, if any.")
 FIELD(PVS, pv, NUM, "#PMda", id, 5, pvmdas, "pv_mda_count", "Number of metadata areas on this device.")
 
diff --git a/lib/report/report.c b/lib/report/report.c
index d2a5c0a..bb0c906 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -819,6 +819,32 @@ static int _pestart_disp(struct dm_report *rh, struct dm_pool *mem,
 	return _size64_disp(rh, mem, field, &value, private);
 }
 
+static int _pecount_disp(struct dm_report *rh, struct dm_pool *mem,
+			 struct dm_report_field *field,
+			 const void *data, void *private)
+{
+	const struct physical_volume *pv =
+	    (const struct physical_volume *) data;
+	uint32_t value;
+
+	value = lvm_pv_get_pe_count(pv);
+
+	return _uint32_disp(rh, mem, field, &value, private);
+}
+
+static int _pealloccount_disp(struct dm_report *rh, struct dm_pool *mem,
+			      struct dm_report_field *field,
+			      const void *data, void *private)
+{
+	const struct physical_volume *pv =
+	    (const struct physical_volume *) data;
+	uint32_t value;
+
+	value = lvm_pv_get_pe_alloc_count(pv);
+
+	return _uint32_disp(rh, mem, field, &value, private);
+}
+
 static int _pvsize_disp(struct dm_report *rh, struct dm_pool *mem,
 			struct dm_report_field *field,
 			const void *data, void *private)
-- 
1.6.0.6



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 19/30] Update pvmdas_disp to call liblvm 'get' function.
  2009-05-11 13:01                                   ` [PATCH 18/30] Update pv_pe_count and pv_pe_alloc_count fields to call liblvm 'get' functions Dave Wysochanski
@ 2009-05-11 13:01                                     ` Dave Wysochanski
  2009-05-11 13:01                                       ` [PATCH 20/30] Update vgfree_disp " Dave Wysochanski
  0 siblings, 1 reply; 32+ messages in thread
From: Dave Wysochanski @ 2009-05-11 13:01 UTC (permalink / raw)
  To: lvm-devel

Should be no functional change.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
---
 lib/report/lvm_object_prop.c |    9 +++++++--
 lib/report/report.c          |    6 ++----
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/lib/report/lvm_object_prop.c b/lib/report/lvm_object_prop.c
index bed92b1..c07385c 100644
--- a/lib/report/lvm_object_prop.c
+++ b/lib/report/lvm_object_prop.c
@@ -563,8 +563,13 @@ int lvm_pv_set_tags(pv_t *pv, const char *value)
  */
 uint64_t lvm_pv_get_mda_count(const pv_t *pv)
 {
-	/* FIXME: implement function body */
-	return 0;
+	struct lvmcache_info *info;
+	uint32_t count;
+	const char *pvid = (const char *)pv->id.uuid;
+
+	info = info_from_pvid(pvid, 0);
+	count = info ? dm_list_size(&info->mdas) : 0;
+	return count;
 }
 int lvm_pv_set_mda_count(pv_t *pv, const uint64_t value)
 {
diff --git a/lib/report/report.c b/lib/report/report.c
index bb0c906..d387609 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -911,12 +911,10 @@ static int _pvmdas_disp(struct dm_report *rh, struct dm_pool *mem,
 			struct dm_report_field *field,
 			const void *data, void *private)
 {
-	struct lvmcache_info *info;
+	const struct physical_volume *pv = (const struct physical_volume *) data;
 	uint32_t count;
-	const char *pvid = (const char *)(&((struct id *) data)->uuid);
 
-	info = info_from_pvid(pvid, 0);
-	count = info ? dm_list_size(&info->mdas) : 0;
+	count = lvm_pv_get_mda_count(pv);
 
 	return _uint32_disp(rh, mem, field, &count, private);
 }
-- 
1.6.0.6



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 20/30] Update vgfree_disp to call liblvm 'get' function.
  2009-05-11 13:01                                     ` [PATCH 19/30] Update pvmdas_disp to call liblvm 'get' function Dave Wysochanski
@ 2009-05-11 13:01                                       ` Dave Wysochanski
  2009-05-11 13:01                                         ` [PATCH 21/30] Update a few simple vg 'NUM' fields to call liblvm 'get' functions Dave Wysochanski
  0 siblings, 1 reply; 32+ messages in thread
From: Dave Wysochanski @ 2009-05-11 13:01 UTC (permalink / raw)
  To: lvm-devel

Should be no functional change.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
---
 lib/report/lvm_object_prop.c |    3 +--
 lib/report/report.c          |    2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/lib/report/lvm_object_prop.c b/lib/report/lvm_object_prop.c
index c07385c..e04318e 100644
--- a/lib/report/lvm_object_prop.c
+++ b/lib/report/lvm_object_prop.c
@@ -651,8 +651,7 @@ int lvm_vg_set_size(vg_t *vg, const uint64_t value)
  */
 uint64_t lvm_vg_get_free(const vg_t *vg)
 {
-	/* FIXME: implement function body */
-	return 0;
+	return (uint64_t) vg->free_count * vg->extent_size;;
 }
 int lvm_vg_set_free(vg_t *vg, const uint64_t value)
 {
diff --git a/lib/report/report.c b/lib/report/report.c
index d387609..2d03e11 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -877,7 +877,7 @@ static int _vgfree_disp(struct dm_report *rh, struct dm_pool *mem,
 	const struct volume_group *vg = (const struct volume_group *) data;
 	uint64_t freespace;
 
-	freespace = (uint64_t) vg->free_count * vg->extent_size;
+	freespace = lvm_vg_get_free(vg);
 
 	return _size64_disp(rh, mem, field, &freespace, private);
 }
-- 
1.6.0.6



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 21/30] Update a few simple vg 'NUM' fields to call liblvm 'get' functions.
  2009-05-11 13:01                                       ` [PATCH 20/30] Update vgfree_disp " Dave Wysochanski
@ 2009-05-11 13:01                                         ` Dave Wysochanski
  2009-05-11 13:01                                           ` [PATCH 22/30] Update lvcount_disp to call liblvm 'get' function Dave Wysochanski
  0 siblings, 1 reply; 32+ messages in thread
From: Dave Wysochanski @ 2009-05-11 13:01 UTC (permalink / raw)
  To: lvm-devel

Add new 'disp' functions for vg fields vg_extent_size, vg_extent_count,
vg_free_count, max_lv, max_pv, and pv_count.  Call into liblvm 'get'
functions to get the value (Note - the liblvm functions were some of
the autogenerated ones with simple pointer dereferences).

Move uint32_disp() higher in the report.c file so it can be called from
the new 'disp' functions.

Should be no functional change.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
---
 lib/report/columns.h |   12 +++---
 lib/report/report.c  |   86 +++++++++++++++++++++++++++++++++++++++++++++----
 2 files changed, 85 insertions(+), 13 deletions(-)

diff --git a/lib/report/columns.h b/lib/report/columns.h
index f8d3516..398ff81 100644
--- a/lib/report/columns.h
+++ b/lib/report/columns.h
@@ -101,12 +101,12 @@ FIELD(VGS, vg, STR, "Attr", cmd, 5, vgstatus, "vg_attr", "Various attributes - s
 FIELD(VGS, vg, NUM, "VSize", cmd, 5, vgsize, "vg_size", "Total size of VG in current units.")
 FIELD(VGS, vg, NUM, "VFree", cmd, 5, vgfree, "vg_free", "Total amount of free space in current units.")
 FIELD(VGS, vg, STR, "SYS ID", system_id, 6, string, "vg_sysid", "System ID indicating when and where it was created.")
-FIELD(VGS, vg, NUM, "Ext", extent_size, 3, size32, "vg_extent_size", "Size of Physical Extents in current units.")
-FIELD(VGS, vg, NUM, "#Ext", extent_count, 4, uint32, "vg_extent_count", "Total number of Physical Extents.")
-FIELD(VGS, vg, NUM, "Free", free_count, 4, uint32, "vg_free_count", "Total number of unallocated Physical Extents.")
-FIELD(VGS, vg, NUM, "MaxLV", max_lv, 5, uint32, "max_lv", "Maximum number of LVs allowed in VG or 0 if unlimited.")
-FIELD(VGS, vg, NUM, "MaxPV", max_pv, 5, uint32, "max_pv", "Maximum number of PVs allowed in VG or 0 if unlimited.")
-FIELD(VGS, vg, NUM, "#PV", pv_count, 3, uint32, "pv_count", "Number of PVs.")
+FIELD(VGS, vg, NUM, "Ext", cmd, 3, vgextentsize, "vg_extent_size", "Size of Physical Extents in current units.")
+FIELD(VGS, vg, NUM, "#Ext", cmd, 4, vgextentcount, "vg_extent_count", "Total number of Physical Extents.")
+FIELD(VGS, vg, NUM, "Free", cmd, 4, vgfreecount, "vg_free_count", "Total number of unallocated Physical Extents.")
+FIELD(VGS, vg, NUM, "MaxLV", cmd, 5, vgmaxlv, "max_lv", "Maximum number of LVs allowed in VG or 0 if unlimited.")
+FIELD(VGS, vg, NUM, "MaxPV", cmd, 5, vgmaxpv, "max_pv", "Maximum number of PVs allowed in VG or 0 if unlimited.")
+FIELD(VGS, vg, NUM, "#PV", cmd, 3, vgpvcount, "pv_count", "Number of PVs.")
 FIELD(VGS, vg, NUM, "#LV", cmd, 3, lvcount, "lv_count", "Number of LVs.")
 FIELD(VGS, vg, NUM, "#SN", snapshot_count, 3, uint32, "snap_count", "Number of snapshots.")
 FIELD(VGS, vg, NUM, "Seq", seqno, 3, uint32, "vg_seqno", "Revision number of internal metadata.  Incremented whenever it changes.")
diff --git a/lib/report/report.c b/lib/report/report.c
index 2d03e11..2bd0886 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -635,6 +635,13 @@ static int _size32_disp(struct dm_report *rh __attribute((unused)), struct dm_po
 	return 1;
 }
 
+static int _uint32_disp(struct dm_report *rh, struct dm_pool *mem __attribute((unused)),
+			struct dm_report_field *field,
+			const void *data, void *private __attribute((unused)))
+{
+	return dm_report_field_uint32(rh, field, data);
+}
+
 static int _size64_disp(struct dm_report *rh __attribute((unused)),
 			struct dm_pool *mem,
 			struct dm_report_field *field,
@@ -870,6 +877,78 @@ static int _devsize_disp(struct dm_report *rh, struct dm_pool *mem,
 	return _size64_disp(rh, mem, field, &size, private);
 }
 
+static int _vgextentsize_disp(struct dm_report *rh, struct dm_pool *mem,
+			      struct dm_report_field *field,
+			      const void *data, void *private)
+{
+	const struct volume_group *vg = (const struct volume_group *) data;
+	uint32_t value;
+
+	value = lvm_vg_get_extent_size(vg);
+
+	return _size32_disp(rh, mem, field, &value, private);
+}
+
+static int _vgextentcount_disp(struct dm_report *rh, struct dm_pool *mem,
+			       struct dm_report_field *field,
+			       const void *data, void *private)
+{
+	const struct volume_group *vg = (const struct volume_group *) data;
+	uint32_t value;
+
+	value = lvm_vg_get_extent_count(vg);
+
+	return _uint32_disp(rh, mem, field, &value, private);
+}
+
+static int _vgfreecount_disp(struct dm_report *rh, struct dm_pool *mem,
+			     struct dm_report_field *field,
+			     const void *data, void *private)
+{
+	const struct volume_group *vg = (const struct volume_group *) data;
+	uint32_t value;
+
+	value = lvm_vg_get_free_count(vg);
+
+	return _uint32_disp(rh, mem, field, &value, private);
+}
+
+static int _vgmaxlv_disp(struct dm_report *rh, struct dm_pool *mem,
+			 struct dm_report_field *field,
+			 const void *data, void *private)
+{
+	const struct volume_group *vg = (const struct volume_group *) data;
+	uint32_t value;
+
+	value = lvm_vg_get_max_lv(vg);
+
+	return _uint32_disp(rh, mem, field, &value, private);
+}
+
+static int _vgmaxpv_disp(struct dm_report *rh, struct dm_pool *mem,
+			       struct dm_report_field *field,
+			       const void *data, void *private)
+{
+	const struct volume_group *vg = (const struct volume_group *) data;
+	uint32_t value;
+
+	value = lvm_vg_get_max_pv(vg);
+
+	return _uint32_disp(rh, mem, field, &value, private);
+}
+
+static int _vgpvcount_disp(struct dm_report *rh, struct dm_pool *mem,
+			   struct dm_report_field *field,
+			   const void *data, void *private)
+{
+	const struct volume_group *vg = (const struct volume_group *) data;
+	uint32_t value;
+
+	value = lvm_vg_get_pv_count(vg);
+
+	return _uint32_disp(rh, mem, field, &value, private);
+}
+
 static int _vgfree_disp(struct dm_report *rh, struct dm_pool *mem,
 			struct dm_report_field *field,
 			const void *data, void *private)
@@ -900,13 +979,6 @@ static int _uuid_disp(struct dm_report *rh __attribute((unused)), struct dm_pool
 	return 1;
 }
 
-static int _uint32_disp(struct dm_report *rh, struct dm_pool *mem __attribute((unused)),
-			struct dm_report_field *field,
-			const void *data, void *private __attribute((unused)))
-{
-	return dm_report_field_uint32(rh, field, data);
-}
-
 static int _pvmdas_disp(struct dm_report *rh, struct dm_pool *mem,
 			struct dm_report_field *field,
 			const void *data, void *private)
-- 
1.6.0.6



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 22/30] Update lvcount_disp to call liblvm 'get' function.
  2009-05-11 13:01                                         ` [PATCH 21/30] Update a few simple vg 'NUM' fields to call liblvm 'get' functions Dave Wysochanski
@ 2009-05-11 13:01                                           ` Dave Wysochanski
  2009-05-11 13:01                                             ` [PATCH 23/30] Update vg_snap_count and vg_seqno display functions to call liblvm 'get' Dave Wysochanski
  0 siblings, 1 reply; 32+ messages in thread
From: Dave Wysochanski @ 2009-05-11 13:01 UTC (permalink / raw)
  To: lvm-devel

Should be no functional change.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
---
 lib/report/lvm_object_prop.c |    3 +--
 lib/report/report.c          |    2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/lib/report/lvm_object_prop.c b/lib/report/lvm_object_prop.c
index e04318e..69a32fa 100644
--- a/lib/report/lvm_object_prop.c
+++ b/lib/report/lvm_object_prop.c
@@ -756,8 +756,7 @@ int lvm_vg_set_pv_count(vg_t *vg, const uint64_t value)
  */
 uint64_t lvm_vg_get_lv_count(const vg_t *vg)
 {
-	/* FIXME: implement function body */
-	return 0;
+	return displayable_lvs_in_vg(vg);
 }
 int lvm_vg_set_lv_count(vg_t *vg, const uint64_t value)
 {
diff --git a/lib/report/report.c b/lib/report/report.c
index 2bd0886..447ab24 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -1068,7 +1068,7 @@ static int _lvcount_disp(struct dm_report *rh, struct dm_pool *mem,
 	const struct volume_group *vg = (const struct volume_group *) data;
 	uint32_t count;
 
-	count = displayable_lvs_in_vg(vg);	
+	count = lvm_vg_get_lv_count(vg);
 
 	return _uint32_disp(rh, mem, field, &count, private);
 }
-- 
1.6.0.6



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 23/30] Update vg_snap_count and vg_seqno display functions to call liblvm 'get'.
  2009-05-11 13:01                                           ` [PATCH 22/30] Update lvcount_disp to call liblvm 'get' function Dave Wysochanski
@ 2009-05-11 13:01                                             ` Dave Wysochanski
  2009-05-11 13:01                                               ` [PATCH 24/30] Update vgmdas_disp to call liblvm 'get' function Dave Wysochanski
  0 siblings, 1 reply; 32+ messages in thread
From: Dave Wysochanski @ 2009-05-11 13:01 UTC (permalink / raw)
  To: lvm-devel

Note that vg_snap_count and vg_seqno field values are obtained from a simple
dereference of the vg.  The liblvm 'get' functions do not show up in this
patch as they were generated by an earlier patch.

Should be no functional change.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
---
 lib/report/columns.h |    4 ++--
 lib/report/report.c  |   24 ++++++++++++++++++++++++
 2 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/lib/report/columns.h b/lib/report/columns.h
index 398ff81..4cbb716 100644
--- a/lib/report/columns.h
+++ b/lib/report/columns.h
@@ -108,8 +108,8 @@ FIELD(VGS, vg, NUM, "MaxLV", cmd, 5, vgmaxlv, "max_lv", "Maximum number of LVs a
 FIELD(VGS, vg, NUM, "MaxPV", cmd, 5, vgmaxpv, "max_pv", "Maximum number of PVs allowed in VG or 0 if unlimited.")
 FIELD(VGS, vg, NUM, "#PV", cmd, 3, vgpvcount, "pv_count", "Number of PVs.")
 FIELD(VGS, vg, NUM, "#LV", cmd, 3, lvcount, "lv_count", "Number of LVs.")
-FIELD(VGS, vg, NUM, "#SN", snapshot_count, 3, uint32, "snap_count", "Number of snapshots.")
-FIELD(VGS, vg, NUM, "Seq", seqno, 3, uint32, "vg_seqno", "Revision number of internal metadata.  Incremented whenever it changes.")
+FIELD(VGS, vg, NUM, "#SN", cmd, 3, vgsnapcount, "snap_count", "Number of snapshots.")
+FIELD(VGS, vg, NUM, "Seq", cmd, 3, vgseqno, "vg_seqno", "Revision number of internal metadata.  Incremented whenever it changes.")
 FIELD(VGS, vg, STR, "VG Tags", tags, 7, tags, "vg_tags", "Tags, if any.")
 FIELD(VGS, vg, NUM, "#VMda", cmd, 5, vgmdas, "vg_mda_count", "Number of metadata areas in use by this VG.")
 FIELD(VGS, vg, NUM, "VMdaFree", cmd, 9, vgmdafree, "vg_mda_free", "Free metadata area space for this VG in current units.")
diff --git a/lib/report/report.c b/lib/report/report.c
index 447ab24..e0d81d5 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -949,6 +949,30 @@ static int _vgpvcount_disp(struct dm_report *rh, struct dm_pool *mem,
 	return _uint32_disp(rh, mem, field, &value, private);
 }
 
+static int _vgsnapcount_disp(struct dm_report *rh, struct dm_pool *mem,
+			     struct dm_report_field *field,
+			     const void *data, void *private)
+{
+	const struct volume_group *vg = (const struct volume_group *) data;
+	uint32_t value;
+
+	value = lvm_vg_get_snap_count(vg);
+
+	return _uint32_disp(rh, mem, field, &value, private);
+}
+
+static int _vgseqno_disp(struct dm_report *rh, struct dm_pool *mem,
+			 struct dm_report_field *field,
+			 const void *data, void *private)
+{
+	const struct volume_group *vg = (const struct volume_group *) data;
+	uint32_t value;
+
+	value = lvm_vg_get_seqno(vg);
+
+	return _uint32_disp(rh, mem, field, &value, private);
+}
+
 static int _vgfree_disp(struct dm_report *rh, struct dm_pool *mem,
 			struct dm_report_field *field,
 			const void *data, void *private)
-- 
1.6.0.6



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 24/30] Update vgmdas_disp to call liblvm 'get' function.
  2009-05-11 13:01                                             ` [PATCH 23/30] Update vg_snap_count and vg_seqno display functions to call liblvm 'get' Dave Wysochanski
@ 2009-05-11 13:01                                               ` Dave Wysochanski
  2009-05-11 13:01                                                 ` [PATCH 25/30] Update vgmdafree_disp " Dave Wysochanski
  0 siblings, 1 reply; 32+ messages in thread
From: Dave Wysochanski @ 2009-05-11 13:01 UTC (permalink / raw)
  To: lvm-devel

No functional change.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
---
 lib/report/lvm_object_prop.c |    3 +--
 lib/report/report.c          |    2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/lib/report/lvm_object_prop.c b/lib/report/lvm_object_prop.c
index 69a32fa..3d14ecf 100644
--- a/lib/report/lvm_object_prop.c
+++ b/lib/report/lvm_object_prop.c
@@ -809,8 +809,7 @@ int lvm_vg_set_tags(vg_t *vg, const char *value)
  */
 uint64_t lvm_vg_get_mda_count(const vg_t *vg)
 {
-	/* FIXME: implement function body */
-	return 0;
+	return dm_list_size(&vg->fid->metadata_areas);
 }
 int lvm_vg_set_mda_count(vg_t *vg, const uint64_t value)
 {
diff --git a/lib/report/report.c b/lib/report/report.c
index e0d81d5..52b800e 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -1022,7 +1022,7 @@ static int _vgmdas_disp(struct dm_report *rh, struct dm_pool *mem,
 	const struct volume_group *vg = (const struct volume_group *) data;
 	uint32_t count;
 
-	count = dm_list_size(&vg->fid->metadata_areas);
+	count = lvm_vg_get_mda_count(vg);
 
 	return _uint32_disp(rh, mem, field, &count, private);
 }
-- 
1.6.0.6



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 25/30] Update vgmdafree_disp to call liblvm 'get' function.
  2009-05-11 13:01                                               ` [PATCH 24/30] Update vgmdas_disp to call liblvm 'get' function Dave Wysochanski
@ 2009-05-11 13:01                                                 ` Dave Wysochanski
  2009-05-11 13:01                                                   ` [PATCH 26/30] Update a few lvseg field display functions to call liblvm 'get' functions Dave Wysochanski
  0 siblings, 1 reply; 32+ messages in thread
From: Dave Wysochanski @ 2009-05-11 13:01 UTC (permalink / raw)
  To: lvm-devel


Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
---
 lib/report/lvm_object_prop.c |   16 ++++++++++++++--
 lib/report/report.c          |   14 ++------------
 2 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/lib/report/lvm_object_prop.c b/lib/report/lvm_object_prop.c
index 3d14ecf..63b742f 100644
--- a/lib/report/lvm_object_prop.c
+++ b/lib/report/lvm_object_prop.c
@@ -822,8 +822,20 @@ int lvm_vg_set_mda_count(vg_t *vg, const uint64_t value)
  */
 uint64_t lvm_vg_get_mda_free(const vg_t *vg)
 {
-	/* FIXME: implement function body */
-	return 0;
+	uint64_t freespace = UINT64_MAX, mda_free;
+	struct metadata_area *mda;
+
+	dm_list_iterate_items(mda, &vg->fid->metadata_areas) {
+		if (!mda->ops->mda_free_sectors)
+			continue;
+		mda_free = mda->ops->mda_free_sectors(mda);
+		if (mda_free < freespace)
+			freespace = mda_free;
+	}
+
+	if (freespace == UINT64_MAX)
+		freespace = UINT64_C(0);
+	return freespace;
 }
 int lvm_vg_set_mda_free(vg_t *vg, const uint64_t value)
 {
diff --git a/lib/report/report.c b/lib/report/report.c
index 52b800e..c9deba3 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -1068,19 +1068,9 @@ static int _vgmdafree_disp(struct dm_report *rh, struct dm_pool *mem,
 			   const void *data, void *private)
 {
 	const struct volume_group *vg = (const struct volume_group *) data;
-	uint64_t freespace = UINT64_MAX, mda_free;
-	struct metadata_area *mda;
-
-	dm_list_iterate_items(mda, &vg->fid->metadata_areas) {
-		if (!mda->ops->mda_free_sectors)
-			continue;
-		mda_free = mda->ops->mda_free_sectors(mda);
-		if (mda_free < freespace)
-			freespace = mda_free;
-	}
+	uint64_t freespace;
 
-	if (freespace == UINT64_MAX)
-		freespace = UINT64_C(0);
+	freespace = lvm_vg_get_mda_free(vg);
 
 	return _size64_disp(rh, mem, field, &freespace, private);
 }
-- 
1.6.0.6



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 26/30] Update a few lvseg field display functions to call liblvm 'get' functions.
  2009-05-11 13:01                                                 ` [PATCH 25/30] Update vgmdafree_disp " Dave Wysochanski
@ 2009-05-11 13:01                                                   ` Dave Wysochanski
  2009-05-11 13:01                                                     ` [PATCH 27/30] Update chunksize_disp to call liblvm 'get' function Dave Wysochanski
  0 siblings, 1 reply; 32+ messages in thread
From: Dave Wysochanski @ 2009-05-11 13:01 UTC (permalink / raw)
  To: lvm-devel

Update stripes, stripe_size, and region_size to call liblvm 'get' functions.
These functions are simple dereferences, so we adjust the data pointer arg
to the FIELD macro so that we get the lv_segment pointer in the 'data' arg
of the 'disp' functions.  Note that the liblvm 'get' functions do not show
up in this patch - this is because 'get' functions with simple dereferences
were autogenerated in an earlier patch.

Should be no functional change.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
---
 lib/report/columns.h |   10 +++++-----
 lib/report/report.c  |   36 ++++++++++++++++++++++++++++++++++++
 2 files changed, 41 insertions(+), 5 deletions(-)

diff --git a/lib/report/columns.h b/lib/report/columns.h
index 4cbb716..c4463cf 100644
--- a/lib/report/columns.h
+++ b/lib/report/columns.h
@@ -116,11 +116,11 @@ FIELD(VGS, vg, NUM, "VMdaFree", cmd, 9, vgmdafree, "vg_mda_free", "Free metadata
 FIELD(VGS, vg, NUM, "VMdaSize", cmd, 9, vgmdasize, "vg_mda_size", "Size of smallest metadata area for this VG in current units.")
 
 FIELD(SEGS, seg, STR, "Type", list, 4, segtype, "segtype", "Type of LV segment.")
-FIELD(SEGS, seg, NUM, "#Str", area_count, 4, uint32, "stripes", "Number of stripes or mirror legs.")
-FIELD(SEGS, seg, NUM, "Stripe", stripe_size, 6, size32, "stripesize", "For stripes, amount of data placed on one device before switching to the next.")
-FIELD(SEGS, seg, NUM, "Stripe", stripe_size, 6, size32, "stripe_size", "For stripes, amount of data placed on one device before switching to the next.")
-FIELD(SEGS, seg, NUM, "Region", region_size, 6, size32, "regionsize", "For mirrors, the unit of data copied when synchronising devices.")
-FIELD(SEGS, seg, NUM, "Region", region_size, 6, size32, "region_size", "For mirrors, the unit of data copied when synchronising devices.")
+FIELD(SEGS, seg, NUM, "#Str", list, 4, stripes, "stripes", "Number of stripes or mirror legs.")
+FIELD(SEGS, seg, NUM, "Stripe", list, 6, stripesize, "stripesize", "For stripes, amount of data placed on one device before switching to the next.")
+FIELD(SEGS, seg, NUM, "Stripe", list, 6, stripesize, "stripe_size", "For stripes, amount of data placed on one device before switching to the next.")
+FIELD(SEGS, seg, NUM, "Region", list, 6, regionsize, "regionsize", "For mirrors, the unit of data copied when synchronising devices.")
+FIELD(SEGS, seg, NUM, "Region", list, 6, regionsize, "region_size", "For mirrors, the unit of data copied when synchronising devices.")
 FIELD(SEGS, seg, NUM, "Chunk", list, 5, chunksize, "chunksize", "For snapshots, the unit of data used when tracking changes.")
 FIELD(SEGS, seg, NUM, "Chunk", list, 5, chunksize, "chunk_size", "For snapshots, the unit of data used when tracking changes.")
 FIELD(SEGS, seg, NUM, "Start", list, 5, segstart, "seg_start", "Offset within the LV to the start of the segment in current units.")
diff --git a/lib/report/report.c b/lib/report/report.c
index c9deba3..e74dd1a 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -760,6 +760,42 @@ static int _segsize_disp(struct dm_report *rh, struct dm_pool *mem,
 	return _size64_disp(rh, mem, field, &size, private);
 }
 
+static int _stripes_disp(struct dm_report *rh, struct dm_pool *mem,
+			 struct dm_report_field *field,
+			 const void *data, void *private)
+{
+	const struct lv_segment *seg = (const struct lv_segment *) data;
+	uint32_t value;
+
+	value = lvm_lvseg_get_stripes(seg);
+
+	return _uint32_disp(rh, mem, field, &value, private);
+}
+
+static int _stripesize_disp(struct dm_report *rh, struct dm_pool *mem,
+			    struct dm_report_field *field,
+			    const void *data, void *private)
+{
+	const struct lv_segment *seg = (const struct lv_segment *) data;
+	uint32_t size;
+
+	size = lvm_lvseg_get_stripe_size(seg);
+
+	return _size32_disp(rh, mem, field, &size, private);
+}
+
+static int _regionsize_disp(struct dm_report *rh, struct dm_pool *mem,
+			    struct dm_report_field *field,
+			    const void *data, void *private)
+{
+	const struct lv_segment *seg = (const struct lv_segment *) data;
+	uint32_t size;
+
+	size = lvm_lvseg_get_region_size(seg);
+
+	return _size32_disp(rh, mem, field, &size, private);
+}
+
 static int _chunksize_disp(struct dm_report *rh, struct dm_pool *mem,
 			   struct dm_report_field *field,
 			   const void *data, void *private)
-- 
1.6.0.6



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 27/30] Update chunksize_disp to call liblvm 'get' function.
  2009-05-11 13:01                                                   ` [PATCH 26/30] Update a few lvseg field display functions to call liblvm 'get' functions Dave Wysochanski
@ 2009-05-11 13:01                                                     ` Dave Wysochanski
  2009-05-11 13:01                                                       ` [PATCH 28/30] Update segstart_disp and segstartpe_disp to call liblvm 'get' functions Dave Wysochanski
  0 siblings, 1 reply; 32+ messages in thread
From: Dave Wysochanski @ 2009-05-11 13:01 UTC (permalink / raw)
  To: lvm-devel

Should be no functional change.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
---
 lib/report/lvm_object_prop.c |    8 ++++++--
 lib/report/report.c          |    5 +----
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/lib/report/lvm_object_prop.c b/lib/report/lvm_object_prop.c
index 63b742f..6a35122 100644
--- a/lib/report/lvm_object_prop.c
+++ b/lib/report/lvm_object_prop.c
@@ -914,8 +914,12 @@ int lvm_lvseg_set_region_size(lvseg_t *lvseg, const uint64_t value)
  */
 uint64_t lvm_lvseg_get_chunk_size(const lvseg_t *lvseg)
 {
-	/* FIXME: implement function body */
-	return 0;
+	uint64_t size;
+	if (lv_is_cow(lvseg->lv))
+		size = (uint64_t) find_cow(lvseg->lv)->chunk_size;
+	else
+		size = UINT64_C(0);
+	return size;
 }
 int lvm_lvseg_set_chunk_size(lvseg_t *lvseg, const uint64_t value)
 {
diff --git a/lib/report/report.c b/lib/report/report.c
index e74dd1a..ece83df 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -803,10 +803,7 @@ static int _chunksize_disp(struct dm_report *rh, struct dm_pool *mem,
 	const struct lv_segment *seg = (const struct lv_segment *) data;
 	uint64_t size;
 
-	if (lv_is_cow(seg->lv))
-		size = (uint64_t) find_cow(seg->lv)->chunk_size;
-	else
-		size = UINT64_C(0);
+	size = lvm_lvseg_get_chunk_size(seg);
 
 	return _size64_disp(rh, mem, field, &size, private);
 }
-- 
1.6.0.6



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 28/30] Update segstart_disp and segstartpe_disp to call liblvm 'get' functions.
  2009-05-11 13:01                                                     ` [PATCH 27/30] Update chunksize_disp to call liblvm 'get' function Dave Wysochanski
@ 2009-05-11 13:01                                                       ` Dave Wysochanski
  2009-05-11 13:01                                                         ` [PATCH 29/30] Update segsize_disp to call liblvm 'get' function Dave Wysochanski
  0 siblings, 1 reply; 32+ messages in thread
From: Dave Wysochanski @ 2009-05-11 13:01 UTC (permalink / raw)
  To: lvm-devel

Should be no functional change.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
---
 lib/report/lvm_object_prop.c |    6 ++----
 lib/report/report.c          |    7 +++++--
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/lib/report/lvm_object_prop.c b/lib/report/lvm_object_prop.c
index 6a35122..dc80752 100644
--- a/lib/report/lvm_object_prop.c
+++ b/lib/report/lvm_object_prop.c
@@ -932,8 +932,7 @@ int lvm_lvseg_set_chunk_size(lvseg_t *lvseg, const uint64_t value)
  */
 uint64_t lvm_lvseg_get_start(const lvseg_t *lvseg)
 {
-	/* FIXME: implement function body */
-	return 0;
+	return (uint64_t) lvseg->le * lvseg->lv->vg->extent_size;
 }
 int lvm_lvseg_set_start(lvseg_t *lvseg, const uint64_t value)
 {
@@ -946,8 +945,7 @@ int lvm_lvseg_set_start(lvseg_t *lvseg, const uint64_t value)
  */
 uint64_t lvm_lvseg_get_start_pe(const lvseg_t *lvseg)
 {
-	/* FIXME: implement function body */
-	return 0;
+	return lvseg->le;
 }
 int lvm_lvseg_set_start_pe(lvseg_t *lvseg, const uint64_t value)
 {
diff --git a/lib/report/report.c b/lib/report/report.c
index ece83df..b59e6a1 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -732,7 +732,7 @@ static int _segstart_disp(struct dm_report *rh, struct dm_pool *mem,
 	const struct lv_segment *seg = (const struct lv_segment *) data;
 	uint64_t start;
 
-	start = (uint64_t) seg->le * seg->lv->vg->extent_size;
+	start = lvm_lvseg_get_start(seg);
 
 	return _size64_disp(rh, mem, field, &start, private);
 }
@@ -744,8 +744,11 @@ static int _segstartpe_disp(struct dm_report *rh,
 			    void *private __attribute((unused)))
 {
 	const struct lv_segment *seg = (const struct lv_segment *) data;
+	uint32_t start;
 
-	return dm_report_field_uint32(rh, field, &seg->le);
+	start = lvm_lvseg_get_start_pe(seg);
+
+	return dm_report_field_uint32(rh, field, &start);
 }
 
 static int _segsize_disp(struct dm_report *rh, struct dm_pool *mem,
-- 
1.6.0.6



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 29/30] Update segsize_disp to call liblvm 'get' function.
  2009-05-11 13:01                                                       ` [PATCH 28/30] Update segstart_disp and segstartpe_disp to call liblvm 'get' functions Dave Wysochanski
@ 2009-05-11 13:01                                                         ` Dave Wysochanski
  2009-05-11 13:01                                                           ` [PATCH 30/30] Update pvseg_start and pvseg_size fields to have a disp function calling liblvm Dave Wysochanski
  0 siblings, 1 reply; 32+ messages in thread
From: Dave Wysochanski @ 2009-05-11 13:01 UTC (permalink / raw)
  To: lvm-devel

No functional change.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
---
 lib/report/lvm_object_prop.c |    3 +--
 lib/report/report.c          |    2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/lib/report/lvm_object_prop.c b/lib/report/lvm_object_prop.c
index dc80752..1bda95b 100644
--- a/lib/report/lvm_object_prop.c
+++ b/lib/report/lvm_object_prop.c
@@ -958,8 +958,7 @@ int lvm_lvseg_set_start_pe(lvseg_t *lvseg, const uint64_t value)
  */
 uint64_t lvm_lvseg_get_size(const lvseg_t *lvseg)
 {
-	/* FIXME: implement function body */
-	return 0;
+	return (uint64_t) lvseg->len * lvseg->lv->vg->extent_size;
 }
 int lvm_lvseg_set_size(lvseg_t *lvseg, const uint64_t value)
 {
diff --git a/lib/report/report.c b/lib/report/report.c
index b59e6a1..e91cef2 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -758,7 +758,7 @@ static int _segsize_disp(struct dm_report *rh, struct dm_pool *mem,
 	const struct lv_segment *seg = (const struct lv_segment *) data;
 	uint64_t size;
 
-	size = (uint64_t) seg->len * seg->lv->vg->extent_size;
+	size = lvm_lvseg_get_size(seg);
 
 	return _size64_disp(rh, mem, field, &size, private);
 }
-- 
1.6.0.6



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 30/30] Update pvseg_start and pvseg_size fields to have a disp function calling liblvm
  2009-05-11 13:01                                                         ` [PATCH 29/30] Update segsize_disp to call liblvm 'get' function Dave Wysochanski
@ 2009-05-11 13:01                                                           ` Dave Wysochanski
  0 siblings, 0 replies; 32+ messages in thread
From: Dave Wysochanski @ 2009-05-11 13:01 UTC (permalink / raw)
  To: lvm-devel

Call into liblvm 'get' functions from 'disp' functions.
Note that the 'get' functions were some of the simple ones autogenerated
by the perl script in an earlier patch.

Should be no functional change.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
---
 lib/report/columns.h |    4 ++--
 lib/report/report.c  |   24 ++++++++++++++++++++++++
 2 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/lib/report/columns.h b/lib/report/columns.h
index c4463cf..c3ae040 100644
--- a/lib/report/columns.h
+++ b/lib/report/columns.h
@@ -130,6 +130,6 @@ FIELD(SEGS, seg, STR, "Seg Tags", tags, 8, tags, "seg_tags", "Tags, if any.")
 FIELD(SEGS, seg, STR, "PE Ranges", list, 9, peranges, "seg_pe_ranges", "Ranges of Physical Extents of underlying devices in command line format.")
 FIELD(SEGS, seg, STR, "Devices", list, 7, devices, "devices", "Underlying devices used with starting extent numbers.")
 
-FIELD(PVSEGS, pvseg, NUM, "Start", pe, 5, uint32, "pvseg_start", "Physical Extent number of start of segment.")
-FIELD(PVSEGS, pvseg, NUM, "SSize", len, 5, uint32, "pvseg_size", "Number of extents in segment.")
+FIELD(PVSEGS, pvseg, NUM, "Start", list, 5, pvsegstart, "pvseg_start", "Physical Extent number of start of segment.")
+FIELD(PVSEGS, pvseg, NUM, "SSize", list, 5, pvsegsize, "pvseg_size", "Number of extents in segment.")
 /* *INDENT-ON* */
diff --git a/lib/report/report.c b/lib/report/report.c
index e91cef2..968c798 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -811,6 +811,30 @@ static int _chunksize_disp(struct dm_report *rh, struct dm_pool *mem,
 	return _size64_disp(rh, mem, field, &size, private);
 }
 
+static int _pvsegstart_disp(struct dm_report *rh, struct dm_pool *mem,
+			    struct dm_report_field *field,
+			    const void *data, void *private)
+{
+	const struct pv_segment *pvseg = (const struct pv_segment *) data;
+	uint32_t start;
+
+	start = lvm_pvseg_get_start(pvseg);
+
+	return _uint32_disp(rh, mem, field, &start, private);
+}
+
+static int _pvsegsize_disp(struct dm_report *rh, struct dm_pool *mem,
+			   struct dm_report_field *field,
+			   const void *data, void *private)
+{
+	const struct pv_segment *pvseg = (const struct pv_segment *) data;
+	uint32_t value;
+
+	value = lvm_pvseg_get_size(pvseg);
+
+	return _uint32_disp(rh, mem, field, &value, private);
+}
+
 static int _originsize_disp(struct dm_report *rh, struct dm_pool *mem,
 			    struct dm_report_field *field,
 			    const void *data, void *private)
-- 
1.6.0.6



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 0/30]: liblvm object property baseline, take2
  2009-05-11 13:01 [PATCH 0/30]: liblvm object property baseline, take2 Dave Wysochanski
  2009-05-11 13:01 ` [PATCH 01/30] Define handles to liblvm objects for pv, vg, lv, lvseg, pvseg Dave Wysochanski
@ 2009-05-14  3:33 ` Dave Wysochanski
  1 sibling, 0 replies; 32+ messages in thread
From: Dave Wysochanski @ 2009-05-14  3:33 UTC (permalink / raw)
  To: lvm-devel

FYI - I have these patches rebased to Milan's latest lv / snapshot
counting patches (nice cleanup Milan!).  I won't spam the list but if
anyone wants them just let me know.

The new patches now apply on:
commit dc205333cd46770e5ca1a390a6b8fef1f584939a
Author: Milan Broz <mbroz@redhat.com>
Date:   Wed May 13 21:29:10 2009 +0000

    Check max_lv on only place and force the check only for new volume.





^ permalink raw reply	[flat|nested] 32+ messages in thread

end of thread, other threads:[~2009-05-14  3:33 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-11 13:01 [PATCH 0/30]: liblvm object property baseline, take2 Dave Wysochanski
2009-05-11 13:01 ` [PATCH 01/30] Define handles to liblvm objects for pv, vg, lv, lvseg, pvseg Dave Wysochanski
2009-05-11 13:01   ` [PATCH 02/30] Add lvm_object_prop.pl to generate liblvm object property functions Dave Wysochanski
2009-05-11 13:01     ` [PATCH 03/30] Add generated files, lvm_object_prop.[ch], to lib/report directory and build Dave Wysochanski
2009-05-11 13:01       ` [PATCH 04/30] Update vg_size 'disp' function to call liblvm 'get' function Dave Wysochanski
2009-05-11 13:01         ` [PATCH 05/30] Modify lv_major and lv_minor fields to call liblvm 'get' functions Dave Wysochanski
2009-05-11 13:01           ` [PATCH 06/30] Update lvreadahead_disp to call liblvm 'get' function Dave Wysochanski
2009-05-11 13:01             ` [PATCH 07/30] Update lvkreadhead_disp " Dave Wysochanski
2009-05-11 13:01               ` [PATCH 08/30] Update lv_size field - create lvsize_disp() and " Dave Wysochanski
2009-05-11 13:01                 ` [PATCH 09/30] Update lvsegcount_disp() to " Dave Wysochanski
2009-05-11 13:01                   ` [PATCH 10/30] Update originsize_disp() " Dave Wysochanski
2009-05-11 13:01                     ` [PATCH 11/30] Update devsize_disp() " Dave Wysochanski
2009-05-11 13:01                       ` [PATCH 12/30] Update pvmdafree_disp() " Dave Wysochanski
2009-05-11 13:01                         ` [PATCH 13/30] Update pvmdasize_disp and vgmdasize_disp " Dave Wysochanski
2009-05-11 13:01                           ` [PATCH 14/30] Update pe_start field - create pestart_disp which calls " Dave Wysochanski
2009-05-11 13:01                             ` [PATCH 15/30] Update pvsize_disp to call " Dave Wysochanski
2009-05-11 13:01                               ` [PATCH 16/30] Update pvfree_disp " Dave Wysochanski
2009-05-11 13:01                                 ` [PATCH 17/30] Update pvused_disp " Dave Wysochanski
2009-05-11 13:01                                   ` [PATCH 18/30] Update pv_pe_count and pv_pe_alloc_count fields to call liblvm 'get' functions Dave Wysochanski
2009-05-11 13:01                                     ` [PATCH 19/30] Update pvmdas_disp to call liblvm 'get' function Dave Wysochanski
2009-05-11 13:01                                       ` [PATCH 20/30] Update vgfree_disp " Dave Wysochanski
2009-05-11 13:01                                         ` [PATCH 21/30] Update a few simple vg 'NUM' fields to call liblvm 'get' functions Dave Wysochanski
2009-05-11 13:01                                           ` [PATCH 22/30] Update lvcount_disp to call liblvm 'get' function Dave Wysochanski
2009-05-11 13:01                                             ` [PATCH 23/30] Update vg_snap_count and vg_seqno display functions to call liblvm 'get' Dave Wysochanski
2009-05-11 13:01                                               ` [PATCH 24/30] Update vgmdas_disp to call liblvm 'get' function Dave Wysochanski
2009-05-11 13:01                                                 ` [PATCH 25/30] Update vgmdafree_disp " Dave Wysochanski
2009-05-11 13:01                                                   ` [PATCH 26/30] Update a few lvseg field display functions to call liblvm 'get' functions Dave Wysochanski
2009-05-11 13:01                                                     ` [PATCH 27/30] Update chunksize_disp to call liblvm 'get' function Dave Wysochanski
2009-05-11 13:01                                                       ` [PATCH 28/30] Update segstart_disp and segstartpe_disp to call liblvm 'get' functions Dave Wysochanski
2009-05-11 13:01                                                         ` [PATCH 29/30] Update segsize_disp to call liblvm 'get' function Dave Wysochanski
2009-05-11 13:01                                                           ` [PATCH 30/30] Update pvseg_start and pvseg_size fields to have a disp function calling liblvm Dave Wysochanski
2009-05-14  3:33 ` [PATCH 0/30]: liblvm object property baseline, take2 Dave 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.