* @brief Look up a directory entry (dentry) in hash table by mount point and path * * @param[in] mnt Pointer to the mount point structure to search for * @param[in] path Path string to search for * * @return struct dfs_dentry* Pointer to found dentry (with increased ref_count), or NULL if not found */
| 227 | * @return struct dfs_dentry* Pointer to found dentry (with increased ref_count), or NULL if not found |
| 228 | */ |
| 229 | static struct dfs_dentry *_dentry_hash_lookup(struct dfs_mnt *mnt, const char *path) |
| 230 | { |
| 231 | rt_err_t ret = RT_EOK; |
| 232 | struct dfs_dentry *entry = RT_NULL; |
| 233 | |
| 234 | ret = dfs_file_lock(); |
| 235 | if (ret == RT_EOK) |
| 236 | { |
| 237 | rt_list_for_each_entry(entry, &hash_head.head[_dentry_hash(mnt, path)], hashlist) |
| 238 | { |
| 239 | if (entry->mnt == mnt && !strcmp(entry->pathname, path)) |
| 240 | { |
| 241 | dfs_dentry_ref(entry); |
| 242 | dfs_file_unlock(); |
| 243 | return entry; |
| 244 | } |
| 245 | } |
| 246 | |
| 247 | dfs_file_unlock(); |
| 248 | } |
| 249 | |
| 250 | return RT_NULL; |
| 251 | } |
| 252 | |
| 253 | /** |
| 254 | * @brief Insert a directory entry (dentry) into the hash table |
no test coverage detected