* @brief Initialize a DFS vnode structure. * * @param vnode Pointer to the DFS vnode structure to be initialized. * The caller must ensure this is a valid, allocated structure. * @param type The type of the vnode, representing its role or category (e.g., regular file, directory). * @param fops Pointer to the file operations structure associated with this vnode. * Thi
| 71 | * instance, where all necessary function pointers are properly set. |
| 72 | */ |
| 73 | int dfs_vnode_init(struct dfs_vnode *vnode, int type, const struct dfs_file_ops *fops) |
| 74 | { |
| 75 | if (vnode) |
| 76 | { |
| 77 | rt_memset(vnode, 0, sizeof(struct dfs_vnode)); |
| 78 | vnode->type = type; |
| 79 | vnode->fops = fops; |
| 80 | |
| 81 | rt_list_init(&(vnode->list)); |
| 82 | vnode->ref_count = 1; |
| 83 | } |
| 84 | return 0; |
| 85 | } |
| 86 | |
| 87 | /* BKDR Hash Function */ |
| 88 | static unsigned int bkdr_hash(const char *str) |
no test coverage detected