From patchwork Mon Nov 2 14:20:06 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zdenek Kabelac X-Patchwork-Id: 57023 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 nA2EKlOb029902 for ; Mon, 2 Nov 2009 14:20:47 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 403D1619D6F; Mon, 2 Nov 2009 09:20:39 -0500 (EST) Received: from int-mx08.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 nA2EKZcR012316 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-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id nA2EKX9N004180 (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 nA2EKX6p008449; 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 nA2EKXW6008448; Mon, 2 Nov 2009 15:20:33 +0100 From: Zdenek Kabelac To: dm-devel@redhat.com Date: Mon, 2 Nov 2009 15:20:06 +0100 Message-Id: <1257171622-8380-3-git-send-email-zkabelac@redhat.com> In-Reply-To: <1257171622-8380-2-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> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.21 X-loop: dm-devel@redhat.com Cc: Zdenek Kabelac Subject: [dm-devel] [PATCH 02/18] Export outnl and indent functions 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 889992b..7f7d0de 100644 --- a/lib/format_text/export.c +++ b/lib/format_text/export.c @@ -235,6 +235,24 @@ static int _sectors_to_units(uint64_t sectors, char *buffer, size_t s) return dm_snprintf(buffer, s, "# %g %s", d, _units[i]) > 0; } +/* increment indention level */ +void out_inc_indent(struct formatter *f) +{ + _inc_indent(f); +} + +/* decrement indention level */ +void out_dec_indent(struct formatter *f) +{ + _dec_indent(f); +} + +/* insert new line */ +int out_newline(struct formatter *f) +{ + return f->nl(f); +} + /* * Appends a comment giving a size in more easily * readable form (eg, 4M instead of 8096). diff --git a/lib/format_text/text_export.h b/lib/format_text/text_export.h index 1cd42a9..cdba82f 100644 --- a/lib/format_text/text_export.h +++ b/lib/format_text/text_export.h @@ -17,7 +17,7 @@ #define _LVM_TEXT_EXPORT_H #define outf(args...) do {if (!out_text(args)) return_0;} while (0) -#define outnl(f) do {if (!f->nl(f)) return_0;} while (0) +#define outnl(f) do {if (!out_newline(f)) return_0;} while (0) struct formatter; struct lv_segment; @@ -37,4 +37,8 @@ int out_config_node(struct formatter *f, const struct config_node *cn); int out_areas(struct formatter *f, const struct lv_segment *seg, const char *type); +void out_inc_indent(struct formatter *f); +void out_dec_indent(struct formatter *f); +int out_newline(struct formatter *f); + #endif