Lines Matching full:file
21 * @brief File System APIs
22 * @defgroup file_system_api File System APIs
34 /** Identifier for file entry */
40 /** @brief Enumeration to uniquely identify file system types.
42 * Zephyr supports in-tree file systems and external ones. Each
43 * requires a unique identifier used to register the file system
44 * implementation and to associate a mount point with the file system
46 * in-tree file systems.
48 * External file systems should be registered using unique identifiers
50 * applications that use external file systems to ensure that these
51 * identifiers are unique if multiple file system implementations are
55 /** Identifier for in-tree FatFS file system. */
58 /** Identifier for in-tree LittleFS file system. */
61 /** Identifier for in-tree Ext2 file system. */
64 /** Base identifier for external file systems. */
68 /** Flag prevents formatting device if requested file system not found */
70 /** Flag makes mounted file system read-only */
78 /** Flag requests file system driver to use Disk Access API. When the flag is
79 * set to the fs_mount_t.flags prior to fs_mount call, a file system
81 * should return -ENOSUP; when the flag is not set the file system driver
83 * When file system will use Disk Access API and the flag is not set, the mount
84 * callback for the file system should set the flag on success.
89 * @brief File system mount info structure
94 /** File system type */
98 /** Pointer to file system specific data */
102 /* The following fields are filled by file system core */
105 /** Pointer to File system interface of the mount point */
112 * @brief Structure to receive file or directory information
115 * file or directory information.
119 * File/directory type (FS_DIR_ENTRY_FILE or FS_DIR_ENTRY_DIR)
122 /** Name of file or directory */
124 /** Size of file (0 if directory). */
159 /** Create file if it does not exist */
161 /** Open/create file for append */
163 /** Truncate the file while opening */
180 /** Seek from the beginning of file */
188 /** Seek from the end of file */
234 * @param zfp Pointer to file object
250 * @param zdp Pointer to file object
260 * @brief Open or create file
262 * Opens or possibly creates a file and associates a stream with it.
263 * Successfully opened file, when no longer in use, should be closed
272 * - @c FS_O_CREATE create file if it does not exist
273 * - @c FS_O_APPEND move to end of file before each write
274 * - @c FS_O_TRUNC truncate the file
276 * @warning If @p flags are set to 0 the function will open file, if it exists
279 * @param zfp Pointer to a file object
280 * @param file_name The name of a file to open
285 * @retval -EINVAL when a bad file name is given;
286 * @retval -EROFS when opening read-only file for write, or attempting to
287 * create a file on a system that has been mounted with the
289 * @retval -ENOENT when the file does not exist at the path;
290 * @retval -ENOTSUP when not implemented by underlying file system driver;
291 * @retval -EACCES when trying to truncate a file without opening it for write.
292 * @retval <0 an other negative errno code, depending on a file system back-end.
297 * @brief Close file
299 * Flushes the associated stream and closes the file.
301 * @param zfp Pointer to the file object
304 * @retval -ENOTSUP when not implemented by underlying file system driver;
310 * @brief Unlink file
312 * Deletes the specified file or directory
314 * @param path Path to the file or directory to delete
317 * @retval -EINVAL when a bad file name is given;
318 * @retval -EROFS if file is read-only, or when file system has been mounted
320 * @retval -ENOTSUP when not implemented by underlying file system driver;
326 * @brief Rename file or directory
329 * specified destination. The source path can refer to either a file or a
331 * already exist. If the source path refers to a file, the destination path
343 * @retval -EINVAL when a bad file name is given, or when rename would cause move
345 * @retval -EROFS if file is read-only, or when file system has been mounted
347 * @retval -ENOTSUP when not implemented by underlying file system driver;
353 * @brief Read file
359 * @param zfp Pointer to the file object
364 * @retval -EBADF when invoked on zfp that represents unopened/closed file;
365 * @retval -ENOTSUP when not implemented by underlying file system driver;
371 * @brief Write file
373 * Attempts to write @p size number of bytes to the specified file.
374 * If a negative value is returned from the function, the file pointer has not
380 * @param zfp Pointer to the file object
385 * @retval -EBADF when invoked on zfp that represents unopened/closed file;
386 * @retval -ENOTSUP when not implemented by underlying file system driver;
392 * @brief Seek file
394 * Moves the file position to a new location in the file. The @p offset is added
395 * to file position based on the @p whence parameter.
397 * @param zfp Pointer to the file object
398 * @param offset Relative location to move the file pointer to
400 * - @c FS_SEEK_SET for the beginning of the file;
402 * - @c FS_SEEK_END for the end of the file.
405 * @retval -EBADF when invoked on zfp that represents unopened/closed file;
406 * @retval -ENOTSUP if not supported by underlying file system driver;
412 * @brief Get current file position.
414 * Retrieves and returns the current position in the file stream.
416 * @param zfp Pointer to the file object
418 * @retval >= 0 a current position in file;
419 * @retval -EBADF when invoked on zfp that represents unopened/closed file;
420 * @retval -ENOTSUP if not supported by underlying file system driver;
423 * The current revision does not validate the file object.
428 * @brief Truncate or extend an open file to a given size
430 * Truncates the file to the new length if it is shorter than the current
431 * size of the file. Expands the file if the new length is greater than the
432 * current size of the file. The expanded region would be filled with zeroes.
439 * @param zfp Pointer to the file object
440 * @param length New size of the file in bytes
443 * @retval -EBADF when invoked on zfp that represents unopened/closed file;
444 * @retval -ENOTSUP when not implemented by underlying file system driver;
450 * @brief Flush cached write data buffers of an open file
452 * The function flushes the cache of an open file; it can be invoked to ensure
455 * @note Closing a file will cause caches to be flushed correctly so the
456 * function need not be called when the file is being closed.
458 * @param zfp Pointer to the file object
461 * @retval -EBADF when invoked on zfp that represents unopened/closed file;
462 * @retval -ENOTSUP when not implemented by underlying file system driver;
477 * file system has been mounted with the FS_MOUNT_FLAG_READ_ONLY flag;
478 * @retval -ENOTSUP when not implemented by underlying file system driver;
494 * @retval -ENOTSUP when not implemented by underlying file system driver;
505 * @note: Most existing underlying file systems do not generate POSIX
515 * @retval -ENOTSUP when not implemented by underlying file system driver;
528 * @retval -ENOTSUP when not implemented by underlying file system driver;
536 * Perform steps needed for mounting a file system like
537 * calling the file system specific mount function and adding
538 * the mount point to mounted file system list.
552 * @retval -ENOENT when file system type has not been registered;
553 * @retval -ENOTSUP when not supported by underlying file system driver;
565 * Perform steps needed to unmount a file system like
566 * calling the file system specific unmount function and removing
567 * the mount point from mounted file system list.
573 * @retval -ENOTSUP when not supported by underlying file system driver;
596 * @brief File or directory status
598 * Checks the status of a file or directory specified by the @p path.
599 * @note The file on a storage device may not be updated until it is closed.
601 * @param path Path to the file or directory
602 * @param entry Pointer to the zfs_dirent structure to fill if the file or
606 * @retval -EINVAL when a bad directory or file name is given;
607 * @retval -ENOENT when no such directory or file is found;
608 * @retval -ENOTSUP when not supported by underlying file system driver;
614 * @brief Retrieves statistics of the file system volume
616 * Returns the total and available space in the file system volume.
623 * @retval -EINVAL when a bad path to a directory, or a file, is given;
624 * @retval -ENOTSUP when not implemented by underlying file system driver;
630 * @brief Create fresh file system
632 * @param fs_type Type of file system to create.
635 * @param flags Additional flags for file system implementation.
643 * @brief Register a file system
645 * Register file system with virtual file system.
646 * Number of allowed file system types to be registered is controlled with the
649 * @param type Type of file system (ex: @c FS_FATFS)
650 * @param fs Pointer to File system
653 * @retval -EALREADY when a file system of a given type has already been registered;
654 * @retval -ENOSCP when there is no space left, in file system registry, to add
655 * this file system type.
660 * @brief Unregister a file system
662 * Unregister file system from virtual file system.
664 * @param type Type of file system (ex: @c FS_FATFS)
665 * @param fs Pointer to File system
668 * @retval -EINVAL when file system of a given type has not been registered.