From: wysochanski@sourceware.org <wysochanski@sourceware.org>
To: lvm-devel@redhat.com
Subject: LVM2 lib/log/lvm-logging.h liblvm/lvm.h
Date: 16 Jul 2009 03:07:46 -0000 [thread overview]
Message-ID: <20090716030746.26247.qmail@sourceware.org> (raw)
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: wysochanski at sourceware.org 2009-07-16 03:07:46
Modified files:
lib/log : lvm-logging.h
liblvm : lvm.h
Log message:
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>
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/log/lvm-logging.h.diff?cvsroot=lvm2&r1=1.6&r2=1.7
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/liblvm/lvm.h.diff?cvsroot=lvm2&r1=1.3&r2=1.4
--- LVM2/lib/log/lvm-logging.h 2009/07/16 00:52:09 1.6
+++ LVM2/lib/log/lvm-logging.h 2009/07/16 03:07:45 1.7
@@ -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)
--- LVM2/liblvm/lvm.h 2009/07/14 03:02:14 1.3
+++ LVM2/liblvm/lvm.h 2009/07/16 03:07:46 1.4
@@ -72,6 +72,30 @@
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.
*
* This API requires calling lvm_vg_write to commit the change to disk.
reply other threads:[~2009-07-16 3:07 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090716030746.26247.qmail@sourceware.org \
--to=wysochanski@sourceware.org \
--cc=lvm-devel@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.