Btrfs-progs: fix closing of opendir()
[platform/upstream/btrfs-progs.git] / send-utils.h
index fea576c..ed1a40e 100644 (file)
 #ifndef SEND_UTILS_H_
 #define SEND_UTILS_H_
 
+#if BTRFS_FLAT_INCLUDES
 #include "ctree.h"
 #include "rbtree.h"
+#else
+#include <btrfs/ctree.h>
+#include <btrfs/rbtree.h>
+#endif /* BTRFS_FLAT_INCLUDES */
 
 #ifdef __cplusplus
 extern "C" {
@@ -33,10 +38,6 @@ enum subvol_search_type {
 };
 
 struct subvol_info {
-       struct rb_node rb_root_id_node;
-       struct rb_node rb_local_node;
-       struct rb_node rb_received_node;
-       struct rb_node rb_path_node;
        u64 root_id;
        u8 uuid[BTRFS_UUID_SIZE];
        u8 parent_uuid[BTRFS_UUID_SIZE];
@@ -50,13 +51,11 @@ struct subvol_info {
 };
 
 struct subvol_uuid_search {
-       struct rb_root root_id_subvols;
-       struct rb_root local_subvols;
-       struct rb_root received_subvols;
-       struct rb_root path_subvols;
+       int mnt_fd;
 };
 
 int subvol_uuid_search_init(int mnt_fd, struct subvol_uuid_search *s);
+void subvol_uuid_search_finit(struct subvol_uuid_search *s);
 struct subvol_info *subvol_uuid_search(struct subvol_uuid_search *s,
                                       u64 root_id, const u8 *uuid, u64 transid,
                                       const char *path,
@@ -64,7 +63,7 @@ struct subvol_info *subvol_uuid_search(struct subvol_uuid_search *s,
 void subvol_uuid_search_add(struct subvol_uuid_search *s,
                            struct subvol_info *si);
 
-
+int btrfs_subvolid_resolve(int fd, char *path, size_t path_len, u64 subvol_id);
 
 char *path_cat(const char *p1, const char *p2);
 char *path_cat3(const char *p1, const char *p2, const char *p3);