• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * This file is auto-generated. Modifications will be lost.
3  *
4  * See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
5  * for more information.
6  */
7 #ifndef _UAPI_LINUX_INCREMENTALFS_H
8 #define _UAPI_LINUX_INCREMENTALFS_H
9 #include <linux/limits.h>
10 #include <linux/ioctl.h>
11 #include <linux/types.h>
12 #include <linux/xattr.h>
13 #define INCFS_NAME "incremental-fs"
14 #define INCFS_MAGIC_NUMBER (0x5346434e49ul & ULONG_MAX)
15 #define INCFS_DATA_FILE_BLOCK_SIZE 4096
16 #define INCFS_HEADER_VER 1
17 #define INCFS_MAX_HASH_SIZE 32
18 #define INCFS_MAX_FILE_ATTR_SIZE 512
19 #define INCFS_INDEX_NAME ".index"
20 #define INCFS_INCOMPLETE_NAME ".incomplete"
21 #define INCFS_PENDING_READS_FILENAME ".pending_reads"
22 #define INCFS_LOG_FILENAME ".log"
23 #define INCFS_BLOCKS_WRITTEN_FILENAME ".blocks_written"
24 #define INCFS_XATTR_ID_NAME (XATTR_USER_PREFIX "incfs.id")
25 #define INCFS_XATTR_SIZE_NAME (XATTR_USER_PREFIX "incfs.size")
26 #define INCFS_XATTR_METADATA_NAME (XATTR_USER_PREFIX "incfs.metadata")
27 #define INCFS_XATTR_VERITY_NAME (XATTR_USER_PREFIX "incfs.verity")
28 #define INCFS_MAX_SIGNATURE_SIZE 8096
29 #define INCFS_SIGNATURE_VERSION 2
30 #define INCFS_SIGNATURE_SECTIONS 2
31 #define INCFS_IOCTL_BASE_CODE 'g'
32 #define INCFS_IOC_CREATE_FILE _IOWR(INCFS_IOCTL_BASE_CODE, 30, struct incfs_new_file_args)
33 #define INCFS_IOC_READ_FILE_SIGNATURE _IOR(INCFS_IOCTL_BASE_CODE, 31, struct incfs_get_file_sig_args)
34 #define INCFS_IOC_FILL_BLOCKS _IOR(INCFS_IOCTL_BASE_CODE, 32, struct incfs_fill_blocks)
35 #define INCFS_IOC_PERMIT_FILL _IOW(INCFS_IOCTL_BASE_CODE, 33, struct incfs_permit_fill)
36 #define INCFS_IOC_GET_FILLED_BLOCKS _IOR(INCFS_IOCTL_BASE_CODE, 34, struct incfs_get_filled_blocks_args)
37 #define INCFS_IOC_CREATE_MAPPED_FILE _IOWR(INCFS_IOCTL_BASE_CODE, 35, struct incfs_create_mapped_file_args)
38 #define INCFS_IOC_GET_BLOCK_COUNT _IOR(INCFS_IOCTL_BASE_CODE, 36, struct incfs_get_block_count_args)
39 #define INCFS_IOC_GET_READ_TIMEOUTS _IOR(INCFS_IOCTL_BASE_CODE, 37, struct incfs_get_read_timeouts_args)
40 #define INCFS_IOC_SET_READ_TIMEOUTS _IOW(INCFS_IOCTL_BASE_CODE, 38, struct incfs_set_read_timeouts_args)
41 #define INCFS_IOC_GET_LAST_READ_ERROR _IOW(INCFS_IOCTL_BASE_CODE, 39, struct incfs_get_last_read_error_args)
42 #define INCFS_FEATURE_FLAG_COREFS "corefs"
43 #define INCFS_FEATURE_FLAG_ZSTD "zstd"
44 #define INCFS_FEATURE_FLAG_V2 "v2"
45 enum incfs_compression_alg {
46   COMPRESSION_NONE = 0,
47   COMPRESSION_LZ4 = 1,
48   COMPRESSION_ZSTD = 2,
49 };
50 enum incfs_block_flags {
51   INCFS_BLOCK_FLAGS_NONE = 0,
52   INCFS_BLOCK_FLAGS_HASH = 1,
53 };
54 typedef struct {
55   __u8 bytes[16];
56 } incfs_uuid_t __attribute__((aligned(8)));
57 struct incfs_pending_read_info {
58   incfs_uuid_t file_id;
59   __aligned_u64 timestamp_us;
60   __u32 block_index;
61   __u32 serial_number;
62 };
63 struct incfs_pending_read_info2 {
64   incfs_uuid_t file_id;
65   __aligned_u64 timestamp_us;
66   __u32 block_index;
67   __u32 serial_number;
68   __u32 uid;
69   __u32 reserved;
70 };
71 struct incfs_fill_block {
72   __u32 block_index;
73   __u32 data_len;
74   __aligned_u64 data;
75   __u8 compression;
76   __u8 flags;
77   __u16 reserved1;
78   __u32 reserved2;
79   __aligned_u64 reserved3;
80 };
81 struct incfs_fill_blocks {
82   __u64 count;
83   __aligned_u64 fill_blocks;
84 };
85 struct incfs_permit_fill {
86   __u32 file_descriptor;
87 };
88 enum incfs_hash_tree_algorithm {
89   INCFS_HASH_TREE_NONE = 0,
90   INCFS_HASH_TREE_SHA256 = 1
91 };
92 struct incfs_new_file_args {
93   incfs_uuid_t file_id;
94   __aligned_u64 size;
95   __u16 mode;
96   __u16 reserved1;
97   __u32 reserved2;
98   __aligned_u64 directory_path;
99   __aligned_u64 file_name;
100   __aligned_u64 file_attr;
101   __u32 file_attr_len;
102   __u32 reserved4;
103   __aligned_u64 signature_info;
104   __aligned_u64 signature_size;
105   __aligned_u64 reserved6;
106 };
107 struct incfs_get_file_sig_args {
108   __aligned_u64 file_signature;
109   __u32 file_signature_buf_size;
110   __u32 file_signature_len_out;
111 };
112 struct incfs_filled_range {
113   __u32 begin;
114   __u32 end;
115 };
116 struct incfs_get_filled_blocks_args {
117   __aligned_u64 range_buffer;
118   __u32 range_buffer_size;
119   __u32 start_index;
120   __u32 end_index;
121   __u32 total_blocks_out;
122   __u32 data_blocks_out;
123   __u32 range_buffer_size_out;
124   __u32 index_out;
125 };
126 struct incfs_create_mapped_file_args {
127   __aligned_u64 size;
128   __u16 mode;
129   __u16 reserved1;
130   __u32 reserved2;
131   __aligned_u64 directory_path;
132   __aligned_u64 file_name;
133   incfs_uuid_t source_file_id;
134   __aligned_u64 source_offset;
135 };
136 struct incfs_get_block_count_args {
137   __u32 total_data_blocks_out;
138   __u32 filled_data_blocks_out;
139   __u32 total_hash_blocks_out;
140   __u32 filled_hash_blocks_out;
141 };
142 struct incfs_per_uid_read_timeouts {
143   __u32 uid;
144   __u32 min_time_us;
145   __u32 min_pending_time_us;
146   __u32 max_pending_time_us;
147 };
148 struct incfs_get_read_timeouts_args {
149   __aligned_u64 timeouts_array;
150   __u32 timeouts_array_size;
151   __u32 timeouts_array_size_out;
152 };
153 struct incfs_set_read_timeouts_args {
154   __aligned_u64 timeouts_array;
155   __u32 timeouts_array_size;
156 };
157 struct incfs_get_last_read_error_args {
158   incfs_uuid_t file_id_out;
159   __u64 time_us_out;
160   __u32 page_out;
161   __u32 errno_out;
162   __u32 uid_out;
163   __u32 reserved1;
164   __u64 reserved2;
165 };
166 #endif
167