aboutsummaryrefslogtreecommitdiffstats
path: root/include/uapi/linux
diff options
context:
space:
mode:
authorChris Mason <chris.mason@fusionio.com>2013-02-20 14:05:45 -0500
committerChris Mason <chris.mason@fusionio.com>2013-02-20 14:05:45 -0500
commitb2c6b3e0611c58fbeb6b9c0892b6249f7bdfaf6b (patch)
treede7cf0825605aa6acf33a8d107003efd7aedbe72 /include/uapi/linux
parent19f949f52599ba7c3f67a5897ac6be14bfcb1200 (diff)
parent272d26d0ad8c0e326689f2fa3cdc6a5fcc8e74e0 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/josef/btrfs-next into for-linus-3.9
Signed-off-by: Chris Mason <chris.mason@fusionio.com> Conflicts: fs/btrfs/disk-io.c
Diffstat (limited to 'include/uapi/linux')
-rw-r--r--include/uapi/linux/Kbuild1
-rw-r--r--include/uapi/linux/btrfs.h514
2 files changed, 515 insertions, 0 deletions
diff --git a/include/uapi/linux/Kbuild b/include/uapi/linux/Kbuild
index 4e67194fd2c3..5c8a1d25e21c 100644
--- a/include/uapi/linux/Kbuild
+++ b/include/uapi/linux/Kbuild
@@ -68,6 +68,7 @@ header-y += blkpg.h
68header-y += blktrace_api.h 68header-y += blktrace_api.h
69header-y += bpqether.h 69header-y += bpqether.h
70header-y += bsg.h 70header-y += bsg.h
71header-y += btrfs.h
71header-y += can.h 72header-y += can.h
72header-y += capability.h 73header-y += capability.h
73header-y += capi.h 74header-y += capi.h
diff --git a/include/uapi/linux/btrfs.h b/include/uapi/linux/btrfs.h
new file mode 100644
index 000000000000..fa3a5f9338fc
--- /dev/null
+++ b/include/uapi/linux/btrfs.h
@@ -0,0 +1,514 @@
1/*
2 * Copyright (C) 2007 Oracle. All rights reserved.
3 *
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.
7 *
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.
12 *
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.
17 */
18
19#ifndef _UAPI_LINUX_BTRFS_H
20#define _UAPI_LINUX_BTRFS_H
21#include <linux/types.h>
22#include <linux/ioctl.h>
23
24#define BTRFS_IOCTL_MAGIC 0x94
25#define BTRFS_VOL_NAME_MAX 255
26
27/* this should be 4k */
28#define BTRFS_PATH_NAME_MAX 4087
29struct btrfs_ioctl_vol_args {
30 __s64 fd;
31 char name[BTRFS_PATH_NAME_MAX + 1];
32};
33
34#define BTRFS_DEVICE_PATH_NAME_MAX 1024
35
36#define BTRFS_SUBVOL_CREATE_ASYNC (1ULL << 0)
37#define BTRFS_SUBVOL_RDONLY (1ULL << 1)
38#define BTRFS_SUBVOL_QGROUP_INHERIT (1ULL << 2)
39#define BTRFS_FSID_SIZE 16
40#define BTRFS_UUID_SIZE 16
41
42#define BTRFS_QGROUP_INHERIT_SET_LIMITS (1ULL << 0)
43
44struct btrfs_qgroup_limit {
45 __u64 flags;
46 __u64 max_rfer;
47 __u64 max_excl;
48 __u64 rsv_rfer;
49 __u64 rsv_excl;
50};
51
52struct btrfs_qgroup_inherit {
53 __u64 flags;
54 __u64 num_qgroups;
55 __u64 num_ref_copies;
56 __u64 num_excl_copies;
57 struct btrfs_qgroup_limit lim;
58 __u64 qgroups[0];
59};
60
61struct btrfs_ioctl_qgroup_limit_args {
62 __u64 qgroupid;
63 struct btrfs_qgroup_limit lim;
64};
65
66#define BTRFS_SUBVOL_NAME_MAX 4039
67struct btrfs_ioctl_vol_args_v2 {
68 __s64 fd;
69 __u64 transid;
70 __u64 flags;
71 union {
72 struct {
73 __u64 size;
74 struct btrfs_qgroup_inherit __user *qgroup_inherit;
75 };
76 __u64 unused[4];
77 };
78 char name[BTRFS_SUBVOL_NAME_MAX + 1];
79};
80
81/*
82 * structure to report errors and progress to userspace, either as a
83 * result of a finished scrub, a canceled scrub or a progress inquiry
84 */
85struct btrfs_scrub_progress {
86 __u64 data_extents_scrubbed; /* # of data extents scrubbed */
87 __u64 tree_extents_scrubbed; /* # of tree extents scrubbed */
88 __u64 data_bytes_scrubbed; /* # of data bytes scrubbed */
89 __u64 tree_bytes_scrubbed; /* # of tree bytes scrubbed */
90 __u64 read_errors; /* # of read errors encountered (EIO) */
91 __u64 csum_errors; /* # of failed csum checks */
92 __u64 verify_errors; /* # of occurences, where the metadata
93 * of a tree block did not match the
94 * expected values, like generation or
95 * logical */
96 __u64 no_csum; /* # of 4k data block for which no csum
97 * is present, probably the result of
98 * data written with nodatasum */
99 __u64 csum_discards; /* # of csum for which no data was found
100 * in the extent tree. */
101 __u64 super_errors; /* # of bad super blocks encountered */
102 __u64 malloc_errors; /* # of internal kmalloc errors. These
103 * will likely cause an incomplete
104 * scrub */
105 __u64 uncorrectable_errors; /* # of errors where either no intact
106 * copy was found or the writeback
107 * failed */
108 __u64 corrected_errors; /* # of errors corrected */
109 __u64 last_physical; /* last physical address scrubbed. In
110 * case a scrub was aborted, this can
111 * be used to restart the scrub */
112 __u64 unverified_errors; /* # of occurences where a read for a
113 * full (64k) bio failed, but the re-
114 * check succeeded for each 4k piece.
115 * Intermittent error. */
116};
117
118#define BTRFS_SCRUB_READONLY 1
119struct btrfs_ioctl_scrub_args {
120 __u64 devid; /* in */
121 __u64 start; /* in */
122 __u64 end; /* in */
123 __u64 flags; /* in */
124 struct btrfs_scrub_progress progress; /* out */
125 /* pad to 1k */
126 __u64 unused[(1024-32-sizeof(struct btrfs_scrub_progress))/8];
127};
128
129#define BTRFS_IOCTL_DEV_REPLACE_CONT_READING_FROM_SRCDEV_MODE_ALWAYS 0
130#define BTRFS_IOCTL_DEV_REPLACE_CONT_READING_FROM_SRCDEV_MODE_AVOID 1
131struct btrfs_ioctl_dev_replace_start_params {
132 __u64 srcdevid; /* in, if 0, use srcdev_name instead */
133 __u64 cont_reading_from_srcdev_mode; /* in, see #define
134 * above */
135 __u8 srcdev_name[BTRFS_DEVICE_PATH_NAME_MAX + 1]; /* in */
136 __u8 tgtdev_name[BTRFS_DEVICE_PATH_NAME_MAX + 1]; /* in */
137};
138
139#define BTRFS_IOCTL_DEV_REPLACE_STATE_NEVER_STARTED 0
140#define BTRFS_IOCTL_DEV_REPLACE_STATE_STARTED 1
141#define BTRFS_IOCTL_DEV_REPLACE_STATE_FINISHED 2
142#define BTRFS_IOCTL_DEV_REPLACE_STATE_CANCELED 3
143#define BTRFS_IOCTL_DEV_REPLACE_STATE_SUSPENDED 4
144struct btrfs_ioctl_dev_replace_status_params {
145 __u64 replace_state; /* out, see #define above */
146 __u64 progress_1000; /* out, 0 <= x <= 1000 */
147 __u64 time_started; /* out, seconds since 1-Jan-1970 */
148 __u64 time_stopped; /* out, seconds since 1-Jan-1970 */
149 __u64 num_write_errors; /* out */
150 __u64 num_uncorrectable_read_errors; /* out */
151};
152
153#define BTRFS_IOCTL_DEV_REPLACE_CMD_START 0
154#define BTRFS_IOCTL_DEV_REPLACE_CMD_STATUS 1
155#define BTRFS_IOCTL_DEV_REPLACE_CMD_CANCEL 2
156#define BTRFS_IOCTL_DEV_REPLACE_RESULT_NO_ERROR 0
157#define BTRFS_IOCTL_DEV_REPLACE_RESULT_NOT_STARTED 1
158#define BTRFS_IOCTL_DEV_REPLACE_RESULT_ALREADY_STARTED 2
159struct btrfs_ioctl_dev_replace_args {
160 __u64 cmd; /* in */
161 __u64 result; /* out */
162
163 union {
164 struct btrfs_ioctl_dev_replace_start_params start;
165 struct btrfs_ioctl_dev_replace_status_params status;
166 }; /* in/out */
167
168 __u64 spare[64];
169};
170
171struct btrfs_ioctl_dev_info_args {
172 __u64 devid; /* in/out */
173 __u8 uuid[BTRFS_UUID_SIZE]; /* in/out */
174 __u64 bytes_used; /* out */
175 __u64 total_bytes; /* out */