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

Function devtmpfs_mount

components/dfs/dfs_v2/filesystems/devfs/devtmpfs.c:143–169  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

141#endif
142
143static int devtmpfs_mount(struct dfs_mnt *mnt, unsigned long rwflag, const void *data)
144{
145 struct devtmpfs_sb *superblock;
146
147 superblock = rt_calloc(1, sizeof(struct devtmpfs_sb));
148 if (superblock)
149 {
150 superblock->df_size = sizeof(struct devtmpfs_sb);
151 superblock->magic = TMPFS_MAGIC;
152
153 superblock->root.name[0] = '/';
154 superblock->root.sb = superblock;
155 superblock->root.type = TMPFS_TYPE_DIR;
156 superblock->root.mode = S_IFDIR | (S_IRUSR | S_IRGRP | S_IROTH) | (S_IXUSR | S_IXGRP | S_IXOTH);
157 dfs_vfs_init_node(&superblock->root.node);
158
159 rt_spin_lock_init(&superblock->lock);
160
161 mnt->data = superblock;
162 }
163 else
164 {
165 return -RT_ERROR;
166 }
167
168 return RT_EOK;
169}
170
171static int devtmpfs_unmount(struct dfs_mnt *mnt)
172{

Callers

nothing calls this directly

Calls 3

rt_callocFunction · 0.85
dfs_vfs_init_nodeFunction · 0.85
rt_spin_lock_initFunction · 0.50

Tested by

no test coverage detected