* @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] */
| 35 | * @return uint32_t Calculated hash value within range [0, DFS_DENTRY_HASH_NR-1] |
| 36 | */ |
| 37 | static 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 |
no outgoing calls
no test coverage detected