diff --git a/cmds/subvolume.c b/cmds/subvolume.c index 65cff24b..cb863ac7 100644 --- a/cmds/subvolume.c +++ b/cmds/subvolume.c @@ -41,9 +41,34 @@ #include "common/open-utils.h" #include "common/string-utils.h" #include "common/units.h" +#include "common/format-output.h" #include "cmds/commands.h" #include "cmds/qgroup.h" +const struct rowspec btrfs_subvolume_rowspec[] = { + { .key = "ID", .fmt = "%llu", .out_json = "id" }, + { .key = "name", .fmt = "%s", .out_json = "name" }, + { .key = "gen", .fmt = "%llu", .out_json = "gen" }, + { .key = "cgen", .fmt = "%llu", .out_json = "cgen" }, + { .key = "parent", .fmt = "%llu", .out_json = "parent" }, + { .key = "top level", .fmt = "%llu", .out_json = "top_level" }, + { .key = "otime", .fmt = "time-long", .out_json = "otime" }, + { .key = "parent_uuid", .fmt = "uuid", .out_json = "parent_uuid" }, + { .key = "received_uuid", .fmt = "uuid", .out_json = "received_uuid" }, + { .key = "uuid", .fmt = "uuid", .out_json = "uuid" }, + { .key = "path", .fmt = "%s", .out_json = "path" }, + { .key = "flag-list-item", .fmt = "%s" }, + { .key = "stransid", .fmt = "%llu", .out_json = "stransid" }, + { .key = "stime", .fmt = "time-long", .out_json = "stime" }, + { .key = "rtransid", .fmt = "%llu", .out_json = "rtransid" }, + { .key = "rtime", .fmt = "time-long", .out_json = "rtime" }, + { .key = "snapshot-list-item", .fmt = "%s" }, + { .key = "quota-group", .fmt = "qgroupid", .out_json = "group" }, + { .key = "quota-ref", .fmt = "%llu", .out_json = "referenced" }, + { .key = "quota-excl", .fmt = "%llu", .out_json = "exclusive" }, + ROWSPEC_END +}; + static int wait_for_subvolume_cleaning(int fd, size_t count, uint64_t *ids, int sleep_interval) { diff --git a/cmds/subvolume.h b/cmds/subvolume.h new file mode 100644 index 00000000..aa999372 --- /dev/null +++ b/cmds/subvolume.h @@ -0,0 +1,24 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License v2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 021110-1307, USA. + */ + +#ifndef __BTRFS_SUBVOLUME_H__ +#define __BTRFS_SUBVOLUME_H__ + +struct rowspec; + +extern const struct rowspec btrfs_subvolume_rowspec[]; + +#endif