ANDROID: Incremental fs: Make fill block an ioctl

Filling blocks is not equivalent to writing a file, since they are
constrained by the root hash. selinux policy may wish to treat them
differently, for instance.

Test: incfs_test passes
Bug: 138149732
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: Ic369b84b92547b1cfefe422bd881c4e466090aed
This commit is contained in:
Paul Lawrence 2020-03-10 13:03:38 -07:00
commit c9c4db5da6
5 changed files with 118 additions and 113 deletions

View file

@ -46,7 +46,15 @@
/* Read file signature */
#define INCFS_IOC_READ_FILE_SIGNATURE \
_IOWR(INCFS_IOCTL_BASE_CODE, 31, struct incfs_get_file_sig_args)
_IOR(INCFS_IOCTL_BASE_CODE, 31, struct incfs_get_file_sig_args)
/*
* Fill in one or more data block
*
* Returns number of blocks filled in, or error if none were
*/
#define INCFS_IOC_FILL_BLOCKS \
_IOR(INCFS_IOCTL_BASE_CODE, 32, struct incfs_fill_blocks)
enum incfs_compression_alg {
COMPRESSION_NONE = 0,
@ -81,10 +89,9 @@ struct incfs_pending_read_info {
};
/*
* A struct to be written into a control file to load a data or hash
* block to a data file.
* Description of a data or hash block to add to a data file.
*/
struct incfs_new_data_block {
struct incfs_fill_block {
/* Index of a data block. */
__u32 block_index;
@ -114,6 +121,19 @@ struct incfs_new_data_block {
__aligned_u64 reserved3;
};
/*
* Description of a number of blocks to add to a data file
*
* Argument for INCFS_IOC_FILL_BLOCKS
*/
struct incfs_fill_blocks {
/* Number of blocks */
__u64 count;
/* A pointer to an array of incfs_fill_block structs */
__aligned_u64 fill_blocks;
};
enum incfs_hash_tree_algorithm {
INCFS_HASH_TREE_NONE = 0,
INCFS_HASH_TREE_SHA256 = 1