forked from Mirrors/btrfs-progs
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
parent
eb6a09050f
commit
17aee13fcd
|
@ -21,9 +21,10 @@ enum {
|
||||||
CMD_HIDDEN = (1 << 0), /* should not be in help listings */
|
CMD_HIDDEN = (1 << 0), /* should not be in help listings */
|
||||||
CMD_ALIAS = (1 << 1), /* alias of next command in cmd_group */
|
CMD_ALIAS = (1 << 1), /* alias of next command in cmd_group */
|
||||||
CMD_FORMAT_TEXT = (1 << 2), /* output as plain text */
|
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 {
|
struct cmd_struct {
|
||||||
const char *token;
|
const char *token;
|
||||||
|
|
|
@ -30,8 +30,9 @@
|
||||||
#define USAGE_LISTING 8U
|
#define USAGE_LISTING 8U
|
||||||
#define USAGE_FORMAT 16U
|
#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_TEXT, .name = "text" },
|
||||||
|
{ .value = CMD_FORMAT_JSON, .name = "json" },
|
||||||
};
|
};
|
||||||
|
|
||||||
static char argv0_buf[ARGV0_BUF_SIZE] = "btrfs";
|
static char argv0_buf[ARGV0_BUF_SIZE] = "btrfs";
|
||||||
|
|
|
@ -70,7 +70,7 @@ struct format_desc {
|
||||||
char name[8];
|
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);
|
const char *output_format_name(unsigned int value);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue