122851890Sopenharmony_ci/****************************************************************************
222851890Sopenharmony_ci ****************************************************************************
322851890Sopenharmony_ci ***
422851890Sopenharmony_ci ***   This header was automatically generated from a Linux kernel header
522851890Sopenharmony_ci ***   of the same name, to make information necessary for userspace to
622851890Sopenharmony_ci ***   call into the kernel available to libc.  It contains only constants,
722851890Sopenharmony_ci ***   structures, and macros generated from the original header, and thus,
822851890Sopenharmony_ci ***   contains no copyrightable information.
922851890Sopenharmony_ci ***
1022851890Sopenharmony_ci ***   To edit the content of this header, modify the corresponding
1122851890Sopenharmony_ci ***   source file (e.g. under external/kernel-headers/original/) then
1222851890Sopenharmony_ci ***   run bionic/libc/kernel/tools/update_all.py
1322851890Sopenharmony_ci ***
1422851890Sopenharmony_ci ***   Any manual change here will be lost the next time this script will
1522851890Sopenharmony_ci ***   be run. You've been warned!
1622851890Sopenharmony_ci ***
1722851890Sopenharmony_ci ****************************************************************************
1822851890Sopenharmony_ci ****************************************************************************/
1922851890Sopenharmony_ci#ifndef _UAPI_LINUX_INCREMENTALFS_H
2022851890Sopenharmony_ci#define _UAPI_LINUX_INCREMENTALFS_H
2122851890Sopenharmony_ci#include <linux/limits.h>
2222851890Sopenharmony_ci#include <linux/ioctl.h>
2322851890Sopenharmony_ci#include <linux/types.h>
2422851890Sopenharmony_ci#include <linux/xattr.h>
2522851890Sopenharmony_ci#define INCFS_NAME "incremental-fs"
2622851890Sopenharmony_ci#define INCFS_MAGIC_NUMBER (unsigned long) (0x5346434e49ul)
2722851890Sopenharmony_ci#define INCFS_DATA_FILE_BLOCK_SIZE 4096
2822851890Sopenharmony_ci#define INCFS_HEADER_VER 1
2922851890Sopenharmony_ci#define INCFS_MAX_HASH_SIZE 32
3022851890Sopenharmony_ci#define INCFS_MAX_FILE_ATTR_SIZE 512
3122851890Sopenharmony_ci#define INCFS_PENDING_READS_FILENAME ".pending_reads"
3222851890Sopenharmony_ci#define INCFS_LOG_FILENAME ".log"
3322851890Sopenharmony_ci#define INCFS_BLOCKS_WRITTEN_FILENAME ".blocks_written"
3422851890Sopenharmony_ci#define INCFS_XATTR_ID_NAME (XATTR_USER_PREFIX "incfs.id")
3522851890Sopenharmony_ci#define INCFS_XATTR_SIZE_NAME (XATTR_USER_PREFIX "incfs.size")
3622851890Sopenharmony_ci#define INCFS_XATTR_METADATA_NAME (XATTR_USER_PREFIX "incfs.metadata")
3722851890Sopenharmony_ci#define INCFS_MAX_SIGNATURE_SIZE 8096
3822851890Sopenharmony_ci#define INCFS_SIGNATURE_VERSION 2
3922851890Sopenharmony_ci#define INCFS_SIGNATURE_SECTIONS 2
4022851890Sopenharmony_ci#define INCFS_IOCTL_BASE_CODE 'g'
4122851890Sopenharmony_ci#define INCFS_IOC_CREATE_FILE _IOWR(INCFS_IOCTL_BASE_CODE, 30, struct incfs_new_file_args)
4222851890Sopenharmony_ci#define INCFS_IOC_READ_FILE_SIGNATURE _IOR(INCFS_IOCTL_BASE_CODE, 31, struct incfs_get_file_sig_args)
4322851890Sopenharmony_ci#define INCFS_IOC_FILL_BLOCKS _IOR(INCFS_IOCTL_BASE_CODE, 32, struct incfs_fill_blocks)
4422851890Sopenharmony_ci#define INCFS_IOC_PERMIT_FILL _IOW(INCFS_IOCTL_BASE_CODE, 33, struct incfs_permit_fill)
4522851890Sopenharmony_ci#define INCFS_IOC_GET_FILLED_BLOCKS _IOR(INCFS_IOCTL_BASE_CODE, 34, struct incfs_get_filled_blocks_args)
4622851890Sopenharmony_ci#define INCFS_IOC_CREATE_MAPPED_FILE _IOWR(INCFS_IOCTL_BASE_CODE, 35, struct incfs_create_mapped_file_args)
4722851890Sopenharmony_ci#define INCFS_IOC_GET_BLOCK_COUNT _IOR(INCFS_IOCTL_BASE_CODE, 36, struct incfs_get_block_count_args)
4822851890Sopenharmony_ci#define INCFS_IOC_GET_READ_TIMEOUTS _IOR(INCFS_IOCTL_BASE_CODE, 37, struct incfs_get_read_timeouts_args)
4922851890Sopenharmony_ci#define INCFS_IOC_SET_READ_TIMEOUTS _IOW(INCFS_IOCTL_BASE_CODE, 38, struct incfs_set_read_timeouts_args)
5022851890Sopenharmony_ci#define INCFS_FEATURE_FLAG_COREFS "corefs"
5122851890Sopenharmony_ci#define INCFS_FEATURE_FLAG_ZSTD "zstd"
5222851890Sopenharmony_ci#define INCFS_FEATURE_FLAG_V2 "v2"
5322851890Sopenharmony_cienum incfs_compression_alg {
5422851890Sopenharmony_ci  COMPRESSION_NONE = 0,
5522851890Sopenharmony_ci  COMPRESSION_LZ4 = 1,
5622851890Sopenharmony_ci  COMPRESSION_ZSTD = 2,
5722851890Sopenharmony_ci};
5822851890Sopenharmony_cienum incfs_block_flags {
5922851890Sopenharmony_ci  INCFS_BLOCK_FLAGS_NONE = 0,
6022851890Sopenharmony_ci  INCFS_BLOCK_FLAGS_HASH = 1,
6122851890Sopenharmony_ci};
6222851890Sopenharmony_citypedef struct {
6322851890Sopenharmony_ci  __u8 bytes[16];
6422851890Sopenharmony_ci} incfs_uuid_t __attribute__((aligned(8)));
6522851890Sopenharmony_cistruct incfs_pending_read_info {
6622851890Sopenharmony_ci  incfs_uuid_t file_id;
6722851890Sopenharmony_ci  __aligned_u64 timestamp_us;
6822851890Sopenharmony_ci  __u32 block_index;
6922851890Sopenharmony_ci  __u32 serial_number;
7022851890Sopenharmony_ci};
7122851890Sopenharmony_cistruct incfs_pending_read_info2 {
7222851890Sopenharmony_ci  incfs_uuid_t file_id;
7322851890Sopenharmony_ci  __aligned_u64 timestamp_us;
7422851890Sopenharmony_ci  __u32 block_index;
7522851890Sopenharmony_ci  __u32 serial_number;
7622851890Sopenharmony_ci  __u32 uid;
7722851890Sopenharmony_ci  __u32 reserved;
7822851890Sopenharmony_ci};
7922851890Sopenharmony_cistruct incfs_fill_block {
8022851890Sopenharmony_ci  __u32 block_index;
8122851890Sopenharmony_ci  __u32 data_len;
8222851890Sopenharmony_ci  __aligned_u64 data;
8322851890Sopenharmony_ci  __u8 compression;
8422851890Sopenharmony_ci  __u8 flags;
8522851890Sopenharmony_ci  __u16 reserved1;
8622851890Sopenharmony_ci  __u32 reserved2;
8722851890Sopenharmony_ci  __aligned_u64 reserved3;
8822851890Sopenharmony_ci};
8922851890Sopenharmony_cistruct incfs_fill_blocks {
9022851890Sopenharmony_ci  __u64 count;
9122851890Sopenharmony_ci  __aligned_u64 fill_blocks;
9222851890Sopenharmony_ci};
9322851890Sopenharmony_cistruct incfs_permit_fill {
9422851890Sopenharmony_ci  __u32 file_descriptor;
9522851890Sopenharmony_ci};
9622851890Sopenharmony_cienum incfs_hash_tree_algorithm {
9722851890Sopenharmony_ci  INCFS_HASH_TREE_NONE = 0,
9822851890Sopenharmony_ci  INCFS_HASH_TREE_SHA256 = 1
9922851890Sopenharmony_ci};
10022851890Sopenharmony_cistruct incfs_new_file_args {
10122851890Sopenharmony_ci  incfs_uuid_t file_id;
10222851890Sopenharmony_ci  __aligned_u64 size;
10322851890Sopenharmony_ci  __u16 mode;
10422851890Sopenharmony_ci  __u16 reserved1;
10522851890Sopenharmony_ci  __u32 reserved2;
10622851890Sopenharmony_ci  __aligned_u64 directory_path;
10722851890Sopenharmony_ci  __aligned_u64 file_name;
10822851890Sopenharmony_ci  __aligned_u64 file_attr;
10922851890Sopenharmony_ci  __u32 file_attr_len;
11022851890Sopenharmony_ci  __u32 reserved4;
11122851890Sopenharmony_ci  __aligned_u64 signature_info;
11222851890Sopenharmony_ci  __aligned_u64 signature_size;
11322851890Sopenharmony_ci  __aligned_u64 reserved6;
11422851890Sopenharmony_ci};
11522851890Sopenharmony_cistruct incfs_get_file_sig_args {
11622851890Sopenharmony_ci  __aligned_u64 file_signature;
11722851890Sopenharmony_ci  __u32 file_signature_buf_size;
11822851890Sopenharmony_ci  __u32 file_signature_len_out;
11922851890Sopenharmony_ci};
12022851890Sopenharmony_cistruct incfs_filled_range {
12122851890Sopenharmony_ci  __u32 begin;
12222851890Sopenharmony_ci  __u32 end;
12322851890Sopenharmony_ci};
12422851890Sopenharmony_cistruct incfs_get_filled_blocks_args {
12522851890Sopenharmony_ci  __aligned_u64 range_buffer;
12622851890Sopenharmony_ci  __u32 range_buffer_size;
12722851890Sopenharmony_ci  __u32 start_index;
12822851890Sopenharmony_ci  __u32 end_index;
12922851890Sopenharmony_ci  __u32 total_blocks_out;
13022851890Sopenharmony_ci  __u32 data_blocks_out;
13122851890Sopenharmony_ci  __u32 range_buffer_size_out;
13222851890Sopenharmony_ci  __u32 index_out;
13322851890Sopenharmony_ci};
13422851890Sopenharmony_cistruct incfs_create_mapped_file_args {
13522851890Sopenharmony_ci  __aligned_u64 size;
13622851890Sopenharmony_ci  __u16 mode;
13722851890Sopenharmony_ci  __u16 reserved1;
13822851890Sopenharmony_ci  __u32 reserved2;
13922851890Sopenharmony_ci  __aligned_u64 directory_path;
14022851890Sopenharmony_ci  __aligned_u64 file_name;
14122851890Sopenharmony_ci  incfs_uuid_t source_file_id;
14222851890Sopenharmony_ci  __aligned_u64 source_offset;
14322851890Sopenharmony_ci};
14422851890Sopenharmony_cistruct incfs_get_block_count_args {
14522851890Sopenharmony_ci  __u32 total_data_blocks_out;
14622851890Sopenharmony_ci  __u32 filled_data_blocks_out;
14722851890Sopenharmony_ci  __u32 total_hash_blocks_out;
14822851890Sopenharmony_ci  __u32 filled_hash_blocks_out;
14922851890Sopenharmony_ci};
15022851890Sopenharmony_cistruct incfs_per_uid_read_timeouts {
15122851890Sopenharmony_ci  __u32 uid;
15222851890Sopenharmony_ci  __u32 min_time_us;
15322851890Sopenharmony_ci  __u32 min_pending_time_us;
15422851890Sopenharmony_ci  __u32 max_pending_time_us;
15522851890Sopenharmony_ci};
15622851890Sopenharmony_cistruct incfs_get_read_timeouts_args {
15722851890Sopenharmony_ci  __aligned_u64 timeouts_array;
15822851890Sopenharmony_ci  __u32 timeouts_array_size;
15922851890Sopenharmony_ci  __u32 timeouts_array_size_out;
16022851890Sopenharmony_ci};
16122851890Sopenharmony_cistruct incfs_set_read_timeouts_args {
16222851890Sopenharmony_ci  __aligned_u64 timeouts_array;
16322851890Sopenharmony_ci  __u32 timeouts_array_size;
16422851890Sopenharmony_ci};
16522851890Sopenharmony_ci#endif
166