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_MAX,
68 enum btrfs_list_comp_enum {
69 BTRFS_LIST_COMP_ROOTID,
75 void btrfs_list_setup_print_column(enum btrfs_list_column_enum column);
76 struct btrfs_list_filter_set *btrfs_list_alloc_filter_set(void);
77 void btrfs_list_free_filter_set(struct btrfs_list_filter_set *filter_set);
78 int btrfs_list_setup_filter(struct btrfs_list_filter_set **filter_set,
79 enum btrfs_list_filter_enum filter, u64 data);
80 struct btrfs_list_comparer_set *btrfs_list_alloc_comparer_set(void);
81 void btrfs_list_free_comparer_set(struct btrfs_list_comparer_set *comp_set);
82 int btrfs_list_setup_comparer(struct btrfs_list_comparer_set **comp_set,
83 enum btrfs_list_comp_enum comparer,
86 int btrfs_list_subvols(int fd, struct btrfs_list_filter_set *filter_set,
87 struct btrfs_list_comparer_set *comp_set);
88 int btrfs_list_find_updated_files(int fd, u64 root_id, u64 oldest_gen);
89 int btrfs_list_get_default_subvolume(int fd, u64 *default_id);
90 char *btrfs_list_path_for_root(int fd, u64 root);