public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
From: wysochanski@sourceware.org
To: lvm-devel@redhat.com, lvm2-cvs@sourceware.org
Subject: LVM2/lib metadata/lv.c metadata/lv.h report/pr ...
Date: Tue, 12 Oct 2010 16:11:00 -0000	[thread overview]
Message-ID: <20101012161135.23383.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	wysochanski@sourceware.org	2010-10-12 16:11:34

Modified files:
	lib/metadata   : lv.c lv.h 
	lib/report     : properties.c report.c 

Log message:
	Refactor and add code for (lv) 'lv_path' get function.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/lv.c.diff?cvsroot=lvm2&r1=1.6&r2=1.7
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/lv.h.diff?cvsroot=lvm2&r1=1.5&r2=1.6
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/report/properties.c.diff?cvsroot=lvm2&r1=1.9&r2=1.10
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/report/report.c.diff?cvsroot=lvm2&r1=1.131&r2=1.132

--- LVM2/lib/metadata/lv.c	2010/09/30 20:47:18	1.6
+++ LVM2/lib/metadata/lv.c	2010/10/12 16:11:34	1.7
@@ -16,6 +16,28 @@
 #include "lib.h"
 #include "metadata.h"
 #include "activate.h"
+#include "toolcontext.h"
+
+char *lv_path_dup(struct dm_pool *mem, const struct logical_volume *lv)
+{
+	char *repstr;
+	size_t len;
+
+	len = strlen(lv->vg->cmd->dev_dir) + strlen(lv->vg->name) +
+		strlen(lv->name) + 2;
+
+	if (!(repstr = dm_pool_zalloc(mem, len))) {
+		log_error("dm_pool_alloc failed");
+		return 0;
+	}
+
+	if (dm_snprintf(repstr, len, "%s%s/%s",
+			lv->vg->cmd->dev_dir, lv->vg->name, lv->name) < 0) {
+		log_error("lvpath snprintf failed");
+		return 0;
+	}
+	return repstr;
+}
 
 char *lv_uuid_dup(const struct logical_volume *lv)
 {
--- LVM2/lib/metadata/lv.h	2010/09/30 20:47:18	1.5
+++ LVM2/lib/metadata/lv.h	2010/10/12 16:11:34	1.6
@@ -52,5 +52,6 @@
 char *lv_attr_dup(struct dm_pool *mem, const struct logical_volume *lv);
 char *lv_uuid_dup(const struct logical_volume *lv);
 char *lv_tags_dup(const struct logical_volume *lv);
+char *lv_path_dup(struct dm_pool *mem, const struct logical_volume *lv);
 
 #endif
--- LVM2/lib/report/properties.c	2010/10/12 16:11:20	1.9
+++ LVM2/lib/report/properties.c	2010/10/12 16:11:34	1.10
@@ -101,7 +101,7 @@
 #define _lv_uuid_set _not_implemented_set
 #define _lv_name_get _not_implemented_get
 #define _lv_name_set _not_implemented_set
-#define _lv_path_get _not_implemented_get
+GET_LV_STR_PROPERTY_FN(lv_path, lv_path_dup(lv->vg->vgmem, lv))
 #define _lv_path_set _not_implemented_set
 GET_LV_STR_PROPERTY_FN(lv_attr, lv_attr_dup(lv->vg->vgmem, lv))
 #define _lv_attr_set _not_implemented_set
--- LVM2/lib/report/report.c	2010/09/30 14:09:10	1.131
+++ LVM2/lib/report/report.c	2010/10/12 16:11:34	1.132
@@ -350,18 +350,9 @@
 {
 	const struct logical_volume *lv = (const struct logical_volume *) data;
 	char *repstr;
-	size_t len;
 
-	len = strlen(lv->vg->cmd->dev_dir) + strlen(lv->vg->name) + strlen(lv->name) + 2;
-	if (!(repstr = dm_pool_zalloc(mem, len))) {
-		log_error("dm_pool_alloc failed");
+	if (!(repstr = lv_path_dup(mem, lv)))
 		return 0;
-	}
-
-	if (dm_snprintf(repstr, len, "%s%s/%s", lv->vg->cmd->dev_dir, lv->vg->name, lv->name) < 0) {
-		log_error("lvpath snprintf failed");
-		return 0;
-	}
 
 	dm_report_field_set_value(field, repstr, NULL);
 


             reply	other threads:[~2010-10-12 16:11 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-12 16:11 wysochanski [this message]
  -- strict thread matches above, loose matches on Subject: below --
2010-11-17 20:08 mornfall
2010-10-21 14:49 wysochanski
2010-10-21 14:49 wysochanski
2010-10-21 14:49 wysochanski
2010-10-12 16:13 wysochanski
2010-10-12 16:12 wysochanski
2010-10-12 16:12 wysochanski
2010-10-12 16:12 wysochanski
2010-10-12 16:12 wysochanski
2010-10-12 16:11 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=20101012161135.23383.qmail@sourceware.org \
    --to=wysochanski@sourceware.org \
    --cc=lvm-devel@redhat.com \
    --cc=lvm2-cvs@sourceware.org \
    /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 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).