[PATCH 3/4] Add lvm_lvseg_get_property() function.

Zdenek Kabelac <[email protected]>
Newsgroups dev.linux.lists.lvm-devel
Message-ID <[email protected]>
Dne 19.10.2010 15:24, Dave Wysochanski napsal(a):
> 
> Signed-off-by: Dave Wysochanski <[email protected]>
> ---
> 
> diff --git a/liblvm/lvm2app.h b/liblvm/lvm2app.h
> index f6d54f1..7e2eb69 100644
> --- a/liblvm/lvm2app.h
> +++ b/liblvm/lvm2app.h
> @@ -1099,6 +1099,45 @@ uint64_t lvm_lv_get_size(const lv_t lv);
>  struct lvm_property_value lvm_lv_get_property(const lv_t lv, const char *name);
>  
>  /**
> + * Get the value of a LV segment property
> + *
> + * \memberof lv_t
> + *
> + * \param   lvseg
> + * Logical volume segment handle.
> + *
> + * \param   name
> + * Name of property to query.  See lvs 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 v;
> + *      char *prop_name = "seg_start_pe";
> + *
> + *      v = lvm_lvseg_get_property(lv, prop_name);
> + *      if (lvm_errno(libh) || !v.is_valid) {
> + *           // handle error
> + *           printf("Invalid property name or unable to query"
> + *                  "'%s'.\n", prop_name);
> + *           return;
> + *      }

That's IMHO not practical.

if (!lvm_lvseg_get_property(lv, prop_name, &v)) {
	/* error  path */
}

or whatever return error status we use, looks much more natural.


Zdenek
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.