MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / _dentry_hash

Function _dentry_hash

components/dfs/dfs_v2/src/dfs_dentry.c:37–49  ·  view source on GitHub ↗

* @brief Calculate hash value for a dentry based on mount point and path * * @param[in] mnt Pointer to the mount point structure * @param[in] path Path string to be hashed (can be NULL) * * @return uint32_t Calculated hash value within range [0, DFS_DENTRY_HASH_NR-1] */

Source from the content-addressed store, hash-verified

35 * @return uint32_t Calculated hash value within range [0, DFS_DENTRY_HASH_NR-1]
36 */
37static uint32_t _dentry_hash(struct dfs_mnt *mnt, const char *path)
38{
39 uint32_t val = 0;
40
41 if (path)
42 {
43 while (*path)
44 {
45 val = ((val << 5) + val) + *path++;
46 }
47 }
48 return (val ^ (unsigned long) mnt) & (DFS_DENTRY_HASH_NR - 1);
49}
50
51/**
52 * @brief Create a new directory entry (dentry) structure

Callers 3

_dentry_hash_lookupFunction · 0.85
dfs_dentry_insertFunction · 0.85
dfs_dentry_lookupFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected