2 * Copyright (C) 2012 Fujitsu. All rights reserved.
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public
6 * License v2 as published by the Free Software Foundation.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
13 * You should have received a copy of the GNU General Public
14 * License along with this program; if not, write to the
15 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
16 * Boston, MA 021110-1307, USA.
19 #include "kerncompat.h"
23 typedef int (*btrfs_list_filter_func)(struct root_info *, u64);
24 typedef int (*btrfs_list_comp_func)(struct root_info *, struct root_info *,
27 struct btrfs_list_filter {
28 btrfs_list_filter_func filter_func;
32 struct btrfs_list_comparer {
33 btrfs_list_comp_func comp_func;
37 struct btrfs_list_filter_set {
40 struct btrfs_list_filter filters[0];
43 struct btrfs_list_comparer_set {
46 struct btrfs_list_comparer comps[0];
49 enum btrfs_list_column_enum {
51 BTRFS_LIST_GENERATION,
52 BTRFS_LIST_OGENERATION,
61 enum btrfs_list_filter_enum {
62 BTRFS_LIST_FILTER_ROOTID,
63 BTRFS_LIST_FILTER_SNAPSHOT_ONLY,
64 BTRFS_LIST_FILTER_FLAGS,
65 BTRFS_LIST_FILTER_GEN,
66 BTRFS_LIST_FILTER_GEN_EQUAL = BTRFS_LIST_FILTER_GEN,
67 BTRFS_LIST_FILTER_GEN_LESS,
68 BTRFS_LIST_FILTER_GEN_MORE,
69 BTRFS_LIST_FILTER_CGEN,
70 BTRFS_LIST_FILTER_CGEN_EQUAL = BTRFS_LIST_FILTER_CGEN,
71 BTRFS_LIST_FILTER_CGEN_LESS,
72 BTRFS_LIST_FILTER_CGEN_MORE,
73 BTRFS_LIST_FILTER_TOPID_EQUAL,
74 BTRFS_LIST_FILTER_MAX,
77 enum btrfs_list_comp_enum {
78 BTRFS_LIST_COMP_ROOTID,
85 int btrfs_list_parse_sort_string(char *optarg,
86 struct btrfs_list_comparer_set **comps);
87 int btrfs_list_parse_filter_string(char *optarg,
88 struct btrfs_list_filter_set **filters,
89 enum btrfs_list_filter_enum type);
90 void btrfs_list_setup_print_column(enum btrfs_list_column_enum column);
91 struct btrfs_list_filter_set *btrfs_list_alloc_filter_set(void);
92 void btrfs_list_free_filter_set(struct btrfs_list_filter_set *filter_set);
93 int btrfs_list_setup_filter(struct btrfs_list_filter_set **filter_set,
94 enum btrfs_list_filter_enum filter, u64 data);
95 struct btrfs_list_comparer_set *btrfs_list_alloc_comparer_set(void);
96 void btrfs_list_free_comparer_set(struct btrfs_list_comparer_set *comp_set);
97 int btrfs_list_setup_comparer(struct btrfs_list_comparer_set **comp_set,
98 enum btrfs_list_comp_enum comparer,
101 int btrfs_list_subvols(int fd, struct btrfs_list_filter_set *filter_set,
102 struct btrfs_list_comparer_set *comp_set,
104 int btrfs_list_find_updated_files(int fd, u64 root_id, u64 oldest_gen);
105 int btrfs_list_get_default_subvolume(int fd, u64 *default_id);
106 char *btrfs_list_path_for_root(int fd, u64 root);
107 u64 btrfs_list_get_path_rootid(int fd);