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

Function dfs_tmpfs_mount

components/dfs/dfs_v2/filesystems/tmpfs/dfs_tmpfs.c:131–158  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

129}
130
131static int dfs_tmpfs_mount(struct dfs_mnt *mnt,
132 unsigned long rwflag,
133 const void *data)
134{
135 struct tmpfs_sb *superblock;
136
137 superblock = rt_calloc(1, sizeof(struct tmpfs_sb));
138 if (superblock)
139 {
140 superblock->df_size = sizeof(struct tmpfs_sb);
141 superblock->magic = TMPFS_MAGIC;
142
143 superblock->root.name[0] = '/';
144 superblock->root.sb = superblock;
145 superblock->root.type = TMPFS_TYPE_DIR;
146 dfs_vfs_init_node(&superblock->root.node);
147
148 rt_spin_lock_init(&superblock->lock);
149
150 mnt->data = superblock;
151 }
152 else
153 {
154 return -1;
155 }
156
157 return RT_EOK;
158}
159
160static int dfs_tmpfs_unmount(struct dfs_mnt *mnt)
161{

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