public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
* LVM2/lib/cache lvmcache.c lvmcache.h
@ 2010-05-19 11:52 wysochanski
0 siblings, 0 replies; 4+ messages in thread
From: wysochanski @ 2010-05-19 11:52 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: wysochanski@sourceware.org 2010-05-19 11:52:21
Modified files:
lib/cache : lvmcache.c lvmcache.h
Log message:
Add lvmcache_vgname_from_pvid().
Add lvmcache function to lookup a vgname from a pvid.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/cache/lvmcache.c.diff?cvsroot=lvm2&r1=1.90&r2=1.91
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/cache/lvmcache.h.diff?cvsroot=lvm2&r1=1.32&r2=1.33
--- LVM2/lib/cache/lvmcache.c 2010/05/19 11:52:07 1.90
+++ LVM2/lib/cache/lvmcache.c 2010/05/19 11:52:21 1.91
@@ -509,6 +509,27 @@
return info;
}
+char *lvmcache_vgname_from_pvid(struct cmd_context *cmd, const char *pvid)
+{
+ struct lvmcache_info *info;
+ char *vgname;
+
+ if (!device_from_pvid(cmd, (struct id *)pvid, NULL)) {
+ log_error("Couldn't find device with uuid %s.", pvid);
+ return NULL;
+ }
+
+ info = info_from_pvid(pvid, 0);
+ if (!info)
+ return_NULL;
+
+ if (!(vgname = dm_pool_strdup(cmd->mem, info->vginfo->vgname))) {
+ log_errno(ENOMEM, "vgname allocation failed");
+ return NULL;
+ }
+ return vgname;
+}
+
static void _rescan_entry(struct lvmcache_info *info)
{
struct label *label;
--- LVM2/lib/cache/lvmcache.h 2010/05/19 11:52:07 1.32
+++ LVM2/lib/cache/lvmcache.h 2010/05/19 11:52:21 1.33
@@ -98,6 +98,7 @@
unsigned *scan_done_once);
const char *pvid_from_devname(struct cmd_context *cmd,
const char *dev_name);
+char *lvmcache_vgname_from_pvid(struct cmd_context *cmd, const char *pvid);
int vgs_locked(void);
int vgname_is_locked(const char *vgname);
^ permalink raw reply [flat|nested] 4+ messages in thread
* LVM2/lib/cache lvmcache.c lvmcache.h
@ 2010-10-25 13:02 zkabelac
0 siblings, 0 replies; 4+ messages in thread
From: zkabelac @ 2010-10-25 13:02 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac@sourceware.org 2010-10-25 13:02:26
Modified files:
lib/cache : lvmcache.c lvmcache.h
Log message:
Use 'const' struct id *pvid for device_from_pvid()
Update interface for device_from_pvid and use const pointer.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/cache/lvmcache.c.diff?cvsroot=lvm2&r1=1.95&r2=1.96
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/cache/lvmcache.h.diff?cvsroot=lvm2&r1=1.33&r2=1.34
--- LVM2/lib/cache/lvmcache.c 2010/09/30 21:06:51 1.95
+++ LVM2/lib/cache/lvmcache.c 2010/10/25 13:02:26 1.96
@@ -733,7 +733,7 @@
return pvids;
}
-struct device *device_from_pvid(struct cmd_context *cmd, struct id *pvid,
+struct device *device_from_pvid(struct cmd_context *cmd, const struct id *pvid,
unsigned *scan_done_once)
{
struct label *label;
--- LVM2/lib/cache/lvmcache.h 2010/05/19 11:52:21 1.33
+++ LVM2/lib/cache/lvmcache.h 2010/10/25 13:02:26 1.34
@@ -94,7 +94,7 @@
struct lvmcache_vginfo *vginfo_from_vgid(const char *vgid);
struct lvmcache_info *info_from_pvid(const char *pvid, int valid_only);
const char *vgname_from_vgid(struct dm_pool *mem, const char *vgid);
-struct device *device_from_pvid(struct cmd_context *cmd, struct id *pvid,
+struct device *device_from_pvid(struct cmd_context *cmd, const struct id *pvid,
unsigned *scan_done_once);
const char *pvid_from_devname(struct cmd_context *cmd,
const char *dev_name);
^ permalink raw reply [flat|nested] 4+ messages in thread
* LVM2/lib/cache lvmcache.c lvmcache.h
@ 2010-05-19 11:52 wysochanski
0 siblings, 0 replies; 4+ messages in thread
From: wysochanski @ 2010-05-19 11:52 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: wysochanski@sourceware.org 2010-05-19 11:52:08
Modified files:
lib/cache : lvmcache.c lvmcache.h
Log message:
Add pvid_from_devname() lvmcache function.
Add supporting function for mappings from devname -> pvid -> vgname.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/cache/lvmcache.c.diff?cvsroot=lvm2&r1=1.89&r2=1.90
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/cache/lvmcache.h.diff?cvsroot=lvm2&r1=1.31&r2=1.32
--- LVM2/lib/cache/lvmcache.c 2010/05/19 02:08:50 1.89
+++ LVM2/lib/cache/lvmcache.c 2010/05/19 11:52:07 1.90
@@ -757,6 +757,25 @@
return NULL;
}
+const char *pvid_from_devname(struct cmd_context *cmd,
+ const char *devname)
+{
+ struct device *dev;
+ struct label *label;
+
+ if (!(dev = dev_cache_get(devname, cmd->filter))) {
+ log_error("%s: Couldn't find device. Check your filters?",
+ devname);
+ return NULL;
+ }
+
+ if (!(label_read(dev, &label, UINT64_C(0))))
+ return NULL;
+
+ return dev->pvid;
+}
+
+
static int _free_vginfo(struct lvmcache_vginfo *vginfo)
{
struct lvmcache_vginfo *primary_vginfo, *vginfo2;
--- LVM2/lib/cache/lvmcache.h 2010/05/19 02:36:33 1.31
+++ LVM2/lib/cache/lvmcache.h 2010/05/19 11:52:07 1.32
@@ -96,6 +96,8 @@
const char *vgname_from_vgid(struct dm_pool *mem, const char *vgid);
struct device *device_from_pvid(struct cmd_context *cmd, struct id *pvid,
unsigned *scan_done_once);
+const char *pvid_from_devname(struct cmd_context *cmd,
+ const char *dev_name);
int vgs_locked(void);
int vgname_is_locked(const char *vgname);
^ permalink raw reply [flat|nested] 4+ messages in thread
* LVM2/lib/cache lvmcache.c lvmcache.h
@ 2005-10-27 17:41 agk
0 siblings, 0 replies; 4+ messages in thread
From: agk @ 2005-10-27 17:41 UTC (permalink / raw)
To: lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: agk@sourceware.org 2005-10-27 17:41:41
Modified files:
lib/cache : lvmcache.c lvmcache.h
Log message:
Export vgname_is_locked
Patches:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/LVM2/lib/cache/lvmcache.c.diff?cvsroot=lvm2&r1=1.10&r2=1.11
http://sources.redhat.com/cgi-bin/cvsweb.cgi/LVM2/lib/cache/lvmcache.h.diff?cvsroot=lvm2&r1=1.5&r2=1.6
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-10-25 13:02 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-19 11:52 LVM2/lib/cache lvmcache.c lvmcache.h wysochanski
-- strict thread matches above, loose matches on Subject: below --
2010-10-25 13:02 zkabelac
2010-05-19 11:52 wysochanski
2005-10-27 17:41 agk
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).