1 /****************************************************************************
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"
26 #define INCFS_MAGIC_NUMBER (0x5346434e49ul)
27 #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"
33 #define INCFS_XATTR_ID_NAME (XATTR_USER_PREFIX "incfs.id")
34 #define INCFS_XATTR_SIZE_NAME (XATTR_USER_PREFIX "incfs.size")
35 #define INCFS_XATTR_METADATA_NAME (XATTR_USER_PREFIX "incfs.metadata")
36 #define INCFS_MAX_SIGNATURE_SIZE 8096
37 #define INCFS_SIGNATURE_VERSION 2
38 #define INCFS_SIGNATURE_SECTIONS 2
39 #define INCFS_IOCTL_BASE_CODE 'g'
40 #define INCFS_IOC_CREATE_FILE _IOWR(INCFS_IOCTL_BASE_CODE, 30, struct incfs_new_file_args)
41 #define INCFS_IOC_READ_FILE_SIGNATURE _IOR(INCFS_IOCTL_BASE_CODE, 31, struct incfs_get_file_sig_args)
42 #define INCFS_IOC_FILL_BLOCKS _IOR(INCFS_IOCTL_BASE_CODE, 32, struct incfs_fill_blocks)
43 #define INCFS_IOC_PERMIT_FILL _IOW(INCFS_IOCTL_BASE_CODE, 33, struct incfs_permit_fill)
44 #define INCFS_IOC_GET_FILLED_BLOCKS _IOR(INCFS_IOCTL_BASE_CODE, 34, struct incfs_get_filled_blocks_args)
45 enum incfs_compression_alg {
46   COMPRESSION_NONE = 0,
47   COMPRESSION_LZ4 = 1
48 };
49 enum incfs_block_flags {
50   INCFS_BLOCK_FLAGS_NONE = 0,
51   INCFS_BLOCK_FLAGS_HASH = 1,
52 };
53 typedef struct {
54   __u8 bytes[16];
55 } incfs_uuid_t __attribute__((aligned(8)));
56 struct incfs_pending_read_info {
57   incfs_uuid_t file_id;
58   __aligned_u64 timestamp_us;
59   __u32 block_index;
60   __u32 serial_number;
61 };
62 struct incfs_fill_block {
63   __u32 block_index;
64   __u32 data_len;
65   __aligned_u64 data;
66   __u8 compression;
67   __u8 flags;
68   __u16 reserved1;
69   __u32 reserved2;
70   __aligned_u64 reserved3;
71 };
72 struct incfs_fill_blocks {
73   __u64 count;
74   __aligned_u64 fill_blocks;
75 };
76 struct incfs_permit_fill {
77   __u32 file_descriptor;
78 };
79 enum incfs_hash_tree_algorithm {
80   INCFS_HASH_TREE_NONE = 0,
81   INCFS_HASH_TREE_SHA256 = 1
82 };
83 struct incfs_new_file_args {
84   incfs_uuid_t file_id;
85   __aligned_u64 size;
86   __u16 mode;
87   __u16 reserved1;
88   __u32 reserved2;
89   __aligned_u64 directory_path;
90   __aligned_u64 file_name;
91   __aligned_u64 file_attr;
92   __u32 file_attr_len;
93   __u32 reserved4;
94   __aligned_u64 signature_info;
95   __aligned_u64 signature_size;
96   __aligned_u64 reserved6;
97 };
98 struct incfs_get_file_sig_args {
99   __aligned_u64 file_signature;
100   __u32 file_signature_buf_size;
101   __u32 file_signature_len_out;
102 };
103 struct incfs_filled_range {
104   __u32 begin;
105   __u32 end;
106 };
107 struct incfs_get_filled_blocks_args {
108   __aligned_u64 range_buffer;
109   __u32 range_buffer_size;
110   __u32 start_index;
111   __u32 end_index;
112   __u32 total_blocks_out;
113   __u32 data_blocks_out;
114   __u32 range_buffer_size_out;
115   __u32 index_out;
116 };
117 #endif
118