* @brief Initialize a file structure * * @param[in,out] file Pointer to the file structure to be initialized * * @note This function must be called before using any file operations * on a newly allocated file structure */
| 310 | * on a newly allocated file structure |
| 311 | */ |
| 312 | void dfs_file_init(struct dfs_file *file) |
| 313 | { |
| 314 | if (file) |
| 315 | { |
| 316 | rt_memset(file, 0x00, sizeof(struct dfs_file)); |
| 317 | file->magic = DFS_FD_MAGIC; |
| 318 | rt_mutex_init(&file->pos_lock, "fpos", RT_IPC_FLAG_PRIO); |
| 319 | rt_atomic_store(&(file->ref_count), 1); |
| 320 | } |
| 321 | } |
| 322 | |
| 323 | /** |
| 324 | * @brief Deinitialize a file structure |