| 198 | }; |
| 199 | |
| 200 | static struct proc_dentry *proc_create(struct proc_dentry **parent, const char *name, mode_t mode) |
| 201 | { |
| 202 | int ret = 0; |
| 203 | struct proc_dentry *dentry = RT_NULL; |
| 204 | |
| 205 | ret = proc_find(parent, &name, 0); |
| 206 | if (ret >= 0) |
| 207 | { |
| 208 | dentry = *parent; |
| 209 | ret = proc_find(&dentry, &name, 1); |
| 210 | if (ret < 0) |
| 211 | { |
| 212 | dentry = rt_calloc(1, sizeof(struct proc_dentry)); |
| 213 | if (dentry) |
| 214 | { |
| 215 | dentry->mode = mode; |
| 216 | dentry->ref_count = 1; |
| 217 | dentry->name = rt_strdup(name); |
| 218 | dfs_vfs_init_node(&dentry->node); |
| 219 | } |
| 220 | } |
| 221 | else |
| 222 | { |
| 223 | proc_release(dentry); |
| 224 | dentry = RT_NULL; |
| 225 | } |
| 226 | } |
| 227 | |
| 228 | return dentry; |
| 229 | } |
| 230 | |
| 231 | /** |
| 232 | * @brief The dentry reference count is incremented by one |
no test coverage detected