FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Device-mapper Development

 
 
LinkBack Thread Tools
 
Old 11-02-2009, 01:20 PM
Zdenek Kabelac
 
Default Export outnl and indent functions for modules

Exporting functions out_inc_indent(), out_dec_indent() for creating
indented metadata lines. Macro outnl() is using out_newline()
instead of direct f->fn() that required the visibility of internal
struct formatter.

Signed-off-by: Zdenek Kabelac <zkabelac@redhat.com>
---
lib/format_text/export.c | 18 ++++++++++++++++++
lib/format_text/text_export.h | 6 +++++-
2 files changed, 23 insertions(+), 1 deletions(-)

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
--
1.6.5.1

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
 
Old 11-02-2009, 01:50 PM
Alasdair G Kergon
 
Default Export outnl and indent functions for modules

On Mon, Nov 02, 2009 at 03:20:06PM +0100, Zdenek Kabelac wrote:
> Exporting functions out_inc_indent(), out_dec_indent() for creating
> indented metadata lines. Macro outnl() is using out_newline()
> instead of direct f->fn() that required the visibility of internal
> struct formatter.

Ack.

Alasdair

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
 

Thread Tools




All times are GMT. The time now is 12:40 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org