btrfs-progs: define new output format: json

Add the definition, the format is not implemented in any command.

Signed-off-by: David Sterba <dsterba@suse.com>
master
David Sterba 2019-06-21 16:14:09 +02:00
parent eb6a09050f
commit 17aee13fcd
3 changed files with 5 additions and 3 deletions

View File

@ -21,9 +21,10 @@ enum {
CMD_HIDDEN = (1 << 0), /* should not be in help listings */
CMD_ALIAS = (1 << 1), /* alias of next command in cmd_group */
CMD_FORMAT_TEXT = (1 << 2), /* output as plain text */
CMD_FORMAT_JSON = (1 << 3), /* output in json */
};
#define CMD_FORMAT_MASK (CMD_FORMAT_TEXT)
#define CMD_FORMAT_MASK (CMD_FORMAT_TEXT | CMD_FORMAT_JSON)
struct cmd_struct {
const char *token;

View File

@ -30,8 +30,9 @@
#define USAGE_LISTING 8U
#define USAGE_FORMAT 16U
const struct format_desc output_formats[1] = {
const struct format_desc output_formats[2] = {
{ .value = CMD_FORMAT_TEXT, .name = "text" },
{ .value = CMD_FORMAT_JSON, .name = "json" },
};
static char argv0_buf[ARGV0_BUF_SIZE] = "btrfs";

View File

@ -70,7 +70,7 @@ struct format_desc {
char name[8];
};
extern const struct format_desc output_formats[1];
extern const struct format_desc output_formats[2];
const char *output_format_name(unsigned int value);