LVM2/liblvm lvm.h lvm_base.c lvm_lv.c lvm_vg.c
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: wysochanski at sourceware.org 2009-07-26 20:29:00
Modified files:
liblvm : lvm.h lvm_base.c lvm_lv.c lvm_vg.c
Log message:
Update liblvm status return codes to be consistent.
For now, we use the following scheme.
For APIs that return an int, success is 0, fail is -1.
APIs that return handles, success is non-NULL, fail is NULL. At this early stage, liblvm error handling mechanism is subject to change, but for now we go with this simple scheme consistent with system programming.
Author: Dave Wysochanski <[email protected]>
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/liblvm/lvm.h.diff?cvsroot=lvm2&r1=1.23&r2=1.24
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/liblvm/lvm_base.c.diff?cvsroot=lvm2&r1=1.4&r2=1.5
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/liblvm/lvm_lv.c.diff?cvsroot=lvm2&r1=1.4&r2=1.5
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/liblvm/lvm_vg.c.diff?cvsroot=lvm2&r1=1.15&r2=1.16
liblvm/lvm.h +9 -7
@@ -144,6 +144,7 @@* * \param libh * Handle obtained from lvm_create. +* \return 0 (success) or -1 (failure). */ int lvm_reload_config (lvm_t libh);
@@ -174,7 +175,7 @@/** * Scan all devices on the system for VGs and LVM metadata. * -* \return Status code of 1 (success) or 0 (failure). +* \return 0 (success) or -1 (failure). */ int lvm_scan (lvm_t libh);
@@ -217,6 +218,7 @@* Handle obtained from lvm_create. * * \return List of copied uuid strings. +* If no VGs exist on the system, NULL is returned. */ struct dm_list *lvm_list_vg_uuids (lvm_t libh);
@@ -268,7 +270,7 @@* * \param vg * VG handle obtained from lvm_vg_create or lvm_vg_open. -* \return Status code of 1 (success) or 0 (failure). +* \return 0 (success) or -1 (failure). */ int lvm_vg_write (vg_t *vg);
@@ -280,7 +282,7 @@* * \param vg * VG handle obtained from lvm_vg_create or lvm_vg_open. -* \return Status code of 1 (success) or 0 (failure). +* \return 0 (success) or -1 (failure). */ int lvm_vg_remove (vg_t *vg);
@@ -291,7 +293,7 @@* * \param vg * VG handle obtained from lvm_vg_create or lvm_vg_open. -* \return Status code of 1 (success) or 0 (failure). +* \return 0 (success) or -1 (failure). */ int lvm_vg_close (vg_t *vg);
@@ -311,7 +313,7 @@* VG handle obtained from lvm_vg_create or lvm_vg_open. * \param device * Name of device to add to VG. -* \return Status code of 1 (success) or 0 (failure). +* \return 0 (success) or -1 (failure). */ int lvm_vg_extend (vg_t *vg,const char *device);
@@ -327,7 +329,7 @@* VG handle obtained from lvm_vg_create or lvm_vg_open. * \param new_size * New extent size in bytes. -* \return Status code of 1 (success) or 0 (failure). +* \return 0 (success) or -1 (failure). */ int lvm_vg_set_extent_size (vg_t *vg,uint32_t new_size);
@@ -452,7 +454,7 @@* * \param lv * Logical volume handle. -* \return Status code of 1 (success) or 0 (failure). +* \return 0 (success) or -1 (failure). */ int lvm_vg_remove_lv (lv_t *lv);
liblvm/lvm_base.c +3 -2
@@ -61,14 +61,15 @@void lvm_destroy (lvm_t libh) { -/* FIXME: error handling */ destroy_toolcontext ((struct cmd_context *)libh); }int lvm_reload_config (lvm_t libh) {/* FIXME: re-init locking needed here? */ -return refresh_toolcontext ((struct cmd_context *)libh); +if (refresh_toolcontext ((struct cmd_context *)libh)) +return -1 ; +return 0 ; }int lvm_errno (lvm_t libh)
liblvm/lvm_lv.c +4 -2
@@ -99,6 +99,8 @@int lvm_vg_remove_lv (lv_t *lv) {if (!lv || !lv->vg ||vg_read_error (lv->vg)) -return 0 ; -return lv_remove_single (lv->vg->cmd, lv,DONT_PROMPT ); +return -1 ; +if (!lv_remove_single (lv->vg->cmd, lv,DONT_PROMPT )) +return -1 ; +return 0 ; }
liblvm/lvm_vg.c +20 -22
98 lines not on this page · raw message