public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
From: zkabelac@sourceware.org
To: lvm-devel@redhat.com, lvm2-cvs@sourceware.org
Subject: LVM2/lib/thin thin.c
Date: Thu, 01 Sep 2011 10:16:00 -0000	[thread overview]
Message-ID: <20110901101633.11218.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	zkabelac@sourceware.org	2011-09-01 10:16:33

Modified files:
	lib/thin       : thin.c 

Log message:
	Reflect dm_config API update

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/thin/thin.c.diff?cvsroot=lvm2&r1=1.6&r2=1.7

--- LVM2/lib/thin/thin.c	2011/08/30 14:55:18	1.6
+++ LVM2/lib/thin/thin.c	2011/09/01 10:16:32	1.7
@@ -46,28 +46,24 @@
 static int _thin_pool_text_import(struct lv_segment *seg, const struct dm_config_node *sn,
 			struct dm_hash_table *pv_hash __attribute__((unused)))
 {
-	const struct dm_config_node *cn;
+	const char *lv_name;
 
-	if (!(cn = dm_config_find_node(sn, "data")) ||
-	    !cn->v || cn->v->type != DM_CFG_STRING)
+	if (!dm_config_get_str(sn, "data", &lv_name))
 		return SEG_LOG_ERROR("Thin pool data must be a string in");
 
-	if (!(seg->data_lv = find_lv(seg->lv->vg, cn->v->v.str)))
-		return SEG_LOG_ERROR("Unknown pool data %s in",
-				     cn->v->v.str);
+	if (!(seg->data_lv = find_lv(seg->lv->vg, lv_name)))
+		return SEG_LOG_ERROR("Unknown pool data %s in", lv_name);
 
-	if (!(cn = dm_config_find_node(sn, "metadata")) ||
-	    !cn->v || cn->v->type != DM_CFG_STRING)
+	if (!dm_config_get_str(sn, "metadata", &lv_name))
 		return SEG_LOG_ERROR("Thin pool metadata must be a string in");
 
-	if (!(seg->metadata_lv = find_lv(seg->lv->vg, cn->v->v.str)))
-		return SEG_LOG_ERROR("Unknown pool metadata %s in",
-				     cn->v->v.str);
+	if (!(seg->metadata_lv = find_lv(seg->lv->vg, lv_name)))
+		return SEG_LOG_ERROR("Unknown pool metadata %s in", lv_name);
 
 	if (!dm_config_get_uint64(sn, "transaction_id", &seg->transaction_id))
 		return SEG_LOG_ERROR("Could not read transaction_id for");
 
-	if (dm_config_find_node(sn, "zero_new_blocks") &&
+	if (dm_config_has_node(sn, "zero_new_blocks") &&
 	    !dm_config_get_uint32(sn, "zero_new_blocks", &seg->zero_new_blocks))
 		return SEG_LOG_ERROR("Could not read zero_new_blocks for");
 
@@ -93,23 +89,20 @@
 static int _thin_text_import(struct lv_segment *seg, const struct dm_config_node *sn,
 			struct dm_hash_table *pv_hash __attribute__((unused)))
 {
-	const struct dm_config_node *cn;
+	const char *lv_name;
 
-	if (!(cn = dm_config_find_node(sn, "thin_pool")) ||
-	    !cn->v || cn->v->type != DM_CFG_STRING)
+	if (!dm_config_get_str(sn, "thin_pool", &lv_name))
 		return SEG_LOG_ERROR("Thin pool must be a string in");
 
-	if (!(seg->thin_pool_lv = find_lv(seg->lv->vg, cn->v->v.str)))
-		return SEG_LOG_ERROR("Unknown thin pool %s in",
-				     cn->v->v.str);
+	if (!(seg->thin_pool_lv = find_lv(seg->lv->vg, lv_name)))
+		return SEG_LOG_ERROR("Unknown thin pool %s in", lv_name);
 
-	if ((cn = dm_config_find_node(sn, "origin"))) {
-                if (!cn->v || cn->v->type != DM_CFG_STRING)
+	if (dm_config_has_node(sn, "origin")) {
+		if (!dm_config_get_str(sn, "origin", &lv_name))
 			return SEG_LOG_ERROR("Thin pool origin must be a string in");
 
-		if (!(seg->origin = find_lv(seg->lv->vg, cn->v->v.str)))
-			return SEG_LOG_ERROR("Unknown origin %s in",
-					     cn->v->v.str);
+		if (!(seg->origin = find_lv(seg->lv->vg, lv_name)))
+			return SEG_LOG_ERROR("Unknown origin %s in", lv_name);
 	}
 
 	if (!dm_config_get_uint64(sn, "device_id", &seg->device_id))


             reply	other threads:[~2011-09-01 10:16 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-01 10:16 zkabelac [this message]
2011-09-06 22:35 zkabelac
2011-10-06 11:06 zkabelac
2011-10-11  8:51 zkabelac
2011-10-17 14:17 zkabelac
2011-10-20 10:30 zkabelac
2011-10-20 10:32 zkabelac
2011-10-22 16:45 zkabelac
2011-10-28 20:25 zkabelac
2011-11-03 14:37 zkabelac
2011-12-21 12:56 zkabelac
2012-01-19 15:42 zkabelac

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=20110901101633.11218.qmail@sourceware.org \
    --to=zkabelac@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).