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

Function proc_create

components/dfs/dfs_v2/filesystems/procfs/proc.c:200–229  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

198};
199
200static 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

Callers 3

proc_mkdir_dataFunction · 0.85
proc_create_regFunction · 0.85
proc_symlinkFunction · 0.85

Calls 5

proc_findFunction · 0.85
rt_callocFunction · 0.85
rt_strdupFunction · 0.85
dfs_vfs_init_nodeFunction · 0.85
proc_releaseFunction · 0.85

Tested by

no test coverage detected