All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Wysochanski <dwysocha@redhat.com>
To: lvm-devel@redhat.com
Subject: [PATCH 04/13] Add lvm_pv_name, lvm_vg_name, and lvm_lv_name accessors.
Date: Mon,  2 Feb 2009 15:50:00 -0500	[thread overview]
Message-ID: <1233607809-1087-5-git-send-email-dwysocha@redhat.com> (raw)
In-Reply-To: <1233607809-1087-4-git-send-email-dwysocha@redhat.com>

RFC - liblvm could provide accessor functions such as these along with
the generic attribute functions.  These specific accessor functions will
make application code simpler and more readable and may be desired by
application programmers over the generic attribute functions for single
attributes.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
---
 lib/lvm2.h              |    7 +++++++
 lib/metadata/metadata.c |   15 +++++++++++++++
 2 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/lib/lvm2.h b/lib/lvm2.h
index bfa1852..5f44614 100644
--- a/lib/lvm2.h
+++ b/lib/lvm2.h
@@ -69,4 +69,11 @@ typedef struct physical_volume pv_t;
 struct logical_volume;
 typedef struct logical_volume lv_t;
 
+/*
+ * PV, VG, and LV object attribute functions.
+ */
+const char *lvm_pv_name(const pv_t *pv);
+const char *lvm_vg_name(const vg_t *vg);
+const char *lvm_lv_name(const lv_t *lv);
+
 #endif
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index a2b5f2f..4c9f939 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -2673,6 +2673,21 @@ vg_t *vg_read_for_update(struct cmd_context *cmd, const char *vg_name,
 	return vg_read(cmd, vg_name, vgid, flags | READ_FOR_UPDATE);
 }
 
+const char *lvm_pv_name(const pv_t *pv)
+{
+	return dev_name(pv->dev);
+}
+
+const char *lvm_vg_name(const vg_t *vg)
+{
+	return vg->name;
+}
+
+const char *lvm_lv_name(const lv_t *lv)
+{
+	return lv->name;
+}
+
 /*
  * Test the validity of a VG handle returned by vg_read() or vg_read_for_update().
  *
-- 
1.5.5.1



  reply	other threads:[~2009-02-02 20:50 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-02 20:49 [PATCH 0/13] liblvm initialization, attribute, and object handling Dave Wysochanski
2009-02-02 20:49 ` [PATCH 01/13] Add system_dir to create_toolcontext() Dave Wysochanski
2009-02-02 20:49   ` [PATCH 02/13] Add lvm_create, lvm_destroy, lvm_reload_config() APIs Dave Wysochanski
2009-02-02 20:49     ` [PATCH 03/13] Move vg_t, lv_t, and pv_t from metadata-exported.h into lvm2.h Dave Wysochanski
2009-02-02 20:50       ` Dave Wysochanski [this message]
2009-02-02 20:50         ` [PATCH 05/13] Add lvm_vg_open() Dave Wysochanski
2009-02-02 20:50           ` [PATCH 06/13] Add lvm_vg_close() Dave Wysochanski
2009-02-02 20:50             ` [PATCH 07/13] Add lvm_vg_get_attr_list() libLVM API to return a list of VG attribute names Dave Wysochanski
2009-02-02 20:50               ` [PATCH 08/13] Add lvm_vg_get_attr_value() libLVM API to query to value of a VG attribute Dave Wysochanski
2009-02-02 20:50                 ` [PATCH 09/13] Add lvm_lvs_in_vg() API Dave Wysochanski
2009-02-02 20:50                   ` [PATCH 10/13] Add lvm_pvs_in_vg() Dave Wysochanski
2009-02-02 20:50                     ` [PATCH 11/13] Add lvm_lv_get_attr_list() and lvm_lv_get_attr_value() Dave Wysochanski
2009-02-02 20:50                       ` [PATCH 12/13] First cut at adding pv_obj_* APIs Dave Wysochanski
2009-02-02 20:50                         ` [PATCH 13/13] Add test code Dave Wysochanski
2009-02-02 23:58                         ` [PATCH 12/13] First cut at adding pv_obj_* APIs Petr Rockai
2009-02-13 11:23                           ` Dave Wysochanski
2009-02-02 23:47                 ` [PATCH 08/13] Add lvm_vg_get_attr_value() libLVM API to query to value of a VG attribute Petr Rockai
2009-02-13 11:30                   ` Dave Wysochanski
2009-02-02 23:45             ` [PATCH 06/13] Add lvm_vg_close() Petr Rockai
2009-02-04 17:11               ` Dave Wysochanski
2009-02-04 20:27                 ` Dave Wysochanski
2009-02-02 23:28           ` [PATCH 05/13] Add lvm_vg_open() Petr Rockai
2009-02-04 15:01             ` Dave Wysochanski
2009-02-02 23:25       ` [PATCH 03/13] Move vg_t, lv_t, and pv_t from metadata-exported.h into lvm2.h Petr Rockai
2009-02-04 14:57         ` Dave Wysochanski
2009-02-02 23:22     ` [PATCH 02/13] Add lvm_create, lvm_destroy, lvm_reload_config() APIs Petr Rockai
2009-02-03  0:44       ` [PATCH] Move locking_type reading inside init_locking() Dave Wysochanski
2009-02-03  1:12         ` [PATCH take2] Add lvm_create, lvm_destroy, lvm_reload_config() APIs Dave Wysochanski
2009-02-13 11:42       ` [PATCH 02/13] " Dave Wysochanski

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=1233607809-1087-5-git-send-email-dwysocha@redhat.com \
    --to=dwysocha@redhat.com \
    --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.