List block checksums
[btrfs-progs-unstable/devel.git] / send-utils.h
blobda407eba9d95da1d61ed1ae2c8b9c0fce5c82710
1 /*
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.
18 #ifndef SEND_UTILS_H_
19 #define SEND_UTILS_H_
21 #include "ctree.h"
22 #include "rbtree.h"
24 enum subvol_search_type {
25 subvol_search_by_root_id,
26 subvol_search_by_uuid,
27 subvol_search_by_received_uuid,
28 subvol_search_by_path,
31 struct subvol_info {
32 struct rb_node rb_root_id_node;
33 struct rb_node rb_local_node;
34 struct rb_node rb_received_node;
35 struct rb_node rb_path_node;
36 u64 root_id;
37 u8 uuid[BTRFS_UUID_SIZE];
38 u8 parent_uuid[BTRFS_UUID_SIZE];
39 u8 received_uuid[BTRFS_UUID_SIZE];
40 u64 ctransid;
41 u64 otransid;
42 u64 stransid;
43 u64 rtransid;
45 char *path;
48 struct subvol_uuid_search {
49 struct rb_root root_id_subvols;
50 struct rb_root local_subvols;
51 struct rb_root received_subvols;
52 struct rb_root path_subvols;
55 int subvol_uuid_search_init(int mnt_fd, struct subvol_uuid_search *s);
56 struct subvol_info *subvol_uuid_search(struct subvol_uuid_search *s,
57 u64 root_id, const u8 *uuid, u64 transid,
58 const char *path,
59 enum subvol_search_type type);
60 void subvol_uuid_search_add(struct subvol_uuid_search *s,
61 struct subvol_info *si);
65 char *path_cat(const char *p1, const char *p2);
66 char *path_cat3(const char *p1, const char *p2, const char *p3);
69 #endif /* SEND_UTILS_H_ */