Skip to contentSkip to conversation

LVM2/liblvm .exported_symbols lvm2app.h lvm_base.c

PATCH [email protected] 3 participants 3 messages May 19, 2010

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: wysochanski at sourceware.org 2010-05-19 11:53:12

Modified files:
liblvm : .exported_symbols lvm2app.h lvm_base.c

Log message:
Add lvm2app interfaces to lookup a vgname from a pvid and pvname.

lvm2app forces applications to start with a volume group name, open the volume group, then operate on individual pvs. In some cases the application may want to start with a device name rather than the volume group name. Today, if an application wants to do this, it must iterate through all the volume groups to find the volume group that the specific device is attached to. These new interfaces allow the application to avoid such overhead. Bump the lvm2app version number to 3.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/liblvm/.exported_symbols.diff?cvsroot=lvm2&r1=1.25&r2=1.26
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/liblvm/lvm2app.h.diff?cvsroot=lvm2&r1=1.15&r2=1.16
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/liblvm/lvm_base.c.diff?cvsroot=lvm2&r1=1.16&r2=1.17

liblvm/.exported_symbols +2 -0
@@ -48,3 +48,5 @@
 lvm_list_vg_uuids
 lvm_vg_create_lv_linear
 lvm_vg_remove_lv
+lvm_vgname_from_pvid
+lvm_vgname_from_device
liblvm/lvm2app.h +40 -1

51 lines not on this page · raw message

liblvm/lvm_base.c +19 -0
@@ -17,6 +17,7 @@
 #include "toolcontext.h"
 #include "locking.h"
 #include "lvm-version.h"
+#include "metadata-exported.h"
 
 const char *lvm_library_get_version(void)
 {
@@ -98,3 +99,21 @@
 {
 	return stored_errmsg();
 }
+
+const char *lvm_vgname_from_pvid(lvm_t libh, const char *pvid)
+{
+	struct cmd_context *cmd = (struct cmd_context *)libh;
+	char uuid[64] __attribute((aligned(8)));
+
+	if (!id_read_format(uuid, pvid)) {
+		log_error(INTERNAL_ERROR "Unable to convert uuid");
+		return NULL;
+	}
+	return find_vgname_from_pvid(cmd, uuid);
+}
+
+const char *lvm_vgname_from_device(lvm_t libh, const char *device)
+{
+	struct cmd_context *cmd = (struct cmd_context *)libh;
+	return find_vgname_from_pvname(cmd, device);
+}
#1 lore raw
Quoted 1 line · wysochanski at sourceware.org

Bump the lvm2app version number to 3.

We discussed this and agreed not to do it.

That version number will only be incremented if there is a change that makes existing compiled code incompatible with the new compiled shared object.

Alasdair

#2 lore raw
Quoted 11 lines · Alasdair G Kergon
Quoted 1 line · wysochanski at sourceware.org

Bump the lvm2app version number to 3.

We discussed this and agreed not to do it.

That version number will only be incremented if there is a change that makes existing compiled code incompatible with the new compiled shared object.

Alasdair

Ack - just forgot to update the commit msg.