Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:lib\test_hash.c Create Date:2022-07-28 06:28:54
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:test_hash_init

Proto:static int __init test_hash_init(void)

Type:int

Parameter:Nothing

147  u32 string_or = 0, hash_or[2][33] = {{0, }}
148  tests = 0
149  h64 = 0
152  fill_buf(buf, Run time is cubic in SIZE , 1)
155  When j > 0 cycle
156  buf[j] = '\0'
158  When i <= j cycle
163  If hashlen_len(hashlen) != j - i Then
164  pr_err("hashlen_string(%d..%d) returned length %u, expected %d", i, j, hashlen_len(hashlen), j - i)
167  Return -EINVAL
171  pr_err("hashlen_string(%d..%d) = %08x != full_name_hash() = %08x", i, j, A hash_len is a u64 with the hash of a string in the low* half and the length in the high half.(hashlen), h0)
174  Return -EINVAL
177  string_or |= h0
178  h64 = h64 << 32 | h0
179  If Not test_int_hash(h64, hash_or) Then Return -EINVAL
181  tests++
186  If ~string_or Then
187  pr_err("OR of all string hash results = %#x != %#x", string_or, - 1u)
189  Return -EINVAL
191  If ~hash_or[0][0] Then
192  pr_err("OR of all __hash_32 results = %#x != %#x", hash_or[0][0], - 1u)
194  Return -EINVAL
207  When i <= 32 cycle
208  m = (2 << i - 1 ) - 1
210  If hash_or[0][i] != m Then
211  pr_err("OR of all hash_32(%d) results = %#x (%#x expected)", i, hash_or[0][i], m)
213  Return -EINVAL
215  If hash_or[1][i] != m Then
216  pr_err("OR of all hash_64(%d) results = %#x (%#x expected)", i, hash_or[1][i], m)
218  Return -EINVAL
228  pr_info("__hash_32() has no arch implementation to test.")
235  pr_info("hash_32() has no arch implementation to test.")
242  pr_info("hash_64() has no arch implementation to test.")
245  pr_notice("%u tests passed.", tests)
247  Return 0