mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-03 05:18:29 +03:00
Change default errno value to 0 (no error) and add prototypes in lvm.h
Since we are using errno values, we should use '0' as a default value which indicates a non-error, rather than defining some made-up default value that is not defined in errno. If we need to deviate from errno values, this will most likely indicate a flaw in our design. Add prototypes for lvm_errno and lvm_errmsg inside lvm.h and provide a basic description of their function. This fixes a couple compile warnings. Author: Dave Wysochanski <dwysocha@redhat.com>
This commit is contained in:
parent
9fac443591
commit
a0b1b1872e
@ -16,14 +16,12 @@
|
||||
#ifndef _LVM_LOGGING_H
|
||||
#define _LVM_LOGGING_H
|
||||
|
||||
#define EUNCLASSIFIED -1 /* Generic error code */
|
||||
|
||||
void print_log(int level, const char *file, int line, int dm_errno,
|
||||
const char *format, ...)
|
||||
__attribute__ ((format(printf, 5, 6)));
|
||||
|
||||
#define LOG_LINE(l, x...) \
|
||||
print_log(l, __FILE__, __LINE__ , EUNCLASSIFIED, ## x)
|
||||
print_log(l, __FILE__, __LINE__ , 0, ## x)
|
||||
|
||||
#define LOG_LINE_WITH_ERRNO(l, e, x...) \
|
||||
print_log(l, __FILE__, __LINE__ , e, ## x)
|
||||
|
24
liblvm/lvm.h
24
liblvm/lvm.h
@ -71,6 +71,30 @@ void lvm_destroy(lvm_t libh);
|
||||
*/
|
||||
int lvm_reload_config(lvm_t libh);
|
||||
|
||||
/**
|
||||
* Return stored error no describing last LVM API error.
|
||||
*
|
||||
* Users of liblvm should use lvm_errno to determine success or failure
|
||||
* of the last call, unless the API indicates another method of determining
|
||||
* success or failure.
|
||||
*
|
||||
* \param libh
|
||||
* Handle obtained from lvm_create.
|
||||
*
|
||||
* \return An errno value describing the last LVM error.
|
||||
*/
|
||||
int lvm_errno(lvm_t libh);
|
||||
|
||||
/**
|
||||
* Return stored error message describing last LVM error.
|
||||
*
|
||||
* \param libh
|
||||
* Handle obtained from lvm_create.
|
||||
*
|
||||
* \return An error string describing the last LVM error.
|
||||
*/
|
||||
const char *lvm_errmsg(lvm_t libh);
|
||||
|
||||
/**
|
||||
* Create a VG with default parameters.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user