*/
uint64_t lvm_pv_get_free(const pv_t pv);
+/**
+ * Get the value of a PV property
+ *
+ * \memberof pv_t
+ *
+ * \param pv
+ * Physical volume handle.
+ *
+ * \param name
+ * Name of property to query. See pvs man page for full list of properties
+ * that may be queried.
+ *
+ * The memory allocated for a string property value is tied to the vg_t
+ * handle and will be released when lvm_vg_close() is called.
+ *
+ * Example:
+ * lvm_property_value value;
+ * char *prop_name = "pv_mda_count";
+ *
+ * v = lvm_pv_get_property(pv, prop_name);
+ * if (!v.is_valid) {
+ * printf("Invalid property name or unable to query"
+ * "'%s', errno = %d.\n", prop_name, lvm_errno(libh));
+ * return;
+ * }
+ * if (v.is_string)
+ * printf(", value = %s\n", v.value.string);
+ * if (v.is_integer)
+ * printf(", value = %"PRIu64"\n", v.value.integer);
+ *
+ * \return
+ * lvm_property_value structure that will contain the current
+ * value of the property. Caller should check 'is_valid' flag before using
+ * the value. If 'is_valid' is not set, caller should check lvm_errno()
+ * for specific error.
+ */
+struct lvm_property_value lvm_pv_get_property(const pv_t pv, const char *name);
+
/**
* Resize physical volume to new_size bytes.
*
#include "lvm2app.h"
#include "metadata.h"
#include "lvm-string.h"
+#include "lvm_misc.h"
const char *lvm_pv_get_uuid(const pv_t pv)
{
return (uint64_t) SECTOR_SIZE * pv_free(pv);
}
+struct lvm_property_value lvm_pv_get_property(const pv_t pv, const char *name)
+{
+ return get_property(pv, NULL, NULL, name);
+}
+
int lvm_pv_resize(const pv_t pv, uint64_t new_size)
{
/* FIXME: add pv resize code here */