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 (unsigned long) (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_BLOCKS_WRITTEN_FILENAME ".blocks_written" 34 #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) 46 #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_ZSTD "zstd" 52 #define INCFS_FEATURE_FLAG_V2 "v2" 53 enum incfs_compression_alg { 54 COMPRESSION_NONE = 0, 55 COMPRESSION_LZ4 = 1, 56 COMPRESSION_ZSTD = 2, 57 }; 58 enum incfs_block_flags { 59 INCFS_BLOCK_FLAGS_NONE = 0, 60 INCFS_BLOCK_FLAGS_HASH = 1, 61 }; 62 typedef struct { 63 __u8 bytes[16]; 64 } incfs_uuid_t __attribute__((aligned(8))); 65 struct incfs_pending_read_info { 66 incfs_uuid_t file_id; 67 __aligned_u64 timestamp_us; 68 __u32 block_index; 69 __u32 serial_number; 70 }; 71 struct incfs_pending_read_info2 { 72 incfs_uuid_t file_id; 73 __aligned_u64 timestamp_us; 74 __u32 block_index; 75 __u32 serial_number; 76 __u32 uid; 77 __u32 reserved; 78 }; 79 struct incfs_fill_block { 80 __u32 block_index; 81 __u32 data_len; 82 __aligned_u64 data; 83 __u8 compression; 84 __u8 flags; 85 __u16 reserved1; 86 __u32 reserved2; 87 __aligned_u64 reserved3; 88 }; 89 struct incfs_fill_blocks { 90 __u64 count; 91 __aligned_u64 fill_blocks; 92 }; 93 struct incfs_permit_fill { 94 __u32 file_descriptor; 95 }; 96 enum incfs_hash_tree_algorithm { 97 INCFS_HASH_TREE_NONE = 0, 98 INCFS_HASH_TREE_SHA256 = 1 99 }; 100 struct incfs_new_file_args { 101 incfs_uuid_t file_id; 102 __aligned_u64 size; 103 __u16 mode; 104 __u16 reserved1; 105 __u32 reserved2; 106 __aligned_u64 directory_path; 107 __aligned_u64 file_name; 108 __aligned_u64 file_attr; 109 __u32 file_attr_len; 110 __u32 reserved4; 111 __aligned_u64 signature_info; 112 __aligned_u64 signature_size; 113 __aligned_u64 reserved6; 114 }; 115 struct incfs_get_file_sig_args { 116 __aligned_u64 file_signature; 117 __u32 file_signature_buf_size; 118 __u32 file_signature_len_out; 119 }; 120 struct incfs_filled_range { 121 __u32 begin; 122 __u32 end; 123 }; 124 struct incfs_get_filled_blocks_args { 125 __aligned_u64 range_buffer; 126 __u32 range_buffer_size; 127 __u32 start_index; 128 __u32 end_index; 129 __u32 total_blocks_out; 130 __u32 data_blocks_out; 131 __u32 range_buffer_size_out; 132 __u32 index_out; 133 }; 134 struct incfs_create_mapped_file_args { 135 __aligned_u64 size; 136 __u16 mode; 137 __u16 reserved1; 138 __u32 reserved2; 139 __aligned_u64 directory_path; 140 __aligned_u64 file_name; 141 incfs_uuid_t source_file_id; 142 __aligned_u64 source_offset; 143 }; 144 struct incfs_get_block_count_args { 145 __u32 total_data_blocks_out; 146 __u32 filled_data_blocks_out; 147 __u32 total_hash_blocks_out; 148 __u32 filled_hash_blocks_out; 149 }; 150 struct incfs_per_uid_read_timeouts { 151 __u32 uid; 152 __u32 min_time_us; 153 __u32 min_pending_time_us; 154 __u32 max_pending_time_us; 155 }; 156 struct incfs_get_read_timeouts_args { 157 __aligned_u64 timeouts_array; 158 __u32 timeouts_array_size; 159 __u32 timeouts_array_size_out; 160 }; 161 struct incfs_set_read_timeouts_args { 162 __aligned_u64 timeouts_array; 163 __u32 timeouts_array_size; 164 }; 165 #endif 166