Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:fs\verity\enable.c Create Date:2022-07-28 20:24:32
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:Build the Merkle tree for the given inode using the given parameters, and* return the root hash in @root_hash.* The tree is written to a filesystem-specific location as determined by the* ->write_merkle_tree_block() method

Proto:static int build_merkle_tree(struct inode *inode, const struct merkle_tree_params *params, u8 *root_hash)

Type:int

Parameter:

TypeParameterName
struct inode *inode
const struct merkle_tree_params *params
u8 *root_hash
121  err = -ENOMEM
123  If i_size == 0 Then
125  memset(root_hash, 0, same as hash_alg->digest_size )
126  Return 0
129  pending_hashes = Allocation memory
130  req = ahash_request_alloc() - allocate request data structure*@tfm: cipher handle to be registered with the request*@gfp: memory allocation flag that is handed to kmalloc by the API call.* Allocate the request data structure that must be used with the ahash
131  If Not pending_hashes || Not req Then Go to out
139  blocks = i_size + size of data and tree blocks - 1 >> log2(block_size)
141  When level <= umber of levels in Merkle tree cycle
142  err = build_merkle_tree_level(inode, level, blocks, params, pending_hashes, req)
144  If err Then Go to out
146  blocks = blocks + umber of hashes per tree block - 1 >> log2(hashes_per_block)
149  memcpy(root_hash, pending_hashes, same as hash_alg->digest_size )
150  err = 0
151  out :
152  kfree(pending_hashes)
153  ahash_request_free() - zeroize and free the request data structure*@req: request data structure cipher handle to be freed
154  Return err
Caller
NameDescribe
enable_verity