btrfs-progs: move uuid-tree definitions to kernel-shared/uuid-tree.h

Currently we already have a kernel-shared/uuid-tree.c, which is mostly
shared with kernel.

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

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>
This commit is contained in:
Qu Wenruo 2024-07-26 18:10:50 +09:30 committed by David Sterba
parent 32ab0e6328
commit 8efa8092aa
6 changed files with 37 additions and 11 deletions

View File

@ -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"

View File

@ -49,6 +49,7 @@ Status and progress of kernel/userspace synchronization.
- ulist.c - done
- ulist.h - done
- uuid-tree.c - partial
- uuid-tree.h - partial, local changes
- volumes.c - todo, local changes
- volumes.h - todo, local changes
- zoned.c - todo

View File

@ -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);

View File

@ -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"

33
kernel-shared/uuid-tree.h Normal file
View File

@ -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

View File

@ -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"