* @brief Create and initialize a new file descriptor structure * * @return struct dfs_file* Pointer to the newly created file descriptor structure, * NULL if memory allocation failed */
| 253 | * NULL if memory allocation failed |
| 254 | */ |
| 255 | struct dfs_file* dfs_file_create(void) |
| 256 | { |
| 257 | struct dfs_file *file; |
| 258 | |
| 259 | file = (struct dfs_file *)rt_calloc(1, sizeof(struct dfs_file)); |
| 260 | if (file) |
| 261 | { |
| 262 | file->magic = DFS_FD_MAGIC; |
| 263 | file->ref_count = 1; |
| 264 | rt_mutex_init(&file->pos_lock, "fpos", RT_IPC_FLAG_PRIO); |
| 265 | } |
| 266 | |
| 267 | return file; |
| 268 | } |
| 269 | |
| 270 | /** |
| 271 | * @brief Destroy and free a file descriptor structure |
no test coverage detected