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

Function dfs_aspace_hash

components/dfs/dfs_v2/src/dfs_pcache.c:519–532  ·  view source on GitHub ↗

* @brief Calculate hash value for address space lookup * * This function computes a hash value based on mount point and path string. * It uses a simple string hashing algorithm combined with mount point pointer. * * @param[in] mnt Pointer to the mount point structure * @param[in] path Path string to be hashed (can be NULL) * * @return Computed hash value within range [0, RT_PAGECACHE_HASH

Source from the content-addressed store, hash-verified

517 * - Modulo operation to fit hash table size
518 */
519static uint32_t dfs_aspace_hash(struct dfs_mnt *mnt, const char *path)
520{
521 uint32_t val = 0;
522
523 if (path)
524 {
525 while (*path)
526 {
527 val = ((val << 5) + val) + *path++;
528 }
529 }
530
531 return (val ^ (unsigned long)mnt) & (RT_PAGECACHE_HASH_NR - 1);
532}
533
534/**
535 * @brief Look up an address space in the page cache hash table

Callers 2

dfs_aspace_hash_lookupFunction · 0.85
dfs_aspace_insertFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected