Skip to contentSkip to conversation

LVM2/liblvm .exported_symbols lvm.h lvm_lv.c

PATCH [email protected] 1 participant 1 message Jul 26, 2009

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: wysochanski at sourceware.org 2009-07-26 14:36:52

Modified files:
liblvm : .exported_symbols lvm.h lvm_lv.c

Log message:
Add lvm_vg_remove_lv liblvm function.

Add a very simple version of lvm_vg_remove_lv.
Since we currently can only create linear LVs, this simple remove function is adequate. We must refactor lvremove_single a bit.

Author: Dave Wysochanski <[email protected]>

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/liblvm/.exported_symbols.diff?cvsroot=lvm2&r1=1.10&r2=1.11
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/liblvm/lvm.h.diff?cvsroot=lvm2&r1=1.15&r2=1.16
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/liblvm/lvm_lv.c.diff?cvsroot=lvm2&r1=1.3&r2=1.4

liblvm/.exported_symbols +1 -0
@@ -30,3 +30,4 @@
 lvm_list_vg_names
 lvm_list_vg_ids
 lvm_vg_create_lv_linear
+lvm_vg_remove_lv
liblvm/lvm.h +11 -0
@@ -117,6 +117,17 @@
 lv_t *lvm_vg_create_lv_linear(vg_t *vg, const char *name, uint64_t size);
 
 /**
+ * Remove a logical volume from a volume group.
+ * This API commits the change to disk and does _not_ require calling
+ * lvm_vg_write.
+ * Currently only removing linear LVs are possible.
+ *
+ * FIXME: This API should probably not commit to disk but require calling
+ * lvm_vg_write.
+ */
+int lvm_vg_remove_lv(lv_t *lv);
+
+/**
  * Return stored error no describing last LVM API error.
  *
  * Users of liblvm should use lvm_errno to determine success or failure
liblvm/lvm_lv.c +6 -0
@@ -96,3 +96,9 @@
 	return lvl->lv;
 }
 
+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);
+}