| 2192 | ****************************************************************************/ |
| 2193 | |
| 2194 | static int tmpfs_bind(FAR struct inode *blkdriver, FAR const void *data, |
| 2195 | FAR void **handle) |
| 2196 | { |
| 2197 | FAR struct tmpfs_directory_s *tdo; |
| 2198 | FAR struct tmpfs_s *fs; |
| 2199 | |
| 2200 | finfo("blkdriver: %p data: %p handle: %p\n", blkdriver, data, handle); |
| 2201 | DEBUGASSERT(blkdriver == NULL && handle != NULL); |
| 2202 | |
| 2203 | /* Create an instance of the tmpfs file system */ |
| 2204 | |
| 2205 | fs = fs_heap_zalloc(sizeof(struct tmpfs_s)); |
| 2206 | if (fs == NULL) |
| 2207 | { |
| 2208 | return -ENOMEM; |
| 2209 | } |
| 2210 | |
| 2211 | /* Create a root file system. This is like a single directory entry in |
| 2212 | * the file system structure. |
| 2213 | */ |
| 2214 | |
| 2215 | tdo = tmpfs_alloc_directory(NULL); |
| 2216 | if (tdo == NULL) |
| 2217 | { |
| 2218 | fs_heap_free(fs); |
| 2219 | return -ENOMEM; |
| 2220 | } |
| 2221 | |
| 2222 | fs->tfs_root.tde_object = (FAR struct tmpfs_object_s *)tdo; |
| 2223 | fs->tfs_root.tde_name = ""; |
| 2224 | |
| 2225 | /* Initialize the file system state */ |
| 2226 | |
| 2227 | nxrmutex_init(&fs->tfs_lock); |
| 2228 | |
| 2229 | /* Return the new file system handle */ |
| 2230 | |
| 2231 | *handle = (FAR void *)fs; |
| 2232 | return OK; |
| 2233 | } |
| 2234 | |
| 2235 | /**************************************************************************** |
| 2236 | * Name: tmpfs_unbind |
nothing calls this directly
no test coverage detected