blob: 622a9987be05b515651059f83c7e57f2747c634a [file] [log] [blame]
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -07001/****************************************************************************
2 ****************************************************************************
3 ***
4 *** This header was automatically generated from a Linux kernel header
5 *** of the same name, to make information necessary for userspace to
6 *** call into the kernel available to libc. It contains only constants,
7 *** structures, and macros generated from the original header, and thus,
8 *** contains no copyrightable information.
9 ***
10 *** To edit the content of this header, modify the corresponding
11 *** source file (e.g. under external/kernel-headers/original/) then
12 *** run bionic/libc/kernel/tools/update_all.py
13 ***
14 *** Any manual change here will be lost the next time this script will
15 *** be run. You've been warned!
16 ***
17 ****************************************************************************
18 ****************************************************************************/
19#ifndef _UAPI_LINUX_INCREMENTALFS_H
20#define _UAPI_LINUX_INCREMENTALFS_H
21#include <linux/limits.h>
22#include <linux/ioctl.h>
23#include <linux/types.h>
24#include <linux/xattr.h>
25#define INCFS_NAME "incremental-fs"
Christopher Ferrisa9750ed2021-05-03 14:02:49 -070026#define INCFS_MAGIC_NUMBER (0x5346434e49ul & ULONG_MAX)
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -070027#define INCFS_DATA_FILE_BLOCK_SIZE 4096
28#define INCFS_HEADER_VER 1
29#define INCFS_MAX_HASH_SIZE 32
30#define INCFS_MAX_FILE_ATTR_SIZE 512
Christopher Ferris05667cd2021-02-16 16:01:34 -080031#define INCFS_INDEX_NAME ".index"
32#define INCFS_INCOMPLETE_NAME ".incomplete"
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -070033#define INCFS_PENDING_READS_FILENAME ".pending_reads"
34#define INCFS_LOG_FILENAME ".log"
Christopher Ferris25c18d42020-10-14 17:42:58 -070035#define INCFS_BLOCKS_WRITTEN_FILENAME ".blocks_written"
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -070036#define INCFS_XATTR_ID_NAME (XATTR_USER_PREFIX "incfs.id")
37#define INCFS_XATTR_SIZE_NAME (XATTR_USER_PREFIX "incfs.size")
38#define INCFS_XATTR_METADATA_NAME (XATTR_USER_PREFIX "incfs.metadata")
Christopher Ferris05667cd2021-02-16 16:01:34 -080039#define INCFS_XATTR_VERITY_NAME (XATTR_USER_PREFIX "incfs.verity")
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -070040#define INCFS_MAX_SIGNATURE_SIZE 8096
41#define INCFS_SIGNATURE_VERSION 2
42#define INCFS_SIGNATURE_SECTIONS 2
43#define INCFS_IOCTL_BASE_CODE 'g'
44#define INCFS_IOC_CREATE_FILE _IOWR(INCFS_IOCTL_BASE_CODE, 30, struct incfs_new_file_args)
45#define INCFS_IOC_READ_FILE_SIGNATURE _IOR(INCFS_IOCTL_BASE_CODE, 31, struct incfs_get_file_sig_args)
46#define INCFS_IOC_FILL_BLOCKS _IOR(INCFS_IOCTL_BASE_CODE, 32, struct incfs_fill_blocks)
47#define INCFS_IOC_PERMIT_FILL _IOW(INCFS_IOCTL_BASE_CODE, 33, struct incfs_permit_fill)
48#define INCFS_IOC_GET_FILLED_BLOCKS _IOR(INCFS_IOCTL_BASE_CODE, 34, struct incfs_get_filled_blocks_args)
Christopher Ferris25c18d42020-10-14 17:42:58 -070049#define INCFS_IOC_CREATE_MAPPED_FILE _IOWR(INCFS_IOCTL_BASE_CODE, 35, struct incfs_create_mapped_file_args)
50#define INCFS_IOC_GET_BLOCK_COUNT _IOR(INCFS_IOCTL_BASE_CODE, 36, struct incfs_get_block_count_args)
51#define INCFS_IOC_GET_READ_TIMEOUTS _IOR(INCFS_IOCTL_BASE_CODE, 37, struct incfs_get_read_timeouts_args)
52#define INCFS_IOC_SET_READ_TIMEOUTS _IOW(INCFS_IOCTL_BASE_CODE, 38, struct incfs_set_read_timeouts_args)
Christopher Ferrisa9750ed2021-05-03 14:02:49 -070053#define INCFS_IOC_GET_LAST_READ_ERROR _IOW(INCFS_IOCTL_BASE_CODE, 39, struct incfs_get_last_read_error_args)
Christopher Ferris25c18d42020-10-14 17:42:58 -070054#define INCFS_FEATURE_FLAG_COREFS "corefs"
Christopher Ferris32ff3f82020-12-14 13:10:04 -080055#define INCFS_FEATURE_FLAG_ZSTD "zstd"
56#define INCFS_FEATURE_FLAG_V2 "v2"
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -070057enum incfs_compression_alg {
58 COMPRESSION_NONE = 0,
Christopher Ferris32ff3f82020-12-14 13:10:04 -080059 COMPRESSION_LZ4 = 1,
60 COMPRESSION_ZSTD = 2,
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -070061};
62enum incfs_block_flags {
63 INCFS_BLOCK_FLAGS_NONE = 0,
64 INCFS_BLOCK_FLAGS_HASH = 1,
65};
66typedef struct {
67 __u8 bytes[16];
68} incfs_uuid_t __attribute__((aligned(8)));
69struct incfs_pending_read_info {
70 incfs_uuid_t file_id;
71 __aligned_u64 timestamp_us;
72 __u32 block_index;
73 __u32 serial_number;
74};
Christopher Ferris25c18d42020-10-14 17:42:58 -070075struct incfs_pending_read_info2 {
76 incfs_uuid_t file_id;
77 __aligned_u64 timestamp_us;
78 __u32 block_index;
79 __u32 serial_number;
80 __u32 uid;
81 __u32 reserved;
82};
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -070083struct incfs_fill_block {
84 __u32 block_index;
85 __u32 data_len;
86 __aligned_u64 data;
87 __u8 compression;
88 __u8 flags;
89 __u16 reserved1;
90 __u32 reserved2;
91 __aligned_u64 reserved3;
92};
93struct incfs_fill_blocks {
94 __u64 count;
95 __aligned_u64 fill_blocks;
96};
97struct incfs_permit_fill {
98 __u32 file_descriptor;
99};
100enum incfs_hash_tree_algorithm {
101 INCFS_HASH_TREE_NONE = 0,
102 INCFS_HASH_TREE_SHA256 = 1
103};
104struct incfs_new_file_args {
105 incfs_uuid_t file_id;
106 __aligned_u64 size;
107 __u16 mode;
108 __u16 reserved1;
109 __u32 reserved2;
110 __aligned_u64 directory_path;
111 __aligned_u64 file_name;
112 __aligned_u64 file_attr;
113 __u32 file_attr_len;
114 __u32 reserved4;
115 __aligned_u64 signature_info;
116 __aligned_u64 signature_size;
117 __aligned_u64 reserved6;
118};
119struct incfs_get_file_sig_args {
120 __aligned_u64 file_signature;
121 __u32 file_signature_buf_size;
122 __u32 file_signature_len_out;
123};
124struct incfs_filled_range {
125 __u32 begin;
126 __u32 end;
127};
128struct incfs_get_filled_blocks_args {
129 __aligned_u64 range_buffer;
130 __u32 range_buffer_size;
131 __u32 start_index;
132 __u32 end_index;
133 __u32 total_blocks_out;
Christopher Ferrisaf09c702020-06-01 20:29:29 -0700134 __u32 data_blocks_out;
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -0700135 __u32 range_buffer_size_out;
136 __u32 index_out;
137};
Christopher Ferris25c18d42020-10-14 17:42:58 -0700138struct incfs_create_mapped_file_args {
139 __aligned_u64 size;
140 __u16 mode;
141 __u16 reserved1;
142 __u32 reserved2;
143 __aligned_u64 directory_path;
144 __aligned_u64 file_name;
145 incfs_uuid_t source_file_id;
146 __aligned_u64 source_offset;
147};
148struct incfs_get_block_count_args {
149 __u32 total_data_blocks_out;
150 __u32 filled_data_blocks_out;
151 __u32 total_hash_blocks_out;
152 __u32 filled_hash_blocks_out;
153};
154struct incfs_per_uid_read_timeouts {
155 __u32 uid;
Christopher Ferris32ff3f82020-12-14 13:10:04 -0800156 __u32 min_time_us;
157 __u32 min_pending_time_us;
158 __u32 max_pending_time_us;
Christopher Ferris25c18d42020-10-14 17:42:58 -0700159};
160struct incfs_get_read_timeouts_args {
161 __aligned_u64 timeouts_array;
162 __u32 timeouts_array_size;
163 __u32 timeouts_array_size_out;
164};
165struct incfs_set_read_timeouts_args {
166 __aligned_u64 timeouts_array;
167 __u32 timeouts_array_size;
168};
Christopher Ferrisa9750ed2021-05-03 14:02:49 -0700169struct incfs_get_last_read_error_args {
170 incfs_uuid_t file_id_out;
171 __u64 time_us_out;
172 __u32 page_out;
173 __u32 errno_out;
174 __u64 reserved;
175};
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -0700176#endif