blob: 3dea328c9f01df21e24f9e2ab572bbd0579aa14d [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 Ferris25c18d42020-10-14 17:42:58 -070026#define INCFS_MAGIC_NUMBER (unsigned long) (0x5346434e49ul)
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
31#define INCFS_PENDING_READS_FILENAME ".pending_reads"
32#define INCFS_LOG_FILENAME ".log"
Christopher Ferris25c18d42020-10-14 17:42:58 -070033#define INCFS_BLOCKS_WRITTEN_FILENAME ".blocks_written"
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -070034#define INCFS_XATTR_ID_NAME (XATTR_USER_PREFIX "incfs.id")
35#define INCFS_XATTR_SIZE_NAME (XATTR_USER_PREFIX "incfs.size")
36#define INCFS_XATTR_METADATA_NAME (XATTR_USER_PREFIX "incfs.metadata")
37#define INCFS_MAX_SIGNATURE_SIZE 8096
38#define INCFS_SIGNATURE_VERSION 2
39#define INCFS_SIGNATURE_SECTIONS 2
40#define INCFS_IOCTL_BASE_CODE 'g'
41#define INCFS_IOC_CREATE_FILE _IOWR(INCFS_IOCTL_BASE_CODE, 30, struct incfs_new_file_args)
42#define INCFS_IOC_READ_FILE_SIGNATURE _IOR(INCFS_IOCTL_BASE_CODE, 31, struct incfs_get_file_sig_args)
43#define INCFS_IOC_FILL_BLOCKS _IOR(INCFS_IOCTL_BASE_CODE, 32, struct incfs_fill_blocks)
44#define INCFS_IOC_PERMIT_FILL _IOW(INCFS_IOCTL_BASE_CODE, 33, struct incfs_permit_fill)
45#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 -070046#define INCFS_IOC_CREATE_MAPPED_FILE _IOWR(INCFS_IOCTL_BASE_CODE, 35, struct incfs_create_mapped_file_args)
47#define INCFS_IOC_GET_BLOCK_COUNT _IOR(INCFS_IOCTL_BASE_CODE, 36, struct incfs_get_block_count_args)
48#define INCFS_IOC_GET_READ_TIMEOUTS _IOR(INCFS_IOCTL_BASE_CODE, 37, struct incfs_get_read_timeouts_args)
49#define INCFS_IOC_SET_READ_TIMEOUTS _IOW(INCFS_IOCTL_BASE_CODE, 38, struct incfs_set_read_timeouts_args)
50#define INCFS_FEATURE_FLAG_COREFS "corefs"
51#define INCFS_FEATURE_FLAG_REPORT_UID "report_uid"
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -070052enum incfs_compression_alg {
53 COMPRESSION_NONE = 0,
54 COMPRESSION_LZ4 = 1
55};
56enum incfs_block_flags {
57 INCFS_BLOCK_FLAGS_NONE = 0,
58 INCFS_BLOCK_FLAGS_HASH = 1,
59};
60typedef struct {
61 __u8 bytes[16];
62} incfs_uuid_t __attribute__((aligned(8)));
63struct incfs_pending_read_info {
64 incfs_uuid_t file_id;
65 __aligned_u64 timestamp_us;
66 __u32 block_index;
67 __u32 serial_number;
68};
Christopher Ferris25c18d42020-10-14 17:42:58 -070069struct incfs_pending_read_info2 {
70 incfs_uuid_t file_id;
71 __aligned_u64 timestamp_us;
72 __u32 block_index;
73 __u32 serial_number;
74 __u32 uid;
75 __u32 reserved;
76};
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -070077struct incfs_fill_block {
78 __u32 block_index;
79 __u32 data_len;
80 __aligned_u64 data;
81 __u8 compression;
82 __u8 flags;
83 __u16 reserved1;
84 __u32 reserved2;
85 __aligned_u64 reserved3;
86};
87struct incfs_fill_blocks {
88 __u64 count;
89 __aligned_u64 fill_blocks;
90};
91struct incfs_permit_fill {
92 __u32 file_descriptor;
93};
94enum incfs_hash_tree_algorithm {
95 INCFS_HASH_TREE_NONE = 0,
96 INCFS_HASH_TREE_SHA256 = 1
97};
98struct incfs_new_file_args {
99 incfs_uuid_t file_id;
100 __aligned_u64 size;
101 __u16 mode;
102 __u16 reserved1;
103 __u32 reserved2;
104 __aligned_u64 directory_path;
105 __aligned_u64 file_name;
106 __aligned_u64 file_attr;
107 __u32 file_attr_len;
108 __u32 reserved4;
109 __aligned_u64 signature_info;
110 __aligned_u64 signature_size;
111 __aligned_u64 reserved6;
112};
113struct incfs_get_file_sig_args {
114 __aligned_u64 file_signature;
115 __u32 file_signature_buf_size;
116 __u32 file_signature_len_out;
117};
118struct incfs_filled_range {
119 __u32 begin;
120 __u32 end;
121};
122struct incfs_get_filled_blocks_args {
123 __aligned_u64 range_buffer;
124 __u32 range_buffer_size;
125 __u32 start_index;
126 __u32 end_index;
127 __u32 total_blocks_out;
Christopher Ferrisaf09c702020-06-01 20:29:29 -0700128 __u32 data_blocks_out;
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -0700129 __u32 range_buffer_size_out;
130 __u32 index_out;
131};
Christopher Ferris25c18d42020-10-14 17:42:58 -0700132struct incfs_create_mapped_file_args {
133 __aligned_u64 size;
134 __u16 mode;
135 __u16 reserved1;
136 __u32 reserved2;
137 __aligned_u64 directory_path;
138 __aligned_u64 file_name;
139 incfs_uuid_t source_file_id;
140 __aligned_u64 source_offset;
141};
142struct incfs_get_block_count_args {
143 __u32 total_data_blocks_out;
144 __u32 filled_data_blocks_out;
145 __u32 total_hash_blocks_out;
146 __u32 filled_hash_blocks_out;
147};
148struct incfs_per_uid_read_timeouts {
149 __u32 uid;
150 __u32 min_time_ms;
151 __u32 min_pending_time_ms;
152 __u32 max_pending_time_ms;
153};
154struct incfs_get_read_timeouts_args {
155 __aligned_u64 timeouts_array;
156 __u32 timeouts_array_size;
157 __u32 timeouts_array_size_out;
158};
159struct incfs_set_read_timeouts_args {
160 __aligned_u64 timeouts_array;
161 __u32 timeouts_array_size;
162};
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -0700163#endif