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