Skip to contentSkip to conversation

: Make all lvm2app handle definitions consistent.

PATCH New Dave Wysochanski 1 participant 4 messages Aug 11, 2009

lore
Share & tools
lore
#0 lore raw

cover : Make all lvm2app handle definitions consistent.

Currently we have an inconsistency in handle definitions. The lvm_t handle is defined as a pointer, but the other handles, vg_t, lv_t, and pv_t are not. This patchset makes them all consistent by defining them all as pointers to internal structures.

#1 lore raw

PATCH 1/3 Make lvm2app vg_t handle definition consistent with lvm_t.

This patch update vg_t handle to be consistent with lvm_t - define as a pointer to internal struct volume_group.

---
 liblvm/lvm2app.h  |   44 ++++++++++++++++++++++----------------------
 liblvm/lvm_lv.c   |    4 ++--
 liblvm/lvm_vg.c   |   46 +++++++++++++++++++++++-----------------------
 test/api/test.c   |   30 +++++++++++++++---------------
 test/api/vgtest.c |    2 +-
 5 files changed, 63 insertions(+), 63 deletions(-)
liblvm/lvm2app.h +22 -22
index 5f82707..52616f0 100644
@@ -112,7 +112,7 @@ typedef struct lvm *lvm_t;
  * return a read-write object, but open functions have the argument mode to
  * define if the object can be modified or not.
  */
-typedef struct volume_group vg_t;
+typedef struct volume_group *vg_t;
 
 /**
  * Logical Volume object.
@@ -285,7 +285,7 @@ int lvm_scan(lvm_t libh);
  * begin with a "#" and should be filtered out and not used.
  *
  * To process the list, use the dm_list iterator functions.  For example:
- *      vg_t *vg;
+ *      vg_t vg;
  *      struct dm_list *vgnames;
  *      struct lvm_str_list *strl;
  *
@@ -350,7 +350,7 @@ struct dm_list *lvm_list_vg_uuids(lvm_t libh);
  *
  * \return  non-NULL VG handle (success) or NULL (failure).
  */
-vg_t *lvm_vg_open(lvm_t libh, const char *vgname, const char *mode,
+vg_t lvm_vg_open(lvm_t libh, const char *vgname, const char *mode,
 		  uint32_t flags);
 
 /**
@@ -374,7 +374,7 @@ vg_t *lvm_vg_open(lvm_t libh, const char *vgname, const char *mode,
  * \return
  * non-NULL vg handle (success) or NULL (failure)
  */
-vg_t *lvm_vg_create(lvm_t libh, const char *vg_name);
+vg_t lvm_vg_create(lvm_t libh, const char *vg_name);
 
  /**
  * Write a VG to disk.
@@ -389,7 +389,7 @@ vg_t *lvm_vg_create(lvm_t libh, const char *vg_name);
  * \return
  * 0 (success) or -1 (failure).
  */
-int lvm_vg_write(vg_t *vg);
+int lvm_vg_write(vg_t vg);
 
 /**
  * Remove a VG from the system.
@@ -403,7 +403,7 @@ int lvm_vg_write(vg_t *vg);
  * \return
  * 0 (success) or -1 (failure).
  */
-int lvm_vg_remove(vg_t *vg);
+int lvm_vg_remove(vg_t vg);
 
 /**
  * Close a VG opened with lvm_vg_create or lvm_vg_open.
@@ -417,7 +417,7 @@ int lvm_vg_remove(vg_t *vg);
  * \return
  * 0 (success) or -1 (failure).
  */
-int lvm_vg_close(vg_t *vg);
+int lvm_vg_close(vg_t vg);
 
 /**
  * Extend a VG by adding a device.
@@ -440,7 +440,7 @@ int lvm_vg_close(vg_t *vg);
  * \return
  * 0 (success) or -1 (failure).
  */
-int lvm_vg_extend(vg_t *vg, const char *device);
+int lvm_vg_extend(vg_t vg, const char *device);
 
 /**
  * Reduce a VG by removing an unused device.
@@ -459,7 +459,7 @@ int lvm_vg_extend(vg_t *vg, const char *device);
  * \return
  * 0 (success) or -1 (failure).
  */
-int lvm_vg_reduce(vg_t *vg, const char *device);
+int lvm_vg_reduce(vg_t vg, const char *device);
 
 /**
  * Set the extent size of a VG.
@@ -478,7 +478,7 @@ int lvm_vg_reduce(vg_t *vg, const char *device);
  * \return
  * 0 (success) or -1 (failure).
  */
-int lvm_vg_set_extent_size(vg_t *vg, uint32_t new_size);
+int lvm_vg_set_extent_size(vg_t vg, uint32_t new_size);
 
 /**
  * Get the current metadata sequence number of a volume group.
@@ -493,7 +493,7 @@ int lvm_vg_set_extent_size(vg_t *vg, uint32_t new_size);
  * \return
  * Metadata sequence number.
  */
-uint64_t lvm_vg_get_seqno(const vg_t *vg);
+uint64_t lvm_vg_get_seqno(const vg_t vg);
 
 /**
  * Get the current name of a volume group.
@@ -507,7 +507,7 @@ uint64_t lvm_vg_get_seqno(const vg_t *vg);
  * \return
  * Copy of the uuid string.
  */
-char *lvm_vg_get_uuid(const vg_t *vg);
+char *lvm_vg_get_uuid(const vg_t vg);
 
 /**
  * Get the current uuid of a volume group.
@@ -521,7 +521,7 @@ char *lvm_vg_get_uuid(const vg_t *vg);
  * \return
  * Copy of the name.
  */
-char *lvm_vg_get_name(const vg_t *vg);
+char *lvm_vg_get_name(const vg_t vg);
 
 /**
  * Get the current size in bytes of a volume group.
@@ -532,7 +532,7 @@ char *lvm_vg_get_name(const vg_t *vg);
  * \return
  * Size in bytes.
  */
-uint64_t lvm_vg_get_size(const vg_t *vg);
+uint64_t lvm_vg_get_size(const vg_t vg);
 
 /**
  * Get the current unallocated space in bytes of a volume group.
@@ -543,7 +543,7 @@ uint64_t lvm_vg_get_size(const vg_t *vg);
  * \return
  * Free size in bytes.
  */
-uint64_t lvm_vg_get_free_size(const vg_t *vg);
+uint64_t lvm_vg_get_free_size(const vg_t vg);
 
 /**
  * Get the current extent size in bytes of a volume group.
@@ -554,7 +554,7 @@ uint64_t lvm_vg_get_free_size(const vg_t *vg);
  * \return
  * Extent size in bytes.
  */
-uint64_t lvm_vg_get_extent_size(const vg_t *vg);
+uint64_t lvm_vg_get_extent_size(const vg_t vg);
 
 /**
  * Get the current number of total extents of a volume group.
@@ -565,7 +565,7 @@ uint64_t lvm_vg_get_extent_size(const vg_t *vg);
  * \return
  * Extent count.
  */
-uint64_t lvm_vg_get_extent_count(const vg_t *vg);
+uint64_t lvm_vg_get_extent_count(const vg_t vg);
 
 /**
  * Get the current number of free extents of a volume group.
@@ -576,7 +576,7 @@ uint64_t lvm_vg_get_extent_count(const vg_t *vg);
  * \return
  * Free extent count.
  */
-uint64_t lvm_vg_get_free_extent_count(const vg_t *vg);
+uint64_t lvm_vg_get_free_extent_count(const vg_t vg);
 
 /**
  * Get the current number of physical volumes of a volume group.
@@ -587,7 +587,7 @@ uint64_t lvm_vg_get_free_extent_count(const vg_t *vg);
  * \return
  * Physical volume count.
  */
-uint64_t lvm_vg_get_pv_count(const vg_t *vg);
+uint64_t lvm_vg_get_pv_count(const vg_t vg);
 
 /************************** logical volume handling *************************/
 
@@ -601,7 +601,7 @@ uint64_t lvm_vg_get_pv_count(const vg_t *vg);
  * A list of lv_list_t structures containing lv handles for this vg.
  * If no LVs exist on the given VG, NULL is returned.
  */
-struct dm_list *lvm_vg_list_lvs(vg_t *vg);
+struct dm_list *lvm_vg_list_lvs(vg_t vg);
 
 /**
  * Create a linear logical volume.
@@ -623,7 +623,7 @@ struct dm_list *lvm_vg_list_lvs(vg_t *vg);
  * non-NULL handle to an LV object created, or NULL if creation fails.
  *
  */
-lv_t *lvm_vg_create_lv_linear(vg_t *vg, const char *name, uint64_t size);
+lv_t *lvm_vg_create_lv_linear(vg_t vg, const char *name, uint64_t size);
 
 /**
  * Activate a logical volume.
@@ -767,7 +767,7 @@ int lvm_lv_resize(const lv_t *lv, uint64_t new_size);
  * A list of pv_list_t structures containing pv handles for this vg.
  * If no PVs exist on the given VG, NULL is returned.
  */
-struct dm_list *lvm_vg_list_pvs(vg_t *vg);
+struct dm_list *lvm_vg_list_pvs(vg_t vg);
 
 /**
  * Get the current uuid of a logical volume.
liblvm/lvm_lv.c +2 -2
index b06546e..86e169d 100644
@@ -70,7 +70,7 @@ uint64_t lvm_lv_is_suspended(const lv_t *lv)
 
 /* Set defaults for non-segment specific LV parameters */
 static void _lv_set_default_params(struct lvcreate_params *lp,
-				   vg_t *vg, const char *lvname,
+				   vg_t vg, const char *lvname,
 				   uint64_t extents)
 {
 	lp->zero = 1;
@@ -101,7 +101,7 @@ static void _lv_set_default_linear_params(struct cmd_context *cmd,
  * lvm_vg_write.  However, this appears to be non-trivial change until
  * lv_create_single is refactored by segtype.
  */
-lv_t *lvm_vg_create_lv_linear(vg_t *vg, const char *name, uint64_t size)
+lv_t *lvm_vg_create_lv_linear(vg_t vg, const char *name, uint64_t size)
 {
 	struct lvcreate_params lp;
 	uint64_t extents;
liblvm/lvm_vg.c +23 -23

155 lines not on this page · raw message

test/api/test.c +15 -15
index b2da3bf..65bc292 100644
@@ -152,9 +152,9 @@ static lv_t *_lookup_lv_by_name(const char *name)
 	return lv;
 }
 
-static vg_t *_lookup_vg_by_name(char **argv, int argc)
+static vg_t _lookup_vg_by_name(char **argv, int argc)
 {
-	vg_t *vg;
+	vg_t vg;
 
 	if (argc < 2) {
 		printf ("Please enter vg_name\n");
@@ -203,7 +203,7 @@ static void _add_device_to_pvname_hash(struct dm_list *pvs, const char *name)
 }
 static void _vg_reduce(char **argv, int argc, lvm_t libh)
 {
-	vg_t *vg;
+	vg_t vg;
 	struct dm_list *pvs;
 
 	if (argc < 2) {
@@ -264,7 +264,7 @@ static void _config_reload(char **argv, int argc, lvm_t libh)
 
 static void _vg_extend(char **argv, int argc, lvm_t libh)
 {
-	vg_t *vg;
+	vg_t vg;
 	struct dm_list *pvs;
 
 	if (argc < 2) {
@@ -293,7 +293,7 @@ static void _vg_extend(char **argv, int argc, lvm_t libh)
 
 static void _vg_open(char **argv, int argc, lvm_t libh)
 {
-	vg_t *vg;
+	vg_t vg;
 	struct dm_list *lvs;
 	struct dm_list *pvs;
 
@@ -330,9 +330,9 @@ static void _vg_open(char **argv, int argc, lvm_t libh)
 		_add_pvs_to_pvname_hash(pvs);
 }
 /* Lookup the vg and remove it from the vgname and vgid hashes */
-static vg_t *_lookup_and_remove_vg(const char *vgname)
+static vg_t _lookup_and_remove_vg(const char *vgname)
 {
-	vg_t *vg=NULL;
+	vg_t vg=NULL;
 
 	if ((vg = dm_hash_lookup(_vgname_hash, vgname))) {
 		dm_hash_remove(_vgid_hash, lvm_vg_get_uuid(vg));
@@ -347,7 +347,7 @@ static vg_t *_lookup_and_remove_vg(const char *vgname)
 
 static void _vg_write(char **argv, int argc)
 {
-	vg_t *vg;
+	vg_t vg;
 	int rc = 0;
 
 	if (argc < 2) {
@@ -366,7 +366,7 @@ static void _vg_write(char **argv, int argc)
 
 static void _vg_create(char **argv, int argc, lvm_t libh)
 {
-	vg_t *vg;
+	vg_t vg;
 
 	if (argc < 2) {
 		printf ("Please enter vg_name\n");
@@ -385,7 +385,7 @@ static void _vg_create(char **argv, int argc, lvm_t libh)
 
 static void _vg_remove(char **argv, int argc)
 {
-	vg_t *vg;
+	vg_t vg;
 	int rc = 0;
 
 	if (argc < 2) {
@@ -404,7 +404,7 @@ static void _vg_remove(char **argv, int argc)
 
 static void _vg_close(char **argv, int argc)
 {
-	vg_t *vg;
+	vg_t vg;
 	int rc = 0;
 
 	if (argc < 2) {
@@ -421,7 +421,7 @@ static void _vg_close(char **argv, int argc)
 	printf("closing VG\n");
 }
 
-static void _show_one_vg(vg_t *vg)
+static void _show_one_vg(vg_t vg)
 {
 	printf("%s (%s): sz=%"PRIu64", free=%"PRIu64", #pv=%"PRIu64
 		", seq#=%"PRIu64"\n",
@@ -439,7 +439,7 @@ static void _pvs_in_vg(char **argv, int argc)
 {
 	struct dm_list *pvs;
 	struct lvm_pv_list *pvl;
-	vg_t *vg;
+	vg_t vg;
 
 	if (!(vg = _lookup_vg_by_name(argv, argc)))
 		return;
@@ -494,7 +494,7 @@ static void _lvs_in_vg(char **argv, int argc)
 {
 	struct dm_list *lvs;
 	struct lvm_lv_list *lvl;
-	vg_t *vg;
+	vg_t vg;
 
 	if (!(vg = _lookup_vg_by_name(argv, argc)))
 		return;
@@ -568,7 +568,7 @@ static void _vg_remove_lv(char **argv, int argc)
 
 static void _vg_create_lv_linear(char **argv, int argc)
 {
-	vg_t *vg;
+	vg_t vg;
 	lv_t *lv;
 
 	if (argc < 4) {
test/api/vgtest.c +1 -1
index 432d5fe..8b82f39 100644
@@ -24,7 +24,7 @@
 #include "lvm2app.h"
 
 lvm_t handle;
-vg_t *vg;
+vg_t vg;
 const char *vg_name = "my_vg";
 const char *device = "/dev/loop3";
 const char *device2 = "/dev/loop4";
Signature · 1 line
1.6.0.6
#2 lore raw

PATCH 2/3 Make lvm2app lv_t handle definition consistent with lvm_t.

This patch update lv_t handle to be consistent with lvm_t - define as a pointer to internal struct logical_volume.

---
 liblvm/lvm2app.h |   24 ++++++++++++------------
 liblvm/lvm_lv.c  |   22 +++++++++++-----------
 test/api/test.c  |   12 ++++++------
 3 files changed, 29 insertions(+), 29 deletions(-)
liblvm/lvm2app.h +12 -12
index 52616f0..0d45a29 100644
@@ -121,7 +121,7 @@ typedef struct volume_group *vg_t;
  * group.  Changes will be written to disk when the volume group gets
  * committed to disk.
  */
-typedef struct logical_volume lv_t;
+typedef struct logical_volume *lv_t;
 
 /**
  * Physical volume object.
@@ -139,7 +139,7 @@ typedef struct physical_volume pv_t;
  */
 typedef struct lvm_lv_list {
 	struct dm_list list;
-	lv_t *lv;
+	lv_t lv;
 } lv_list_t;
 
 /**
@@ -623,7 +623,7 @@ struct dm_list *lvm_vg_list_lvs(vg_t vg);
  * non-NULL handle to an LV object created, or NULL if creation fails.
  *
  */
-lv_t *lvm_vg_create_lv_linear(vg_t vg, const char *name, uint64_t size);
+lv_t lvm_vg_create_lv_linear(vg_t vg, const char *name, uint64_t size);
 
 /**
  * Activate a logical volume.
@@ -639,7 +639,7 @@ lv_t *lvm_vg_create_lv_linear(vg_t vg, const char *name, uint64_t size);
  * \return
  * 0 (success) or -1 (failure).
  */
-int lvm_lv_activate(lv_t *lv);
+int lvm_lv_activate(lv_t lv);
 
 /**
  * Deactivate a logical volume.
@@ -652,7 +652,7 @@ int lvm_lv_activate(lv_t *lv);
  * \return
  * 0 (success) or -1 (failure).
  */
-int lvm_lv_deactivate(lv_t *lv);
+int lvm_lv_deactivate(lv_t lv);
 
 /**
  * Remove a logical volume from a volume group.
@@ -669,7 +669,7 @@ int lvm_lv_deactivate(lv_t *lv);
  * \return
  * 0 (success) or -1 (failure).
  */
-int lvm_vg_remove_lv(lv_t *lv);
+int lvm_vg_remove_lv(lv_t lv);
 
 /**
  * Get the current name of a logical volume.
@@ -683,7 +683,7 @@ int lvm_vg_remove_lv(lv_t *lv);
  * \return
  * Copy of the uuid string.
  */
-char *lvm_lv_get_uuid(const lv_t *lv);
+char *lvm_lv_get_uuid(const lv_t lv);
 
 /**
  * Get the current uuid of a logical volume.
@@ -697,7 +697,7 @@ char *lvm_lv_get_uuid(const lv_t *lv);
  * \return
  * Copy of the name.
  */
-char *lvm_lv_get_name(const lv_t *lv);
+char *lvm_lv_get_name(const lv_t lv);
 
 /**
  * Get the current size in bytes of a logical volume.
@@ -708,7 +708,7 @@ char *lvm_lv_get_name(const lv_t *lv);
  * \return
  * Size in bytes.
  */
-uint64_t lvm_lv_get_size(const lv_t *lv);
+uint64_t lvm_lv_get_size(const lv_t lv);
 
 /**
  * Get the current activation state of a logical volume.
@@ -719,7 +719,7 @@ uint64_t lvm_lv_get_size(const lv_t *lv);
  * \return
  * 1 if the LV is active in the kernel, 0 if not
  */
-uint64_t lvm_lv_is_active(const lv_t *lv);
+uint64_t lvm_lv_is_active(const lv_t lv);
 
 /**
  * Get the current suspended state of a logical volume.
@@ -730,7 +730,7 @@ uint64_t lvm_lv_is_active(const lv_t *lv);
  * \return
  * 1 if the LV is suspended in the kernel, 0 if not
  */
-uint64_t lvm_lv_is_suspended(const lv_t *lv);
+uint64_t lvm_lv_is_suspended(const lv_t lv);
 
 /**
  * Resize logical volume to new_size bytes.
@@ -747,7 +747,7 @@ uint64_t lvm_lv_is_suspended(const lv_t *lv);
  * 0 (success) or -1 (failure).
  *
  */
-int lvm_lv_resize(const lv_t *lv, uint64_t new_size);
+int lvm_lv_resize(const lv_t lv, uint64_t new_size);
 
 /************************** physical volume handling ************************/
 
liblvm/lvm_lv.c +11 -11
index 86e169d..d28e6bd 100644
@@ -24,12 +24,12 @@
 #include <string.h>
 
 /* FIXME: have lib/report/report.c _disp function call lv_size()? */
-uint64_t lvm_lv_get_size(const lv_t *lv)
+uint64_t lvm_lv_get_size(const lv_t lv)
 {
 	return lv_size(lv);
 }
 
-char *lvm_lv_get_uuid(const lv_t *lv)
+char *lvm_lv_get_uuid(const lv_t lv)
 {
 	char uuid[64] __attribute((aligned(8)));
 
@@ -40,7 +40,7 @@ char *lvm_lv_get_uuid(const lv_t *lv)
 	return strndup((const char *)uuid, 64);
 }
 
-char *lvm_lv_get_name(const lv_t *lv)
+char *lvm_lv_get_name(const lv_t lv)
 {
 	char *name;
 
@@ -50,7 +50,7 @@ char *lvm_lv_get_name(const lv_t *lv)
 	return name;
 }
 
-uint64_t lvm_lv_is_active(const lv_t *lv)
+uint64_t lvm_lv_is_active(const lv_t lv)
 {
 	struct lvinfo info;
 	if (lv_info(lv->vg->cmd, lv, &info, 1, 0) &&
@@ -59,7 +59,7 @@ uint64_t lvm_lv_is_active(const lv_t *lv)
 	return 0;
 }
 
-uint64_t lvm_lv_is_suspended(const lv_t *lv)
+uint64_t lvm_lv_is_suspended(const lv_t lv)
 {
 	struct lvinfo info;
 	if (lv_info(lv->vg->cmd, lv, &info, 1, 0) &&
@@ -101,7 +101,7 @@ static void _lv_set_default_linear_params(struct cmd_context *cmd,
  * lvm_vg_write.  However, this appears to be non-trivial change until
  * lv_create_single is refactored by segtype.
  */
-lv_t *lvm_vg_create_lv_linear(vg_t vg, const char *name, uint64_t size)
+lv_t lvm_vg_create_lv_linear(vg_t vg, const char *name, uint64_t size)
 {
 	struct lvcreate_params lp;
 	uint64_t extents;
@@ -120,14 +120,14 @@ lv_t *lvm_vg_create_lv_linear(vg_t vg, const char *name, uint64_t size)
 	lvl = find_lv_in_vg(vg, name);
 	if (!lvl)
 		return NULL;
-	return (lv_t *) lvl->lv;
+	return (lv_t) lvl->lv;
 }
 
 /*
  * FIXME: This function should probably not commit to disk but require calling
  * lvm_vg_write.
  */
-int lvm_vg_remove_lv(lv_t *lv)
+int lvm_vg_remove_lv(lv_t lv)
 {
 	if (!lv || !lv->vg || vg_read_error(lv->vg))
 		return -1;
@@ -138,7 +138,7 @@ int lvm_vg_remove_lv(lv_t *lv)
 	return 0;
 }
 
-int lvm_lv_activate(lv_t *lv)
+int lvm_lv_activate(lv_t lv)
 {
 	if (!lv || !lv->vg || vg_read_error(lv->vg) || !lv->vg->cmd)
 		return -1;
@@ -173,7 +173,7 @@ int lvm_lv_activate(lv_t *lv)
 	return 0;
 }
 
-int lvm_lv_deactivate(lv_t *lv)
+int lvm_lv_deactivate(lv_t lv)
 {
 	if (!lv || !lv->vg || vg_read_error(lv->vg) || !lv->vg->cmd)
 		return -1;
@@ -186,7 +186,7 @@ int lvm_lv_deactivate(lv_t *lv)
 	return 0;
 }
 
-int lvm_lv_resize(const lv_t *lv, uint64_t new_size)
+int lvm_lv_resize(const lv_t lv, uint64_t new_size)
 {
 	/* FIXME: add lv resize code here */
 	log_error("NOT IMPLEMENTED YET");
test/api/test.c +6 -6
index 65bc292..308c867 100644
@@ -136,9 +136,9 @@ static int _hash_create(void)
 }
 
 /* FIXME: this should be per vg */
-static lv_t *_lookup_lv_by_name(const char *name)
+static lv_t _lookup_lv_by_name(const char *name)
 {
-	lv_t *lv;
+	lv_t lv;
 
 	if (!name) {
 		printf ("Invalid LV name\n");
@@ -516,7 +516,7 @@ static void _lvs_in_vg(char **argv, int argc)
 
 static void _lv_deactivate(char **argv, int argc)
 {
-	lv_t *lv;
+	lv_t lv;
 	int rc=0;
 
 	if (argc < 3) {
@@ -532,7 +532,7 @@ static void _lv_deactivate(char **argv, int argc)
 }
 static void _lv_activate(char **argv, int argc)
 {
-	lv_t *lv;
+	lv_t lv;
 	int rc=0;
 
 	if (argc < 3) {
@@ -548,7 +548,7 @@ static void _lv_activate(char **argv, int argc)
 }
 static void _vg_remove_lv(char **argv, int argc)
 {
-	lv_t *lv;
+	lv_t lv;
 
 	if (argc < 3) {
 		printf("Please enter vgname, lvname\n");
@@ -569,7 +569,7 @@ static void _vg_remove_lv(char **argv, int argc)
 static void _vg_create_lv_linear(char **argv, int argc)
 {
 	vg_t vg;
-	lv_t *lv;
+	lv_t lv;
 
 	if (argc < 4) {
 		printf("Please enter vgname, lvname, and size\n");
Signature · 1 line
1.6.0.6
#3 lore raw

PATCH 3/3 Make lvm2app pv_t handle definition consistent with lvm_t.

This patch update pv_t handle to be consistent with lvm_t - define as a pointer to internal struct physical_volume.

---
 liblvm/lvm2app.h |   12 ++++++------
 liblvm/lvm_pv.c  |    8 ++++----
 2 files changed, 10 insertions(+), 10 deletions(-)
liblvm/lvm2app.h +6 -6
index 0d45a29..50ecce1 100644
@@ -130,7 +130,7 @@ typedef struct logical_volume *lv_t;
  * group.  Changes will be written to disk when the volume group gets
  * committed to disk.
  */
-typedef struct physical_volume pv_t;
+typedef struct physical_volume *pv_t;
 
 /**
  * Logical Volume object list.
@@ -149,7 +149,7 @@ typedef struct lvm_lv_list {
  */
 typedef struct lvm_pv_list {
 	struct dm_list list;
-	pv_t *pv;
+	pv_t pv;
 } pv_list_t;
 
 /**
@@ -781,7 +781,7 @@ struct dm_list *lvm_vg_list_pvs(vg_t vg);
  * \return
  * Copy of the uuid string.
  */
-char *lvm_pv_get_uuid(const pv_t *pv);
+char *lvm_pv_get_uuid(const pv_t pv);
 
 /**
  * Get the current name of a logical volume.
@@ -795,7 +795,7 @@ char *lvm_pv_get_uuid(const pv_t *pv);
  * \return
  * Copy of the name.
  */
-char *lvm_pv_get_name(const pv_t *pv);
+char *lvm_pv_get_name(const pv_t pv);
 
 /**
  * Get the current number of metadata areas in the physical volume.
@@ -806,7 +806,7 @@ char *lvm_pv_get_name(const pv_t *pv);
  * \return
  * Number of metadata areas in the PV.
  */
-uint64_t lvm_pv_get_mda_count(const pv_t *pv);
+uint64_t lvm_pv_get_mda_count(const pv_t pv);
 
 /**
  * Resize physical volume to new_size bytes.
@@ -822,6 +822,6 @@ uint64_t lvm_pv_get_mda_count(const pv_t *pv);
  * \return
  * 0 (success) or -1 (failure).
  */
-int lvm_pv_resize(const pv_t *pv, uint64_t new_size);
+int lvm_pv_resize(const pv_t pv, uint64_t new_size);
 
 #endif /* _LIB_LVM2APP_H */
liblvm/lvm_pv.c +4 -4
index 3d67769..8548597 100644
@@ -17,7 +17,7 @@
 #include "metadata-exported.h"
 #include "lvm-string.h"
 
-char *lvm_pv_get_uuid(const pv_t *pv)
+char *lvm_pv_get_uuid(const pv_t pv)
 {
 	char uuid[64] __attribute((aligned(8)));
 
@@ -28,7 +28,7 @@ char *lvm_pv_get_uuid(const pv_t *pv)
 	return strndup((const char *)uuid, 64);
 }
 
-char *lvm_pv_get_name(const pv_t *pv)
+char *lvm_pv_get_name(const pv_t pv)
 {
 	char *name;
 
@@ -38,12 +38,12 @@ char *lvm_pv_get_name(const pv_t *pv)
 	return name;
 }
 
-uint64_t lvm_pv_get_mda_count(const pv_t *pv)
+uint64_t lvm_pv_get_mda_count(const pv_t pv)
 {
 	return (uint64_t) pv_mda_count(pv);
 }
 
-int lvm_pv_resize(const pv_t *pv, uint64_t new_size)
+int lvm_pv_resize(const pv_t pv, uint64_t new_size)
 {
 	/* FIXME: add pv resize code here */
 	log_error("NOT IMPLEMENTED YET");
Signature · 1 line
1.6.0.6