1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

Export functions out_inc_indent(), out_dec_indent() for creating

indented metadata lines.

Macro outnl() is using exported out_newline() instead of direct
call f->fn(), that required the visibility of the internal
struct formatter.
This commit is contained in:
Zdenek Kabelac 2009-11-03 11:00:46 +00:00
parent 61c146fb97
commit 7fb52b9c39
2 changed files with 23 additions and 1 deletions

View File

@ -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).

View File

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