From 656f4dfdac8d8a9c3d907a2bd9ec822b6b088a81 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Tue, 25 Jun 2019 12:09:16 -0400 Subject: [PATCH] cleanup: include/: move fs.h to fs/fs.h move fs.h to fs/fs.h and create a shim for backward-compatibility. No functional changes to the headers. A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES. Related to #16539 Signed-off-by: Anas Nashif --- include/fs.h | 488 +---------------- include/fs/fs.h | 495 ++++++++++++++++++ include/misc/fdtable.h | 2 +- include/posix/dirent.h | 2 +- include/posix/unistd.h | 2 +- lib/gui/lvgl/lvgl_fs.c | 2 +- samples/subsys/fs/src/main.c | 2 +- samples/subsys/mgmt/mcumgr/smp_svr/src/main.c | 2 +- samples/subsys/usb/mass/src/main.c | 2 +- subsys/fs/fat_fs.c | 2 +- subsys/fs/fs.c | 2 +- subsys/fs/fuse_fs_access.c | 2 +- subsys/fs/nffs_fs.c | 2 +- subsys/fs/shell.c | 2 +- subsys/settings/src/settings_file.c | 2 +- subsys/settings/src/settings_init.c | 2 +- tests/posix/fs/src/test_fat_mount.c | 2 +- tests/subsys/fs/fat_fs_api/src/test_fat.h | 2 +- .../fs/fat_fs_dual_drive/src/test_fat.h | 2 +- .../subsys/fs/multi-fs/src/nffs_test_utils.c | 2 +- tests/subsys/fs/multi-fs/src/test_fat.h | 2 +- tests/subsys/fs/multi-fs/src/test_fs_shell.h | 2 +- tests/subsys/fs/multi-fs/src/test_nffs.h | 2 +- tests/subsys/fs/multi-fs/src/test_nffs_dir.c | 2 +- tests/subsys/fs/multi-fs/src/test_nffs_file.c | 2 +- .../subsys/fs/multi-fs/src/test_nffs_mount.c | 2 +- .../nffs_fs_api/common/nffs_test_system_01.c | 2 +- .../fs/nffs_fs_api/common/nffs_test_utils.c | 2 +- .../fs/nffs_fs_api/common/test_append.c | 2 +- .../common/test_cache_large_file.c | 2 +- .../nffs_fs_api/common/test_corrupt_block.c | 2 +- .../nffs_fs_api/common/test_corrupt_scratch.c | 2 +- tests/subsys/fs/nffs_fs_api/common/test_gc.c | 2 +- .../fs/nffs_fs_api/common/test_gc_on_oom.c | 2 +- .../common/test_incomplete_block.c | 2 +- .../fs/nffs_fs_api/common/test_large_system.c | 2 +- .../fs/nffs_fs_api/common/test_large_unlink.c | 2 +- .../fs/nffs_fs_api/common/test_large_write.c | 2 +- .../nffs_fs_api/common/test_long_filename.c | 2 +- .../fs/nffs_fs_api/common/test_lost_found.c | 2 +- .../nffs_fs_api/common/test_many_children.c | 2 +- .../subsys/fs/nffs_fs_api/common/test_mkdir.c | 2 +- .../subsys/fs/nffs_fs_api/common/test_mount.c | 2 +- .../subsys/fs/nffs_fs_api/common/test_nffs.h | 2 +- .../subsys/fs/nffs_fs_api/common/test_open.c | 2 +- .../nffs_fs_api/common/test_overwrite_many.c | 2 +- .../nffs_fs_api/common/test_overwrite_one.c | 2 +- .../nffs_fs_api/common/test_overwrite_three.c | 2 +- .../nffs_fs_api/common/test_overwrite_two.c | 2 +- .../fs/nffs_fs_api/common/test_performance.c | 2 +- .../subsys/fs/nffs_fs_api/common/test_read.c | 2 +- .../fs/nffs_fs_api/common/test_readdir.c | 2 +- .../fs/nffs_fs_api/common/test_rename.c | 2 +- .../fs/nffs_fs_api/common/test_split_file.c | 2 +- .../fs/nffs_fs_api/common/test_unlink.c | 2 +- .../fs/nffs_fs_api/common/test_wear_level.c | 2 +- .../settings/nffs/src/settings_setup_nffs.c | 2 +- .../subsys/settings/nffs/src/settings_test.h | 2 +- .../nffs/src/settings_test_empty_file.c | 2 +- 59 files changed, 556 insertions(+), 541 deletions(-) create mode 100644 include/fs/fs.h diff --git a/include/fs.h b/include/fs.h index 638d3aef7b1..01cf135be4f 100644 --- a/include/fs.h +++ b/include/fs.h @@ -1,495 +1,15 @@ /* - * Copyright (c) 2016 Intel Corporation. + * Copyright (c) 2019 Intel Corporation * * SPDX-License-Identifier: Apache-2.0 */ - #ifndef ZEPHYR_INCLUDE_FS_H_ #define ZEPHYR_INCLUDE_FS_H_ -#ifdef CONFIG_ARCH_POSIX -#ifndef __ssize_t_defined -typedef __SIZE_TYPE__ ssize_t; -#define __ssize_t_defined +#ifndef CONFIG_COMPAT_INCLUDES +#warning "This header file has moved, include instead." #endif -#ifndef __off_t_defined -#ifndef __USE_FILE_OFFSET64 -typedef long int off_t; -#else -typedef long long int off_t; -#endif -#define __off_t_defined -#endif - -#else -#include -#endif - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @brief File System APIs - * @defgroup file_system_api File System APIs - * @{ - */ -struct fs_file_system_t; - -enum fs_dir_entry_type { - FS_DIR_ENTRY_FILE = 0, - FS_DIR_ENTRY_DIR -}; - -enum fs_type { - FS_FATFS = 0, - FS_NFFS, - FS_TYPE_END, -}; - - -/** - * @brief File system mount info structure - * - * @param node Entry for the fs_mount_list list - * @param type File system type - * @param mnt_point Mount point directory name (ex: "/fatfs") - * @param fs_data Pointer to file system specific data - * @param storage_dev Pointer to backend storage device - * @param mountp_len Length of Mount point string - * @param fs Pointer to File system interface of the mount point - */ -struct fs_mount_t { - sys_dnode_t node; - enum fs_type type; - const char *mnt_point; - void *fs_data; - void *storage_dev; - /* fields filled by file system core */ - size_t mountp_len; - const struct fs_file_system_t *fs; -}; - -/** - * @brief Structure to receive file or directory information - * - * Used in functions that reads the directory entries to get - * file or directory information. - * - * @param dir_entry_type Whether file or directory - * - FS_DIR_ENTRY_FILE - * - FS_DIR_ENTRY_DIR - * @param name Name of directory or file - * @param size Size of file. 0 if directory - */ -struct fs_dirent { - enum fs_dir_entry_type type; - char name[MAX_FILE_NAME + 1]; - size_t size; -}; - -/** - * @brief Structure to receive volume statistics - * - * Used to retrieve information about total and available space - * in the volume. - * - * @param f_bsize Optimal transfer block size - * @param f_frsize Allocation unit size - * @param f_blocks Size of FS in f_frsize units - * @param f_bfree Number of free blocks - */ -struct fs_statvfs { - unsigned long f_bsize; - unsigned long f_frsize; - unsigned long f_blocks; - unsigned long f_bfree; -}; - -/** - * @brief File System interface structure - * - * @param open Opens an existing file or create a new one - * @param read Reads items of data of size bytes long - * @param write Writes items of data of size bytes long - * @param lseek Moves the file position to a new location in the file - * @param tell Retrieves the current position in the file - * @param truncate Truncates the file to the new length - * @param sync Flush the cache of an open file - * @param close Flushes the associated stream and closes the file - * @param opendir Opens an existing directory specified by the path - * @param readdir Reads directory entries of a open directory - * @param closedir Closes an open directory - * @param mount Mount a file system - * @param unmount Unmount a file system - * @param unlink Deletes the specified file or directory - * @param rename Renames a file or directory - * @param mkdir Creates a new directory using specified path - * @param stat Checks the status of a file or directory specified by the path - * @param statvfs Returns the total and available space in the filesystem volume - */ -struct fs_file_system_t { - /* File operations */ - int (*open)(struct fs_file_t *filp, const char *fs_path); - ssize_t (*read)(struct fs_file_t *filp, void *dest, size_t nbytes); - ssize_t (*write)(struct fs_file_t *filp, - const void *src, size_t nbytes); - int (*lseek)(struct fs_file_t *filp, off_t off, int whence); - off_t (*tell)(struct fs_file_t *filp); - int (*truncate)(struct fs_file_t *filp, off_t length); - int (*sync)(struct fs_file_t *filp); - int (*close)(struct fs_file_t *filp); - /* Directory operations */ - int (*opendir)(struct fs_dir_t *dirp, const char *fs_path); - int (*readdir)(struct fs_dir_t *dirp, struct fs_dirent *entry); - int (*closedir)(struct fs_dir_t *dirp); - /* File system level operations */ - int (*mount)(struct fs_mount_t *mountp); - int (*unmount)(struct fs_mount_t *mountp); - int (*unlink)(struct fs_mount_t *mountp, const char *name); - int (*rename)(struct fs_mount_t *mountp, const char *from, - const char *to); - int (*mkdir)(struct fs_mount_t *mountp, const char *name); - int (*stat)(struct fs_mount_t *mountp, const char *path, - struct fs_dirent *entry); - int (*statvfs)(struct fs_mount_t *mountp, const char *path, - struct fs_statvfs *stat); -}; - -#ifndef FS_SEEK_SET -#define FS_SEEK_SET 0 /* Seek from beginning of file. */ -#endif -#ifndef FS_SEEK_CUR -#define FS_SEEK_CUR 1 /* Seek from current position. */ -#endif -#ifndef FS_SEEK_END -#define FS_SEEK_END 2 /* Seek from end of file. */ -#endif - - -/** - * @brief File open - * - * Opens an existing file or create a new one and associates - * a stream with it. - * - * @param zfp Pointer to file object - * @param file_name The name of file to open - * - * @retval 0 Success - * @retval -ERRNO errno code if error - */ -int fs_open(struct fs_file_t *zfp, const char *file_name); - -/** - * @brief File close - * - * Flushes the associated stream and closes - * the file. - * - * @param zfp Pointer to the file object - * - * @retval 0 Success - * @retval -ERRNO errno code if error - */ -int fs_close(struct fs_file_t *zfp); - -/** - * @brief File unlink - * - * Deletes the specified file or directory - * - * @param path Path to the file or directory to delete - * - * @retval 0 Success - * @retval -ERRNO errno code if error - */ -int fs_unlink(const char *path); - -/** - * @brief File o directory rename - * - * Performs a rename and / or move of the specified source path to the - * specified destination. The source path can refer to either a file or a - * directory. All intermediate directories in the destination path must - * already exist. If the source path refers to a file, the destination path - * must contain a full filename path, rather than just the new parent - * directory. If an object already exists at the specified destination path, - * this function causes it to be unlinked prior to the rename (i.e., the - * destination gets clobbered). - * - * @param from The source path. - * @param to The destination path. - * - * @retval 0 Success; - * @retval -ERRNO errno code if error - */ -int fs_rename(const char *from, const char *to); - -/** - * @brief File read - * - * Reads items of data of size bytes long. - * - * @param zfp Pointer to the file object - * @param ptr Pointer to the data buffer - * @param size Number of bytes to be read - * - * @return Number of bytes read. On success, it will be equal to number of - * items requested to be read. Returns less than number of bytes - * requested if there are not enough bytes available in file. Will return - * -ERRNO code on error. - */ -ssize_t fs_read(struct fs_file_t *zfp, void *ptr, size_t size); - -/** - * @brief File write - * - * Writes items of data of size bytes long. - * - * @param zfp Pointer to the file object - * @param ptr Pointer to the data buffer - * @param size Number of bytes to be write - * - * @return Number of bytes written. On success, it will be equal to the number - * of bytes requested to be written. Any other value, indicates an error. Will - * return -ERRNO code on error. - * In the case where -ERRNO is returned, the file pointer will not be - * advanced because it couldn't start the operation. - * In the case where it is able to write, but is not able to complete writing - * all of the requested number of bytes, then it is because the disk got full. - * In that case, it returns less number of bytes written than requested, but - * not a negative -ERRNO value as in regular error case. - */ -ssize_t fs_write(struct fs_file_t *zfp, const void *ptr, size_t size); - -/** - * @brief File seek - * - * Moves the file position to a new location in the file. The offset is added - * to file position based on the 'whence' parameter. - * - * @param zfp Pointer to the file object - * @param offset Relative location to move the file pointer to - * @param whence Relative location from where offset is to be calculated. - * - FS_SEEK_SET = from beginning of file - * - FS_SEEK_CUR = from current position, - * - FS_SEEK_END = from end of file. - * - * @retval 0 Success - * @retval -ERRNO errno code if error. - */ -int fs_seek(struct fs_file_t *zfp, off_t offset, int whence); - -/** - * @brief Get current file position. - * - * Retrieves the current position in the file. - * - * @param zfp Pointer to the file object - * - * @retval position Current position in file - * Current revision does not validate the file object. - */ -off_t fs_tell(struct fs_file_t *zfp); - -/** - * @brief Change the size of an open file - * - * Truncates the file to the new length if it is shorter than the current - * size of the file. Expands the file if the new length is greater than the - * current size of the file. The expanded region would be filled with zeroes. - * - * @note In the case of expansion, if the volume got full during the - * expansion process, the function will expand to the maximum possible length - * and returns success. Caller should check if the expanded size matches the - * requested length. - * - * @param zfp Pointer to the file object - * @param length New size of the file in bytes - * - * @retval 0 Success - * @retval -ERRNO errno code if error - */ -int fs_truncate(struct fs_file_t *zfp, off_t length); - -/** - * @brief Flushes any cached write of an open file - * - * This function can be used to flush the cache of an open file. This can - * be called to ensure data gets written to the storage media immediately. - * This may be done to avoid data loss if power is removed unexpectedly. - * Note that closing a file will cause caches to be flushed correctly so it - * need not be called if the file is being closed. - * - * @param zfp Pointer to the file object - * - * @retval 0 Success - * @retval -ERRNO errno code if error - */ -int fs_sync(struct fs_file_t *zfp); - -/** - * @brief Directory create - * - * Creates a new directory using specified path. - * - * @param path Path to the directory to create - * - * @retval 0 Success - * @retval -ERRNO errno code if error - */ -int fs_mkdir(const char *path); - -/** - * @brief Directory open - * - * Opens an existing directory specified by the path. - * - * @param zdp Pointer to the directory object - * @param path Path to the directory to open - * - * @retval 0 Success - * @retval -ERRNO errno code if error - */ -int fs_opendir(struct fs_dir_t *zdp, const char *path); - -/** - * @brief Directory read entry - * - * Reads directory entries of a open directory - * - * @param zdp Pointer to the directory object - * @param entry Pointer to zfs_dirent structure to read the entry into - * - * @retval 0 Success - * @retval -ERRNO errno code if error - * @return In end-of-dir condition, this will return 0 and set - * entry->name[0] = 0 - */ -int fs_readdir(struct fs_dir_t *zdp, struct fs_dirent *entry); - -/** - * @brief Directory close - * - * Closes an open directory. - * - * @param zdp Pointer to the directory object - * - * @retval 0 Success - * @retval -ERRNO errno code if error - */ -int fs_closedir(struct fs_dir_t *zdp); - -/** - * @brief Mount filesystem - * - * Perform steps needed for mounting a file system like - * calling the file system specific mount function and adding - * the mount point to mounted file system list. - * - * @param mp Pointer to the fs_mount_t structure - * - * @retval 0 Success - * @retval -ERRNO errno code if error - */ -int fs_mount(struct fs_mount_t *mp); - -/** - * @brief Unmount filesystem - * - * Perform steps needed for unmounting a file system like - * calling the file system specific unmount function and removing - * the mount point from mounted file system list. - * - * - * @param mp Pointer to the fs_mount_t structure - * - * @retval 0 Success - * @retval -ERRNO errno code if error - */ -int fs_unmount(struct fs_mount_t *mp); - -/** - * @brief Mount point read entry - * - * Read mount point entry - * - * @param number Pointer to mount point number - * @param name Pointer to mount point name - * - * @retval 0 Success - * @retval -ERRNO errno code if error - * @return On success \p number is incremented and \p name is set to mount - * point name. In case no mount point exists for the given \p number - * -ENOENT is returned and \p name is set to NULL. - */ -int fs_readmount(int *number, const char **name); - -/** - * @brief File or directory status - * - * Checks the status of a file or directory specified by the path - * - * @param path Path to the file or directory - * @param entry Pointer to zfs_dirent structure to fill if file or directory - * exists. - * - * @retval 0 Success - * @retval -ERRNO errno code if error - */ -int fs_stat(const char *path, struct fs_dirent *entry); - -/** - * @brief Retrieves statistics of the file system volume - * - * Returns the total and available space in the file system volume. - * - * @param path Path to the mounted directory - * @param stat Pointer to zfs_statvfs structure to receive the fs statistics - * - * @retval 0 Success - * @retval -ERRNO errno code if error - */ -int fs_statvfs(const char *path, struct fs_statvfs *stat); - -/** - * @brief Register a file system - * - * Register file system with virtual file system. - * - * @param type Type of file system (ex: FS_FATFS) - * @param fs Pointer to File system - * - * @retval 0 Success - * @retval -ERRNO errno code if error - */ -int fs_register(enum fs_type type, struct fs_file_system_t *fs); - -/** - * @brief Unregister a file system - * - * Unregister file system from virtual file system. - * - * @param type Type of file system (ex: FS_FATFS) - * @param fs Pointer to File system - * - * @retval 0 Success - * @retval -ERRNO errno code if error - */ -int fs_unregister(enum fs_type type, struct fs_file_system_t *fs); - -/** - * @} - */ - - -#ifdef __cplusplus -} -#endif +#include #endif /* ZEPHYR_INCLUDE_FS_H_ */ diff --git a/include/fs/fs.h b/include/fs/fs.h new file mode 100644 index 00000000000..a7bec43769e --- /dev/null +++ b/include/fs/fs.h @@ -0,0 +1,495 @@ +/* + * Copyright (c) 2016 Intel Corporation. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef ZEPHYR_INCLUDE_FS_FS_H_ +#define ZEPHYR_INCLUDE_FS_FS_H_ + +#ifdef CONFIG_ARCH_POSIX +#ifndef __ssize_t_defined +typedef __SIZE_TYPE__ ssize_t; +#define __ssize_t_defined +#endif + +#ifndef __off_t_defined +#ifndef __USE_FILE_OFFSET64 +typedef long int off_t; +#else +typedef long long int off_t; +#endif +#define __off_t_defined +#endif + +#else +#include +#endif + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief File System APIs + * @defgroup file_system_api File System APIs + * @{ + */ +struct fs_file_system_t; + +enum fs_dir_entry_type { + FS_DIR_ENTRY_FILE = 0, + FS_DIR_ENTRY_DIR +}; + +enum fs_type { + FS_FATFS = 0, + FS_NFFS, + FS_TYPE_END, +}; + + +/** + * @brief File system mount info structure + * + * @param node Entry for the fs_mount_list list + * @param type File system type + * @param mnt_point Mount point directory name (ex: "/fatfs") + * @param fs_data Pointer to file system specific data + * @param storage_dev Pointer to backend storage device + * @param mountp_len Length of Mount point string + * @param fs Pointer to File system interface of the mount point + */ +struct fs_mount_t { + sys_dnode_t node; + enum fs_type type; + const char *mnt_point; + void *fs_data; + void *storage_dev; + /* fields filled by file system core */ + size_t mountp_len; + const struct fs_file_system_t *fs; +}; + +/** + * @brief Structure to receive file or directory information + * + * Used in functions that reads the directory entries to get + * file or directory information. + * + * @param dir_entry_type Whether file or directory + * - FS_DIR_ENTRY_FILE + * - FS_DIR_ENTRY_DIR + * @param name Name of directory or file + * @param size Size of file. 0 if directory + */ +struct fs_dirent { + enum fs_dir_entry_type type; + char name[MAX_FILE_NAME + 1]; + size_t size; +}; + +/** + * @brief Structure to receive volume statistics + * + * Used to retrieve information about total and available space + * in the volume. + * + * @param f_bsize Optimal transfer block size + * @param f_frsize Allocation unit size + * @param f_blocks Size of FS in f_frsize units + * @param f_bfree Number of free blocks + */ +struct fs_statvfs { + unsigned long f_bsize; + unsigned long f_frsize; + unsigned long f_blocks; + unsigned long f_bfree; +}; + +/** + * @brief File System interface structure + * + * @param open Opens an existing file or create a new one + * @param read Reads items of data of size bytes long + * @param write Writes items of data of size bytes long + * @param lseek Moves the file position to a new location in the file + * @param tell Retrieves the current position in the file + * @param truncate Truncates the file to the new length + * @param sync Flush the cache of an open file + * @param close Flushes the associated stream and closes the file + * @param opendir Opens an existing directory specified by the path + * @param readdir Reads directory entries of a open directory + * @param closedir Closes an open directory + * @param mount Mount a file system + * @param unmount Unmount a file system + * @param unlink Deletes the specified file or directory + * @param rename Renames a file or directory + * @param mkdir Creates a new directory using specified path + * @param stat Checks the status of a file or directory specified by the path + * @param statvfs Returns the total and available space in the filesystem volume + */ +struct fs_file_system_t { + /* File operations */ + int (*open)(struct fs_file_t *filp, const char *fs_path); + ssize_t (*read)(struct fs_file_t *filp, void *dest, size_t nbytes); + ssize_t (*write)(struct fs_file_t *filp, + const void *src, size_t nbytes); + int (*lseek)(struct fs_file_t *filp, off_t off, int whence); + off_t (*tell)(struct fs_file_t *filp); + int (*truncate)(struct fs_file_t *filp, off_t length); + int (*sync)(struct fs_file_t *filp); + int (*close)(struct fs_file_t *filp); + /* Directory operations */ + int (*opendir)(struct fs_dir_t *dirp, const char *fs_path); + int (*readdir)(struct fs_dir_t *dirp, struct fs_dirent *entry); + int (*closedir)(struct fs_dir_t *dirp); + /* File system level operations */ + int (*mount)(struct fs_mount_t *mountp); + int (*unmount)(struct fs_mount_t *mountp); + int (*unlink)(struct fs_mount_t *mountp, const char *name); + int (*rename)(struct fs_mount_t *mountp, const char *from, + const char *to); + int (*mkdir)(struct fs_mount_t *mountp, const char *name); + int (*stat)(struct fs_mount_t *mountp, const char *path, + struct fs_dirent *entry); + int (*statvfs)(struct fs_mount_t *mountp, const char *path, + struct fs_statvfs *stat); +}; + +#ifndef FS_SEEK_SET +#define FS_SEEK_SET 0 /* Seek from beginning of file. */ +#endif +#ifndef FS_SEEK_CUR +#define FS_SEEK_CUR 1 /* Seek from current position. */ +#endif +#ifndef FS_SEEK_END +#define FS_SEEK_END 2 /* Seek from end of file. */ +#endif + + +/** + * @brief File open + * + * Opens an existing file or create a new one and associates + * a stream with it. + * + * @param zfp Pointer to file object + * @param file_name The name of file to open + * + * @retval 0 Success + * @retval -ERRNO errno code if error + */ +int fs_open(struct fs_file_t *zfp, const char *file_name); + +/** + * @brief File close + * + * Flushes the associated stream and closes + * the file. + * + * @param zfp Pointer to the file object + * + * @retval 0 Success + * @retval -ERRNO errno code if error + */ +int fs_close(struct fs_file_t *zfp); + +/** + * @brief File unlink + * + * Deletes the specified file or directory + * + * @param path Path to the file or directory to delete + * + * @retval 0 Success + * @retval -ERRNO errno code if error + */ +int fs_unlink(const char *path); + +/** + * @brief File o directory rename + * + * Performs a rename and / or move of the specified source path to the + * specified destination. The source path can refer to either a file or a + * directory. All intermediate directories in the destination path must + * already exist. If the source path refers to a file, the destination path + * must contain a full filename path, rather than just the new parent + * directory. If an object already exists at the specified destination path, + * this function causes it to be unlinked prior to the rename (i.e., the + * destination gets clobbered). + * + * @param from The source path. + * @param to The destination path. + * + * @retval 0 Success; + * @retval -ERRNO errno code if error + */ +int fs_rename(const char *from, const char *to); + +/** + * @brief File read + * + * Reads items of data of size bytes long. + * + * @param zfp Pointer to the file object + * @param ptr Pointer to the data buffer + * @param size Number of bytes to be read + * + * @return Number of bytes read. On success, it will be equal to number of + * items requested to be read. Returns less than number of bytes + * requested if there are not enough bytes available in file. Will return + * -ERRNO code on error. + */ +ssize_t fs_read(struct fs_file_t *zfp, void *ptr, size_t size); + +/** + * @brief File write + * + * Writes items of data of size bytes long. + * + * @param zfp Pointer to the file object + * @param ptr Pointer to the data buffer + * @param size Number of bytes to be write + * + * @return Number of bytes written. On success, it will be equal to the number + * of bytes requested to be written. Any other value, indicates an error. Will + * return -ERRNO code on error. + * In the case where -ERRNO is returned, the file pointer will not be + * advanced because it couldn't start the operation. + * In the case where it is able to write, but is not able to complete writing + * all of the requested number of bytes, then it is because the disk got full. + * In that case, it returns less number of bytes written than requested, but + * not a negative -ERRNO value as in regular error case. + */ +ssize_t fs_write(struct fs_file_t *zfp, const void *ptr, size_t size); + +/** + * @brief File seek + * + * Moves the file position to a new location in the file. The offset is added + * to file position based on the 'whence' parameter. + * + * @param zfp Pointer to the file object + * @param offset Relative location to move the file pointer to + * @param whence Relative location from where offset is to be calculated. + * - FS_SEEK_SET = from beginning of file + * - FS_SEEK_CUR = from current position, + * - FS_SEEK_END = from end of file. + * + * @retval 0 Success + * @retval -ERRNO errno code if error. + */ +int fs_seek(struct fs_file_t *zfp, off_t offset, int whence); + +/** + * @brief Get current file position. + * + * Retrieves the current position in the file. + * + * @param zfp Pointer to the file object + * + * @retval position Current position in file + * Current revision does not validate the file object. + */ +off_t fs_tell(struct fs_file_t *zfp); + +/** + * @brief Change the size of an open file + * + * Truncates the file to the new length if it is shorter than the current + * size of the file. Expands the file if the new length is greater than the + * current size of the file. The expanded region would be filled with zeroes. + * + * @note In the case of expansion, if the volume got full during the + * expansion process, the function will expand to the maximum possible length + * and returns success. Caller should check if the expanded size matches the + * requested length. + * + * @param zfp Pointer to the file object + * @param length New size of the file in bytes + * + * @retval 0 Success + * @retval -ERRNO errno code if error + */ +int fs_truncate(struct fs_file_t *zfp, off_t length); + +/** + * @brief Flushes any cached write of an open file + * + * This function can be used to flush the cache of an open file. This can + * be called to ensure data gets written to the storage media immediately. + * This may be done to avoid data loss if power is removed unexpectedly. + * Note that closing a file will cause caches to be flushed correctly so it + * need not be called if the file is being closed. + * + * @param zfp Pointer to the file object + * + * @retval 0 Success + * @retval -ERRNO errno code if error + */ +int fs_sync(struct fs_file_t *zfp); + +/** + * @brief Directory create + * + * Creates a new directory using specified path. + * + * @param path Path to the directory to create + * + * @retval 0 Success + * @retval -ERRNO errno code if error + */ +int fs_mkdir(const char *path); + +/** + * @brief Directory open + * + * Opens an existing directory specified by the path. + * + * @param zdp Pointer to the directory object + * @param path Path to the directory to open + * + * @retval 0 Success + * @retval -ERRNO errno code if error + */ +int fs_opendir(struct fs_dir_t *zdp, const char *path); + +/** + * @brief Directory read entry + * + * Reads directory entries of a open directory + * + * @param zdp Pointer to the directory object + * @param entry Pointer to zfs_dirent structure to read the entry into + * + * @retval 0 Success + * @retval -ERRNO errno code if error + * @return In end-of-dir condition, this will return 0 and set + * entry->name[0] = 0 + */ +int fs_readdir(struct fs_dir_t *zdp, struct fs_dirent *entry); + +/** + * @brief Directory close + * + * Closes an open directory. + * + * @param zdp Pointer to the directory object + * + * @retval 0 Success + * @retval -ERRNO errno code if error + */ +int fs_closedir(struct fs_dir_t *zdp); + +/** + * @brief Mount filesystem + * + * Perform steps needed for mounting a file system like + * calling the file system specific mount function and adding + * the mount point to mounted file system list. + * + * @param mp Pointer to the fs_mount_t structure + * + * @retval 0 Success + * @retval -ERRNO errno code if error + */ +int fs_mount(struct fs_mount_t *mp); + +/** + * @brief Unmount filesystem + * + * Perform steps needed for unmounting a file system like + * calling the file system specific unmount function and removing + * the mount point from mounted file system list. + * + * + * @param mp Pointer to the fs_mount_t structure + * + * @retval 0 Success + * @retval -ERRNO errno code if error + */ +int fs_unmount(struct fs_mount_t *mp); + +/** + * @brief Mount point read entry + * + * Read mount point entry + * + * @param number Pointer to mount point number + * @param name Pointer to mount point name + * + * @retval 0 Success + * @retval -ERRNO errno code if error + * @return On success \p number is incremented and \p name is set to mount + * point name. In case no mount point exists for the given \p number + * -ENOENT is returned and \p name is set to NULL. + */ +int fs_readmount(int *number, const char **name); + +/** + * @brief File or directory status + * + * Checks the status of a file or directory specified by the path + * + * @param path Path to the file or directory + * @param entry Pointer to zfs_dirent structure to fill if file or directory + * exists. + * + * @retval 0 Success + * @retval -ERRNO errno code if error + */ +int fs_stat(const char *path, struct fs_dirent *entry); + +/** + * @brief Retrieves statistics of the file system volume + * + * Returns the total and available space in the file system volume. + * + * @param path Path to the mounted directory + * @param stat Pointer to zfs_statvfs structure to receive the fs statistics + * + * @retval 0 Success + * @retval -ERRNO errno code if error + */ +int fs_statvfs(const char *path, struct fs_statvfs *stat); + +/** + * @brief Register a file system + * + * Register file system with virtual file system. + * + * @param type Type of file system (ex: FS_FATFS) + * @param fs Pointer to File system + * + * @retval 0 Success + * @retval -ERRNO errno code if error + */ +int fs_register(enum fs_type type, struct fs_file_system_t *fs); + +/** + * @brief Unregister a file system + * + * Unregister file system from virtual file system. + * + * @param type Type of file system (ex: FS_FATFS) + * @param fs Pointer to File system + * + * @retval 0 Success + * @retval -ERRNO errno code if error + */ +int fs_unregister(enum fs_type type, struct fs_file_system_t *fs); + +/** + * @} + */ + + +#ifdef __cplusplus +} +#endif + +#endif /* ZEPHYR_INCLUDE_FS_FS_H_ */ diff --git a/include/misc/fdtable.h b/include/misc/fdtable.h index 95b8933b7af..4608df90977 100644 --- a/include/misc/fdtable.h +++ b/include/misc/fdtable.h @@ -9,7 +9,7 @@ #include #include /* FIXME: For native_posix ssize_t, off_t. */ -#include +#include #ifdef __cplusplus extern "C" { diff --git a/include/posix/dirent.h b/include/posix/dirent.h index e2f4133b9b6..0496da13e0e 100644 --- a/include/posix/dirent.h +++ b/include/posix/dirent.h @@ -14,7 +14,7 @@ extern "C" { #include "posix_types.h" #ifdef CONFIG_POSIX_FS -#include +#include typedef void DIR; diff --git a/include/posix/unistd.h b/include/posix/unistd.h index 48f630cee46..d25006a557d 100644 --- a/include/posix/unistd.h +++ b/include/posix/unistd.h @@ -18,7 +18,7 @@ extern "C" { #endif #ifdef CONFIG_POSIX_API -#include +#include /* File related operations */ extern int open(const char *name, int flags); diff --git a/lib/gui/lvgl/lvgl_fs.c b/lib/gui/lvgl/lvgl_fs.c index 0d96c5b9c41..918cc5584a8 100644 --- a/lib/gui/lvgl/lvgl_fs.c +++ b/lib/gui/lvgl/lvgl_fs.c @@ -6,7 +6,7 @@ #include #include -#include +#include /* Stub for LVGL ufs (ram based FS) init function * as we use Zephyr FS API instead diff --git a/samples/subsys/fs/src/main.c b/samples/subsys/fs/src/main.c index 812fab02ee0..97d226b6a70 100644 --- a/samples/subsys/fs/src/main.c +++ b/samples/subsys/fs/src/main.c @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include LOG_MODULE_REGISTER(main); diff --git a/samples/subsys/mgmt/mcumgr/smp_svr/src/main.c b/samples/subsys/mgmt/mcumgr/smp_svr/src/main.c index ece29c18cef..03d0cd149cd 100644 --- a/samples/subsys/mgmt/mcumgr/smp_svr/src/main.c +++ b/samples/subsys/mgmt/mcumgr/smp_svr/src/main.c @@ -13,7 +13,7 @@ #ifdef CONFIG_MCUMGR_CMD_FS_MGMT #include -#include +#include #include "fs_mgmt/fs_mgmt.h" #include #endif diff --git a/samples/subsys/usb/mass/src/main.c b/samples/subsys/usb/mass/src/main.c index 9c18ddded93..e8d9adcc810 100644 --- a/samples/subsys/usb/mass/src/main.c +++ b/samples/subsys/usb/mass/src/main.c @@ -12,7 +12,7 @@ LOG_MODULE_REGISTER(main); #if CONFIG_DISK_ACCESS_FLASH && CONFIG_FAT_FILESYSTEM_ELM -#include +#include #include static FATFS fat_fs; diff --git a/subsys/fs/fat_fs.c b/subsys/fs/fat_fs.c index 7049e918ce2..d75b9f3d3d4 100644 --- a/subsys/fs/fat_fs.c +++ b/subsys/fs/fat_fs.c @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include #include diff --git a/subsys/fs/fs.c b/subsys/fs/fs.c index b6129dba2b6..1c792c86cec 100644 --- a/subsys/fs/fs.c +++ b/subsys/fs/fs.c @@ -9,7 +9,7 @@ #include #include #include -#include +#include #define LOG_LEVEL CONFIG_FS_LOG_LEVEL diff --git a/subsys/fs/fuse_fs_access.c b/subsys/fs/fuse_fs_access.c index 63d959f3497..7fb1802cc48 100644 --- a/subsys/fs/fuse_fs_access.c +++ b/subsys/fs/fuse_fs_access.c @@ -19,7 +19,7 @@ #include #include -#include +#include #include "cmdline.h" #include "soc.h" diff --git a/subsys/fs/nffs_fs.c b/subsys/fs/nffs_fs.c index 747c76b1147..ddea5e98031 100644 --- a/subsys/fs/nffs_fs.c +++ b/subsys/fs/nffs_fs.c @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/subsys/fs/shell.c b/subsys/fs/shell.c index e6d9a0d7467..ded641db9b0 100644 --- a/subsys/fs/shell.c +++ b/subsys/fs/shell.c @@ -9,7 +9,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/subsys/settings/src/settings_file.c b/subsys/settings/src/settings_file.c index b93c9298847..4b7ea15f805 100644 --- a/subsys/settings/src/settings_file.c +++ b/subsys/settings/src/settings_file.c @@ -8,7 +8,7 @@ #include #include -#include +#include #include "settings/settings.h" #include "settings/settings_file.h" diff --git a/subsys/settings/src/settings_init.c b/subsys/settings/src/settings_init.c index 670f1aa5646..12b36124a98 100644 --- a/subsys/settings/src/settings_init.c +++ b/subsys/settings/src/settings_init.c @@ -23,7 +23,7 @@ void settings_init(void); int settings_backend_init(void); #ifdef CONFIG_SETTINGS_FS -#include +#include static struct settings_file config_init_settings_file = { .cf_name = CONFIG_SETTINGS_FS_FILE, diff --git a/tests/posix/fs/src/test_fat_mount.c b/tests/posix/fs/src/test_fat_mount.c index 3e6d8cdad1e..927f1802c18 100644 --- a/tests/posix/fs/src/test_fat_mount.c +++ b/tests/posix/fs/src/test_fat_mount.c @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -#include +#include #include #include "test_fs.h" diff --git a/tests/subsys/fs/fat_fs_api/src/test_fat.h b/tests/subsys/fs/fat_fs_api/src/test_fat.h index e67ca46cc7e..d1c0d9e041c 100644 --- a/tests/subsys/fs/fat_fs_api/src/test_fat.h +++ b/tests/subsys/fs/fat_fs_api/src/test_fat.h @@ -6,7 +6,7 @@ #include #include -#include +#include #define FATFS_MNTP "/NAND:" #define TEST_FILE FATFS_MNTP"/testfile.txt" diff --git a/tests/subsys/fs/fat_fs_dual_drive/src/test_fat.h b/tests/subsys/fs/fat_fs_dual_drive/src/test_fat.h index 846cdcb6516..b72de6e6a82 100644 --- a/tests/subsys/fs/fat_fs_dual_drive/src/test_fat.h +++ b/tests/subsys/fs/fat_fs_dual_drive/src/test_fat.h @@ -6,7 +6,7 @@ #include #include -#include +#include /* Make sure to match the drive name to ELM FAT Lib volume strings */ #define FATFS_MNTP "/RAM:" diff --git a/tests/subsys/fs/multi-fs/src/nffs_test_utils.c b/tests/subsys/fs/multi-fs/src/nffs_test_utils.c index 5ac425f3e6c..d91e763c51f 100644 --- a/tests/subsys/fs/multi-fs/src/nffs_test_utils.c +++ b/tests/subsys/fs/multi-fs/src/nffs_test_utils.c @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/tests/subsys/fs/multi-fs/src/test_fat.h b/tests/subsys/fs/multi-fs/src/test_fat.h index c99ec0c8d93..0f178ec7953 100644 --- a/tests/subsys/fs/multi-fs/src/test_fat.h +++ b/tests/subsys/fs/multi-fs/src/test_fat.h @@ -6,7 +6,7 @@ #include #include -#include +#include #define FATFS_MNTP "/RAM:" #define TEST_FILE FATFS_MNTP"/testfile.txt" diff --git a/tests/subsys/fs/multi-fs/src/test_fs_shell.h b/tests/subsys/fs/multi-fs/src/test_fs_shell.h index af448bc8100..612d78d770e 100644 --- a/tests/subsys/fs/multi-fs/src/test_fs_shell.h +++ b/tests/subsys/fs/multi-fs/src/test_fs_shell.h @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -#include +#include void test_fs_help(void); void test_fs_fat_mount(void); diff --git a/tests/subsys/fs/multi-fs/src/test_nffs.h b/tests/subsys/fs/multi-fs/src/test_nffs.h index b6fd7fd6f28..6fd64a051bd 100644 --- a/tests/subsys/fs/multi-fs/src/test_nffs.h +++ b/tests/subsys/fs/multi-fs/src/test_nffs.h @@ -6,7 +6,7 @@ #include #include -#include +#include #include void test_nffs_mount(void); diff --git a/tests/subsys/fs/multi-fs/src/test_nffs_dir.c b/tests/subsys/fs/multi-fs/src/test_nffs_dir.c index 1ea518d76c7..7c6c0a90b55 100644 --- a/tests/subsys/fs/multi-fs/src/test_nffs_dir.c +++ b/tests/subsys/fs/multi-fs/src/test_nffs_dir.c @@ -6,7 +6,7 @@ #include #include -#include +#include #include #include #include "nffs_test_utils.h" diff --git a/tests/subsys/fs/multi-fs/src/test_nffs_file.c b/tests/subsys/fs/multi-fs/src/test_nffs_file.c index bd924730b45..f81eaa2272e 100644 --- a/tests/subsys/fs/multi-fs/src/test_nffs_file.c +++ b/tests/subsys/fs/multi-fs/src/test_nffs_file.c @@ -6,7 +6,7 @@ #include #include -#include +#include #include #include #include "nffs_test_utils.h" diff --git a/tests/subsys/fs/multi-fs/src/test_nffs_mount.c b/tests/subsys/fs/multi-fs/src/test_nffs_mount.c index 4f300b3a3da..69f48553d73 100644 --- a/tests/subsys/fs/multi-fs/src/test_nffs_mount.c +++ b/tests/subsys/fs/multi-fs/src/test_nffs_mount.c @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include #include #include "nffs_test_utils.h" diff --git a/tests/subsys/fs/nffs_fs_api/common/nffs_test_system_01.c b/tests/subsys/fs/nffs_fs_api/common/nffs_test_system_01.c index 2d150ce605c..9c44c1a70da 100644 --- a/tests/subsys/fs/nffs_fs_api/common/nffs_test_system_01.c +++ b/tests/subsys/fs/nffs_fs_api/common/nffs_test_system_01.c @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include "nffs_test_utils.h" const struct nffs_test_file_desc *nffs_test_system_01 = diff --git a/tests/subsys/fs/nffs_fs_api/common/nffs_test_utils.c b/tests/subsys/fs/nffs_fs_api/common/nffs_test_utils.c index 8e4b6c863db..e599b5a65a6 100644 --- a/tests/subsys/fs/nffs_fs_api/common/nffs_test_utils.c +++ b/tests/subsys/fs/nffs_fs_api/common/nffs_test_utils.c @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/tests/subsys/fs/nffs_fs_api/common/test_append.c b/tests/subsys/fs/nffs_fs_api/common/test_append.c index e4755024e2e..8cf82e4b834 100644 --- a/tests/subsys/fs/nffs_fs_api/common/test_append.c +++ b/tests/subsys/fs/nffs_fs_api/common/test_append.c @@ -23,7 +23,7 @@ #include #include -#include +#include #include "nffs_test_utils.h" #include diff --git a/tests/subsys/fs/nffs_fs_api/common/test_cache_large_file.c b/tests/subsys/fs/nffs_fs_api/common/test_cache_large_file.c index 485ab6a4306..0d3990e2740 100644 --- a/tests/subsys/fs/nffs_fs_api/common/test_cache_large_file.c +++ b/tests/subsys/fs/nffs_fs_api/common/test_cache_large_file.c @@ -23,7 +23,7 @@ #include #include -#include +#include #include "nffs_test_utils.h" #include diff --git a/tests/subsys/fs/nffs_fs_api/common/test_corrupt_block.c b/tests/subsys/fs/nffs_fs_api/common/test_corrupt_block.c index dc46b4e6ef1..559977a397e 100644 --- a/tests/subsys/fs/nffs_fs_api/common/test_corrupt_block.c +++ b/tests/subsys/fs/nffs_fs_api/common/test_corrupt_block.c @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include "nffs_test_utils.h" #include #include diff --git a/tests/subsys/fs/nffs_fs_api/common/test_corrupt_scratch.c b/tests/subsys/fs/nffs_fs_api/common/test_corrupt_scratch.c index 783d6d6bc14..0574454cad9 100644 --- a/tests/subsys/fs/nffs_fs_api/common/test_corrupt_scratch.c +++ b/tests/subsys/fs/nffs_fs_api/common/test_corrupt_scratch.c @@ -23,7 +23,7 @@ #include #include -#include +#include #include "nffs_test_utils.h" #include #include diff --git a/tests/subsys/fs/nffs_fs_api/common/test_gc.c b/tests/subsys/fs/nffs_fs_api/common/test_gc.c index 2f292b57d16..3bd959cf410 100644 --- a/tests/subsys/fs/nffs_fs_api/common/test_gc.c +++ b/tests/subsys/fs/nffs_fs_api/common/test_gc.c @@ -23,7 +23,7 @@ #include #include -#include +#include #include "nffs_test_utils.h" #include #include diff --git a/tests/subsys/fs/nffs_fs_api/common/test_gc_on_oom.c b/tests/subsys/fs/nffs_fs_api/common/test_gc_on_oom.c index dcd14b77b47..e7022f5c36a 100644 --- a/tests/subsys/fs/nffs_fs_api/common/test_gc_on_oom.c +++ b/tests/subsys/fs/nffs_fs_api/common/test_gc_on_oom.c @@ -23,7 +23,7 @@ #include #include -#include +#include #include "nffs_test_utils.h" #include #include diff --git a/tests/subsys/fs/nffs_fs_api/common/test_incomplete_block.c b/tests/subsys/fs/nffs_fs_api/common/test_incomplete_block.c index fb827d54c23..d882a74f5ab 100644 --- a/tests/subsys/fs/nffs_fs_api/common/test_incomplete_block.c +++ b/tests/subsys/fs/nffs_fs_api/common/test_incomplete_block.c @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include "nffs_test_utils.h" #include #include diff --git a/tests/subsys/fs/nffs_fs_api/common/test_large_system.c b/tests/subsys/fs/nffs_fs_api/common/test_large_system.c index f625b0d7562..e08d7e0cded 100644 --- a/tests/subsys/fs/nffs_fs_api/common/test_large_system.c +++ b/tests/subsys/fs/nffs_fs_api/common/test_large_system.c @@ -23,7 +23,7 @@ #include #include -#include +#include #include "nffs_test_utils.h" #include #include diff --git a/tests/subsys/fs/nffs_fs_api/common/test_large_unlink.c b/tests/subsys/fs/nffs_fs_api/common/test_large_unlink.c index 3860bc8307c..fdad0c479c5 100644 --- a/tests/subsys/fs/nffs_fs_api/common/test_large_unlink.c +++ b/tests/subsys/fs/nffs_fs_api/common/test_large_unlink.c @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include "nffs_test_utils.h" #include #include diff --git a/tests/subsys/fs/nffs_fs_api/common/test_large_write.c b/tests/subsys/fs/nffs_fs_api/common/test_large_write.c index 9840a0c75cc..47934e34834 100644 --- a/tests/subsys/fs/nffs_fs_api/common/test_large_write.c +++ b/tests/subsys/fs/nffs_fs_api/common/test_large_write.c @@ -23,7 +23,7 @@ #include #include -#include +#include #include "nffs_test_utils.h" #include diff --git a/tests/subsys/fs/nffs_fs_api/common/test_long_filename.c b/tests/subsys/fs/nffs_fs_api/common/test_long_filename.c index db61257e370..777ca232652 100644 --- a/tests/subsys/fs/nffs_fs_api/common/test_long_filename.c +++ b/tests/subsys/fs/nffs_fs_api/common/test_long_filename.c @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include "nffs_test_utils.h" #include #include diff --git a/tests/subsys/fs/nffs_fs_api/common/test_lost_found.c b/tests/subsys/fs/nffs_fs_api/common/test_lost_found.c index e6eb64d8540..be1891efcb3 100644 --- a/tests/subsys/fs/nffs_fs_api/common/test_lost_found.c +++ b/tests/subsys/fs/nffs_fs_api/common/test_lost_found.c @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include "nffs_test_utils.h" #include #include diff --git a/tests/subsys/fs/nffs_fs_api/common/test_many_children.c b/tests/subsys/fs/nffs_fs_api/common/test_many_children.c index 58a45bfc381..51289b0a9d0 100644 --- a/tests/subsys/fs/nffs_fs_api/common/test_many_children.c +++ b/tests/subsys/fs/nffs_fs_api/common/test_many_children.c @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include "nffs_test_utils.h" #include #include diff --git a/tests/subsys/fs/nffs_fs_api/common/test_mkdir.c b/tests/subsys/fs/nffs_fs_api/common/test_mkdir.c index 94bd42ff66b..dbb5d635aa0 100644 --- a/tests/subsys/fs/nffs_fs_api/common/test_mkdir.c +++ b/tests/subsys/fs/nffs_fs_api/common/test_mkdir.c @@ -23,7 +23,7 @@ #include #include -#include +#include #include #include "nffs_test_utils.h" #include diff --git a/tests/subsys/fs/nffs_fs_api/common/test_mount.c b/tests/subsys/fs/nffs_fs_api/common/test_mount.c index 137e537e3c2..7288c97531b 100644 --- a/tests/subsys/fs/nffs_fs_api/common/test_mount.c +++ b/tests/subsys/fs/nffs_fs_api/common/test_mount.c @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include #include #include "nffs_test_utils.h" diff --git a/tests/subsys/fs/nffs_fs_api/common/test_nffs.h b/tests/subsys/fs/nffs_fs_api/common/test_nffs.h index 8eb9679a435..bb392f7e3f6 100644 --- a/tests/subsys/fs/nffs_fs_api/common/test_nffs.h +++ b/tests/subsys/fs/nffs_fs_api/common/test_nffs.h @@ -6,7 +6,7 @@ #include #include -#include +#include void test_fs_mount(void); void test_mkdir(void); diff --git a/tests/subsys/fs/nffs_fs_api/common/test_open.c b/tests/subsys/fs/nffs_fs_api/common/test_open.c index ebd2e2a5049..85d857ad15c 100644 --- a/tests/subsys/fs/nffs_fs_api/common/test_open.c +++ b/tests/subsys/fs/nffs_fs_api/common/test_open.c @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include "nffs_test_utils.h" #include #include diff --git a/tests/subsys/fs/nffs_fs_api/common/test_overwrite_many.c b/tests/subsys/fs/nffs_fs_api/common/test_overwrite_many.c index 51b4c47e279..f37b4c7bd2c 100644 --- a/tests/subsys/fs/nffs_fs_api/common/test_overwrite_many.c +++ b/tests/subsys/fs/nffs_fs_api/common/test_overwrite_many.c @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include "nffs_test_utils.h" #include #include diff --git a/tests/subsys/fs/nffs_fs_api/common/test_overwrite_one.c b/tests/subsys/fs/nffs_fs_api/common/test_overwrite_one.c index dc7b41010cd..64bbfca3c0a 100644 --- a/tests/subsys/fs/nffs_fs_api/common/test_overwrite_one.c +++ b/tests/subsys/fs/nffs_fs_api/common/test_overwrite_one.c @@ -23,7 +23,7 @@ #include #include -#include +#include #include "nffs_test_utils.h" #include diff --git a/tests/subsys/fs/nffs_fs_api/common/test_overwrite_three.c b/tests/subsys/fs/nffs_fs_api/common/test_overwrite_three.c index 4de8a304d83..4759907d550 100644 --- a/tests/subsys/fs/nffs_fs_api/common/test_overwrite_three.c +++ b/tests/subsys/fs/nffs_fs_api/common/test_overwrite_three.c @@ -23,7 +23,7 @@ #include #include -#include +#include #include "nffs_test_utils.h" #include diff --git a/tests/subsys/fs/nffs_fs_api/common/test_overwrite_two.c b/tests/subsys/fs/nffs_fs_api/common/test_overwrite_two.c index c98bd4abbbf..6065e5fc34a 100644 --- a/tests/subsys/fs/nffs_fs_api/common/test_overwrite_two.c +++ b/tests/subsys/fs/nffs_fs_api/common/test_overwrite_two.c @@ -23,7 +23,7 @@ #include #include -#include +#include #include "nffs_test_utils.h" #include diff --git a/tests/subsys/fs/nffs_fs_api/common/test_performance.c b/tests/subsys/fs/nffs_fs_api/common/test_performance.c index f15948aa313..75c97fd9b1c 100644 --- a/tests/subsys/fs/nffs_fs_api/common/test_performance.c +++ b/tests/subsys/fs/nffs_fs_api/common/test_performance.c @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include "nffs_test_utils.h" #include #include diff --git a/tests/subsys/fs/nffs_fs_api/common/test_read.c b/tests/subsys/fs/nffs_fs_api/common/test_read.c index 80c0e8a3f9e..e5adf6869fb 100644 --- a/tests/subsys/fs/nffs_fs_api/common/test_read.c +++ b/tests/subsys/fs/nffs_fs_api/common/test_read.c @@ -23,7 +23,7 @@ #include #include -#include +#include #include "nffs_test_utils.h" #include diff --git a/tests/subsys/fs/nffs_fs_api/common/test_readdir.c b/tests/subsys/fs/nffs_fs_api/common/test_readdir.c index d3d8cb0e5bf..7353c542abd 100644 --- a/tests/subsys/fs/nffs_fs_api/common/test_readdir.c +++ b/tests/subsys/fs/nffs_fs_api/common/test_readdir.c @@ -23,7 +23,7 @@ #include #include -#include +#include #include "nffs_test_utils.h" #include diff --git a/tests/subsys/fs/nffs_fs_api/common/test_rename.c b/tests/subsys/fs/nffs_fs_api/common/test_rename.c index cef597a049d..6c3bcaf40b3 100644 --- a/tests/subsys/fs/nffs_fs_api/common/test_rename.c +++ b/tests/subsys/fs/nffs_fs_api/common/test_rename.c @@ -23,7 +23,7 @@ #include #include -#include +#include #include "nffs_test_utils.h" #include diff --git a/tests/subsys/fs/nffs_fs_api/common/test_split_file.c b/tests/subsys/fs/nffs_fs_api/common/test_split_file.c index 352c5400d0e..646f5ace83f 100644 --- a/tests/subsys/fs/nffs_fs_api/common/test_split_file.c +++ b/tests/subsys/fs/nffs_fs_api/common/test_split_file.c @@ -23,7 +23,7 @@ #include #include -#include +#include #include "nffs_test_utils.h" #include diff --git a/tests/subsys/fs/nffs_fs_api/common/test_unlink.c b/tests/subsys/fs/nffs_fs_api/common/test_unlink.c index b7267d4fd35..54d2fcf599c 100644 --- a/tests/subsys/fs/nffs_fs_api/common/test_unlink.c +++ b/tests/subsys/fs/nffs_fs_api/common/test_unlink.c @@ -23,7 +23,7 @@ #include #include -#include +#include #include "nffs_test_utils.h" #include diff --git a/tests/subsys/fs/nffs_fs_api/common/test_wear_level.c b/tests/subsys/fs/nffs_fs_api/common/test_wear_level.c index 8bea7ad2094..8c74d3a9c47 100644 --- a/tests/subsys/fs/nffs_fs_api/common/test_wear_level.c +++ b/tests/subsys/fs/nffs_fs_api/common/test_wear_level.c @@ -23,7 +23,7 @@ #include #include -#include +#include #include "nffs_test_utils.h" #include diff --git a/tests/subsys/settings/nffs/src/settings_setup_nffs.c b/tests/subsys/settings/nffs/src/settings_setup_nffs.c index 725929bc7fa..05b305f5dad 100644 --- a/tests/subsys/settings/nffs/src/settings_setup_nffs.c +++ b/tests/subsys/settings/nffs/src/settings_setup_nffs.c @@ -7,7 +7,7 @@ #include "settings_test.h" #include -#include +#include #include /* NFFS work area strcut */ diff --git a/tests/subsys/settings/nffs/src/settings_test.h b/tests/subsys/settings/nffs/src/settings_test.h index dcb09bad78e..7f4ba149944 100644 --- a/tests/subsys/settings/nffs/src/settings_test.h +++ b/tests/subsys/settings/nffs/src/settings_test.h @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include "settings/settings.h" diff --git a/tests/subsys/settings/nffs/src/settings_test_empty_file.c b/tests/subsys/settings/nffs/src/settings_test_empty_file.c index ad7d9d07eaf..ed8ac211877 100644 --- a/tests/subsys/settings/nffs/src/settings_test_empty_file.c +++ b/tests/subsys/settings/nffs/src/settings_test_empty_file.c @@ -7,7 +7,7 @@ #include "settings_test.h" #include "settings/settings_file.h" -#include +#include void test_config_empty_file(void) {