[lvm-devel] [PATCH 08/12] Add lvm_errno(), lvm_strerror, lvm_vg_mode.
Alasdair G Kergon
agk at redhat.com
Sun Feb 22 23:11:11 UTC 2009
On Thu, Feb 12, 2009 at 02:30:37PM -0500, Dave Wysochanski wrote:
> Create struct lib_context to store lvm_errno field as well as cmd_context.
> Create error APIs - lvm_errno, lvm_strerror.
As we discussed on the call last week, let't see first if we can get an error
number and messages integrated into the existing log_error() reporting
mechanism.
> +int lvm_errno(lvm_handle_t libh)
> +{
> + return libh->lvm_errno;
> +}
Eventually, yes, but as we discussed last week, a static global variable
is likely to be the quickest way to get this working until libh is
available at all levels of the stack.
> +char *lvm_strerror(lvm_handle_t libh)
> +{
> + return strerror(libh->lvm_errno);
> +}
No need for a wrapper around strerror - call it directly!
What we should do though is store the specific error messages issued
and provide a way to return them all in one go.
Again, this is likely to be a simple multi-line string for now, that gets
cleared on each new library call.
Alasdair
--
agk at redhat.com
More information about the lvm-devel
mailing list