diff options
author | Chris Mason <chris.mason@oracle.com> | 2010-02-28 15:39:26 -0500 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2010-03-15 10:55:10 -0400 |
commit | ac8e9819d71f907a0532b01b22c26b56bbbcbd21 (patch) | |
tree | 5bdebf68182139e664b59286f6f7071e3ada2b18 /fs/btrfs/ioctl.h | |
parent | 98d377a0894e6bcca44eafd4d2eee74e8af4db83 (diff) |
Btrfs: add search and inode lookup ioctls
The search ioctl is a generic tool for doing btree searches from
userland applications. The first user of the search ioctl is a
subvolume listing feature, but we'll also use it to find new
files in a subvolume.
The search ioctl allows you to specify min and max keys to search for,
along with min and max transid. It returns the items along with a
header that includes the item key.
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/ioctl.h')
-rw-r--r-- | fs/btrfs/ioctl.h | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/fs/btrfs/ioctl.h b/fs/btrfs/ioctl.h index bc49914475eb..79c07b104f91 100644 --- a/fs/btrfs/ioctl.h +++ b/fs/btrfs/ioctl.h | |||
@@ -30,6 +30,68 @@ struct btrfs_ioctl_vol_args { | |||
30 | char name[BTRFS_PATH_NAME_MAX + 1]; | 30 | char name[BTRFS_PATH_NAME_MAX + 1]; |
31 | }; | 31 | }; |
32 | 32 | ||
33 | #define BTRFS_INO_LOOKUP_PATH_MAX 4080 | ||
34 | struct btrfs_ioctl_ino_lookup_args { | ||
35 | __u64 treeid; | ||
36 | __u64 objectid; | ||
37 | char name[BTRFS_INO_LOOKUP_PATH_MAX]; | ||
38 | }; | ||
39 | |||
40 | struct btrfs_ioctl_search_key { | ||
41 | /* which root are we searching. 0 is the tree of tree roots */ | ||
42 | __u64 tree_id; | ||
43 | |||
44 | /* keys returned will be >= min and <= max */ | ||
45 | __u64 min_objectid; | ||
46 | __u64 max_objectid; | ||
47 | |||
48 | /* keys returned will be >= min and <= max */ | ||
49 | __u64 min_offset; | ||
50 | __u64 max_offset; | ||
51 | |||
52 | /* max and min transids to search for */ | ||
53 | __u64 min_transid; | ||
54 | __u64 max_transid; | ||
55 | |||
56 | /* keys returned will be >= min and <= max */ | ||
57 | __u32 min_type; | ||
58 | __u32 max_type; | ||
59 | |||
60 | /* | ||
61 | * how many items did userland ask for, and how many are we | ||
62 | * returning | ||
63 | */ | ||
64 | __u32 nr_items; | ||
65 | |||
66 | /* align to 64 bits */ | ||
67 | __u32 unused; | ||
68 | |||
69 | /* some extra for later */ | ||
70 | __u64 unused1; | ||
71 | __u64 unused2; | ||
72 | __u64 unused3; | ||
73 | __u64 unused4; | ||
74 | }; | ||
75 | |||
76 | struct btrfs_ioctl_search_header { | ||
77 | __u64 transid; | ||
78 | __u64 objectid; | ||
79 | __u64 offset; | ||
80 | __u32 type; | ||
81 | __u32 len; | ||
82 | }; | ||
83 | |||
84 | #define BTRFS_SEARCH_ARGS_BUFSIZE (4096 - sizeof(struct btrfs_ioctl_search_key)) | ||
85 | /* | ||
86 | * the buf is an array of search headers where | ||
87 | * each header is followed by the actual item | ||
88 | * the type field is expanded to 32 bits for alignment | ||
89 | */ | ||
90 | struct btrfs_ioctl_search_args { | ||
91 | struct btrfs_ioctl_search_key key; | ||
92 | char buf[BTRFS_SEARCH_ARGS_BUFSIZE]; | ||
93 | }; | ||
94 | |||
33 | struct btrfs_ioctl_clone_range_args { | 95 | struct btrfs_ioctl_clone_range_args { |
34 | __s64 src_fd; | 96 | __s64 src_fd; |
35 | __u64 src_offset, src_length; | 97 | __u64 src_offset, src_length; |
@@ -67,4 +129,8 @@ struct btrfs_ioctl_clone_range_args { | |||
67 | struct btrfs_ioctl_vol_args) | 129 | struct btrfs_ioctl_vol_args) |
68 | #define BTRFS_IOC_SNAP_DESTROY _IOW(BTRFS_IOCTL_MAGIC, 15, \ | 130 | #define BTRFS_IOC_SNAP_DESTROY _IOW(BTRFS_IOCTL_MAGIC, 15, \ |
69 | struct btrfs_ioctl_vol_args) | 131 | struct btrfs_ioctl_vol_args) |
132 | #define BTRFS_IOC_TREE_SEARCH _IOWR(BTRFS_IOCTL_MAGIC, 17, \ | ||
133 | struct btrfs_ioctl_search_args) | ||
134 | #define BTRFS_IOC_INO_LOOKUP _IOWR(BTRFS_IOCTL_MAGIC, 18, \ | ||
135 | struct btrfs_ioctl_ino_lookup_args) | ||
70 | #endif | 136 | #endif |