diff mbox series

[1/3] btrfs-progs: move uuid-tree definitions to kernel-shared/uuid-tree.h

Message ID 45ed3fd946a07b7ccd3bfda9c3d34c50beb1c7ad.1721987605.git.wqu@suse.com (mailing list archive)
State New, archived
Headers show
Series btrfs-progs: a more generic uuid tree rebuild ability | expand

Commit Message

Qu Wenruo July 26, 2024, 9:59 a.m. UTC
Currently we already have a kernel-shared/uuid-tree.c, which is mostly
shared with kernel already.

Meanwhile kernel also has a uuid-tree.h, but we are still using ctree.h
for the header.

Just move all the uuid-tree related definitions to
kernel-shared/uuid-tree.h, making future code sync easier.

Signed-off-by: Qu Wenruo <wqu@suse.com>
---
 common/send-utils.c       |  1 +
 kernel-shared/ctree.h     | 11 -----------
 kernel-shared/uuid-tree.c |  1 +
 kernel-shared/uuid-tree.h | 33 +++++++++++++++++++++++++++++++++
 mkfs/main.c               |  1 +
 5 files changed, 36 insertions(+), 11 deletions(-)
 create mode 100644 kernel-shared/uuid-tree.h
diff mbox series

Patch

diff --git a/common/send-utils.c b/common/send-utils.c
index 173333e30a38..8c13ffa1e106 100644
--- a/common/send-utils.c
+++ b/common/send-utils.c
@@ -29,6 +29,7 @@ 
 #include "kernel-shared/uapi/btrfs_tree.h"
 #include "kernel-shared/uapi/btrfs.h"
 #include "kernel-shared/ctree.h"
+#include "kernel-shared/uuid-tree.h"
 #include "common/send-utils.h"
 #include "common/messages.h"
 #include "common/utils.h"
diff --git a/kernel-shared/ctree.h b/kernel-shared/ctree.h
index 2388879d1db3..7761b3f6fb1b 100644
--- a/kernel-shared/ctree.h
+++ b/kernel-shared/ctree.h
@@ -1192,15 +1192,6 @@  int btrfs_del_inode_ref(struct btrfs_trans_handle *trans,
 			struct btrfs_root *root, const char *name, int name_len,
 			u64 ino, u64 parent_ino, u64 *index);
 
-/* uuid-tree.c, interface for mounted mounted filesystem */
-int btrfs_lookup_uuid_subvol_item(int fd, const u8 *uuid, u64 *subvol_id);
-int btrfs_lookup_uuid_received_subvol_item(int fd, const u8 *uuid,
-					   u64 *subvol_id);
-
-/* uuid-tree.c, interface for unmounte filesystem */
-int btrfs_uuid_tree_remove(struct btrfs_trans_handle *trans, u8 *uuid, u8 type,
-			   u64 subid);
-
 static inline int is_fstree(u64 rootid)
 {
 	if (rootid == BTRFS_FS_TREE_OBJECTID ||
@@ -1209,8 +1200,6 @@  static inline int is_fstree(u64 rootid)
 	return 0;
 }
 
-void btrfs_uuid_to_key(const u8 *uuid, u8 type, struct btrfs_key *key);
-
 /* inode.c */
 int btrfs_find_free_dir_index(struct btrfs_root *root, u64 dir_ino,
 			      u64 *ret_ino);
diff --git a/kernel-shared/uuid-tree.c b/kernel-shared/uuid-tree.c
index 766cd31e4234..26359520d57c 100644
--- a/kernel-shared/uuid-tree.c
+++ b/kernel-shared/uuid-tree.c
@@ -29,6 +29,7 @@ 
 #include "kernel-shared/ctree.h"
 #include "kernel-shared/messages.h"
 #include "kernel-shared/transaction.h"
+#include "kernel-shared/uuid-tree.h"
 #include "common/messages.h"
 #include "common/utils.h"
 
diff --git a/kernel-shared/uuid-tree.h b/kernel-shared/uuid-tree.h
new file mode 100644
index 000000000000..0cdc2228c44f
--- /dev/null
+++ b/kernel-shared/uuid-tree.h
@@ -0,0 +1,33 @@ 
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License v2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 021110-1307, USA.
+ */
+
+#ifndef __BTRFS_UUID_TREE_H__
+#define __BTRFS_UUID_TREE_H__
+
+#include "kerncompat.h"
+#include "kernel-shared/uapi/btrfs_tree.h"
+
+/* uuid-tree.c, interface for mounted mounted filesystem */
+int btrfs_lookup_uuid_subvol_item(int fd, const u8 *uuid, u64 *subvol_id);
+int btrfs_lookup_uuid_received_subvol_item(int fd, const u8 *uuid,
+					   u64 *subvol_id);
+
+/* uuid-tree.c, interface for unmounte filesystem */
+int btrfs_uuid_tree_remove(struct btrfs_trans_handle *trans, u8 *uuid, u8 type,
+			   u64 subid);
+void btrfs_uuid_to_key(const u8 *uuid, u8 type, struct btrfs_key *key);
+
+#endif
diff --git a/mkfs/main.c b/mkfs/main.c
index cf5cae45d02a..9a6047f7296b 100644
--- a/mkfs/main.c
+++ b/mkfs/main.c
@@ -41,6 +41,7 @@ 
 #include "kernel-shared/volumes.h"
 #include "kernel-shared/transaction.h"
 #include "kernel-shared/zoned.h"
+#include "kernel-shared/uuid-tree.h"
 #include "crypto/hash.h"
 #include "common/defs.h"
 #include "common/internal.h"