2 * Copyright (C) 2012 Alexander Block. 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.
21 #if BTRFS_FLAT_INCLUDES
25 #include <btrfs/ctree.h>
26 #include <btrfs/rbtree.h>
27 #endif /* BTRFS_FLAT_INCLUDES */
33 enum subvol_search_type {
34 subvol_search_by_root_id,
35 subvol_search_by_uuid,
36 subvol_search_by_received_uuid,
37 subvol_search_by_path,
41 struct rb_node rb_root_id_node;
42 struct rb_node rb_local_node;
43 struct rb_node rb_received_node;
44 struct rb_node rb_path_node;
46 u8 uuid[BTRFS_UUID_SIZE];
47 u8 parent_uuid[BTRFS_UUID_SIZE];
48 u8 received_uuid[BTRFS_UUID_SIZE];
57 struct subvol_uuid_search {
58 struct rb_root root_id_subvols;
59 struct rb_root local_subvols;
60 struct rb_root received_subvols;
61 struct rb_root path_subvols;
64 int subvol_uuid_search_init(int mnt_fd, struct subvol_uuid_search *s);
65 struct subvol_info *subvol_uuid_search(struct subvol_uuid_search *s,
66 u64 root_id, const u8 *uuid, u64 transid,
68 enum subvol_search_type type);
69 void subvol_uuid_search_add(struct subvol_uuid_search *s,
70 struct subvol_info *si);
74 char *path_cat(const char *p1, const char *p2);
75 char *path_cat3(const char *p1, const char *p2, const char *p3);
81 #endif /* SEND_UTILS_H_ */