Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:build_merkle_tree_level

Proto:static int build_merkle_tree_level(struct inode *inode, unsigned int level, u64 num_blocks_to_hash, const struct merkle_tree_params *params, u8 *pending_hashes, struct ahash_request *req)

Type:int

Parameter:

TypeParameterName
struct inode *inode
unsigned intlevel
u64num_blocks_to_hash
const struct merkle_tree_params *params
u8 *pending_hashes
struct ahash_request *req
22  vops = s_vop
23  pending_size = 0
28  If WARN_ON(size of data and tree blocks != PAGE_SIZE) Then Return -EINVAL
31  If level < umber of levels in Merkle tree Then
32  dst_block_num = Starting block index for each tree level, ordered from leaf level (0)* to root level ('num_levels - 1')[level]
33  Else
34  If WARN_ON(num_blocks_to_hash != 1) Then Return -EINVAL
36  dst_block_num = 0
39  When i < num_blocks_to_hash cycle
42  If i % 10000 == 0 || i + 1 == num_blocks_to_hash Then pr_debug("Hashing block %llu of %llu for level %u\n", i + 1, num_blocks_to_hash, level)
46  If level == 0 Then
49  If IS_ERR(src_page) Then
50  err = PTR_ERR(src_page)
51  fsverity_err(inode, "Error %d reading data page %llu", err, i)
54  Return err
56  Else
60  If IS_ERR(src_page) Then
69  err = fsverity_hash_page(params, inode, req, src_page, & pending_hashes[pending_size])
71  Perform a free_page(), also freeing any swap cache associated with* this page if it is the last user of the page.
72  If err Then Return err
74  pending_size += same as hash_alg->digest_size
76  If level == umber of levels in Merkle tree Then Return 0
88  If err Then
89  fsverity_err(inode, "Error %d writing Merkle tree block %llu", err, dst_block_num)
92  Return err
94  dst_block_num++
95  pending_size = 0
98  If fatal_signal_pending(current process) Then Return -EINTR
100  cond_resched()
102  Return 0
Caller
NameDescribe
build_merkle_treeBuild 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