From patchwork Mon Nov 2 14:20:07 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zdenek Kabelac X-Patchwork-Id: 57021 Received: from hormel.redhat.com (hormel1.redhat.com [209.132.177.33]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id nA2EKhHn029890 for ; Mon, 2 Nov 2009 14:20:43 GMT Received: from listman.util.phx.redhat.com (listman.util.phx.redhat.com [10.8.4.110]) by hormel.redhat.com (Postfix) with ESMTP id 28A9B619D3E; Mon, 2 Nov 2009 09:20:38 -0500 (EST) Received: from int-mx01.intmail.prod.int.phx2.redhat.com (nat-pool.util.phx.redhat.com [10.8.5.200]) by listman.util.phx.redhat.com (8.13.1/8.13.1) with ESMTP id nA2EKZBG012307 for ; Mon, 2 Nov 2009 09:20:35 -0500 Received: from dhcp-0-185.brq.redhat.com (dhcp-0-185.brq.redhat.com [10.34.0.185]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id nA2EKX7t020015 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 2 Nov 2009 09:20:35 -0500 Received: from dhcp-0-185.brq.redhat.com (dhcp-0-185.brq.redhat.com [127.0.0.1]) by dhcp-0-185.brq.redhat.com (8.14.3/8.14.3) with ESMTP id nA2EKXtR008453; Mon, 2 Nov 2009 15:20:33 +0100 Received: (from kabi@localhost) by dhcp-0-185.brq.redhat.com (8.14.3/8.14.3/Submit) id nA2EKXTb008452; Mon, 2 Nov 2009 15:20:33 +0100 From: Zdenek Kabelac To: dm-devel@redhat.com Date: Mon, 2 Nov 2009 15:20:07 +0100 Message-Id: <1257171622-8380-4-git-send-email-zkabelac@redhat.com> In-Reply-To: <1257171622-8380-3-git-send-email-zkabelac@redhat.com> References: <1257171622-8380-1-git-send-email-zkabelac@redhat.com> <1257171622-8380-2-git-send-email-zkabelac@redhat.com> <1257171622-8380-3-git-send-email-zkabelac@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-loop: dm-devel@redhat.com Cc: Zdenek Kabelac Subject: [dm-devel] [PATCH 03/18] Export outsz() and outhnt() for modules X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.5 Precedence: junk Reply-To: device-mapper development List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com diff --git a/lib/format_text/export.c b/lib/format_text/export.c index 7f7d0de..f25b80e 100644 --- a/lib/format_text/export.c +++ b/lib/format_text/export.c @@ -386,9 +386,8 @@ static int _print_vg(struct formatter *f, struct volume_group *vg) if (vg->system_id && *vg->system_id) outf(f, "system_id = \"%s\"", vg->system_id); - if (!out_size(f, (uint64_t) vg->extent_size, "extent_size = %u", - vg->extent_size)) - return_0; + outsz(f, (uint64_t) vg->extent_size, "extent_size = %u", + vg->extent_size); outf(f, "max_lv = %u", vg->max_lv); outf(f, "max_pv = %u", vg->max_pv); @@ -453,9 +452,8 @@ static int _print_pvs(struct formatter *f, struct volume_group *vg) return 0; } - if (!out_hint(f, "device = \"%s\"", - escape_double_quotes(buf, pv_dev_name(pv)))) - return_0; + outhnt(f, "device = \"%s\"", + escape_double_quotes(buf, pv_dev_name(pv))); outnl(f); if (!_print_flag_config(f, pv->status, PV_FLAGS)) @@ -467,13 +465,11 @@ static int _print_pvs(struct formatter *f, struct volume_group *vg) outf(f, "tags = %s", buffer); } - if (!out_size(f, pv->size, "dev_size = %" PRIu64, pv->size)) - return_0; + outsz(f, pv->size, "dev_size = %" PRIu64, pv->size); outf(f, "pe_start = %" PRIu64, pv->pe_start); - if (!out_size(f, vg->extent_size * (uint64_t) pv->pe_count, - "pe_count = %u", pv->pe_count)) - return_0; + outsz(f, vg->extent_size * (uint64_t) pv->pe_count, + "pe_count = %u", pv->pe_count); _dec_indent(f); outf(f, "}"); @@ -493,9 +489,8 @@ static int _print_segment(struct formatter *f, struct volume_group *vg, _inc_indent(f); outf(f, "start_extent = %u", seg->le); - if (!out_size(f, (uint64_t) seg->len * vg->extent_size, - "extent_count = %u", seg->len)) - return_0; + outsz(f, (uint64_t) seg->len * vg->extent_size, + "extent_count = %u", seg->len); outnl(f); outf(f, "type = \"%s\"", seg->segtype->name); diff --git a/lib/format_text/text_export.h b/lib/format_text/text_export.h index cdba82f..a452439 100644 --- a/lib/format_text/text_export.h +++ b/lib/format_text/text_export.h @@ -16,6 +16,8 @@ #ifndef _LVM_TEXT_EXPORT_H #define _LVM_TEXT_EXPORT_H +#define outsz(args...) do {if (!out_size(args)) return_0;} while (0) +#define outhnt(args...) do {if (!out_hint(args)) return_0;} while (0) #define outf(args...) do {if (!out_text(args)) return_0;} while (0) #define outnl(f) do {if (!out_newline(f)) return_0;} while (0)