2016-07-23 08:48:59 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2016 Intel Corporation.
|
|
|
|
*
|
2017-01-19 09:01:01 +08:00
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
2016-07-23 08:48:59 +08:00
|
|
|
*/
|
|
|
|
|
2018-09-15 01:43:44 +08:00
|
|
|
#ifndef ZEPHYR_INCLUDE_FS_FS_INTERFACE_H_
|
|
|
|
#define ZEPHYR_INCLUDE_FS_FS_INTERFACE_H_
|
2016-07-23 08:48:59 +08:00
|
|
|
|
2020-06-18 17:16:35 +08:00
|
|
|
#include <stdint.h>
|
|
|
|
|
2016-07-23 08:48:59 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2020-08-14 23:41:01 +08:00
|
|
|
#if (CONFIG_FILE_SYSTEM_MAX_FILE_NAME - 0) > 0
|
|
|
|
#define MAX_FILE_NAME CONFIG_FILE_SYSTEM_MAX_FILE_NAME
|
|
|
|
#else /* CONFIG_FILE_SYSTEM_MAX_FILE_NAME */
|
|
|
|
/* Select from enabled file systems */
|
2020-01-09 18:35:13 +08:00
|
|
|
#if defined(CONFIG_FILE_SYSTEM_LITTLEFS)
|
2018-02-22 16:02:57 +08:00
|
|
|
#define MAX_FILE_NAME 256
|
2020-05-30 19:57:17 +08:00
|
|
|
#elif defined(CONFIG_FAT_FILESYSTEM_ELM)
|
|
|
|
#if defined(CONFIG_FS_FATFS_LFN)
|
|
|
|
#define MAX_FILE_NAME CONFIG_FS_FATFS_MAX_LFN
|
|
|
|
#else /* CONFIG_FS_FATFS_LFN */
|
2018-02-22 16:02:57 +08:00
|
|
|
#define MAX_FILE_NAME 12 /* Uses 8.3 SFN */
|
2020-05-30 19:57:17 +08:00
|
|
|
#endif /* CONFIG_FS_FATFS_LFN */
|
|
|
|
#else /* filesystem selection */
|
|
|
|
/* Use standard 8.3 when no filesystem is explicitly selected */
|
|
|
|
#define MAX_FILE_NAME 12
|
|
|
|
#endif /* filesystem selection */
|
2020-08-14 23:41:01 +08:00
|
|
|
#endif /* CONFIG_FILE_SYSTEM_MAX_FILE_NAME */
|
2016-07-23 08:48:59 +08:00
|
|
|
|
2020-10-19 16:47:19 +08:00
|
|
|
|
2020-06-18 17:16:35 +08:00
|
|
|
/* Type for fs_open flags */
|
|
|
|
typedef uint8_t fs_mode_t;
|
|
|
|
|
2018-02-22 16:02:57 +08:00
|
|
|
struct fs_mount_t;
|
2016-07-23 08:48:59 +08:00
|
|
|
|
2020-10-19 16:47:19 +08:00
|
|
|
/**
|
|
|
|
* @addtogroup file_system_api
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
2018-02-22 16:02:57 +08:00
|
|
|
/**
|
|
|
|
* @brief File object representing an open file
|
2016-07-23 08:48:59 +08:00
|
|
|
*
|
2021-01-27 17:19:25 +08:00
|
|
|
* The object needs to be initialized with function fs_file_t_init().
|
|
|
|
*
|
2018-04-17 00:44:48 +08:00
|
|
|
* @param Pointer to FATFS file object structure
|
2018-02-22 16:02:57 +08:00
|
|
|
* @param mp Pointer to mount point structure
|
2016-07-23 08:48:59 +08:00
|
|
|
*/
|
2018-02-22 16:02:57 +08:00
|
|
|
struct fs_file_t {
|
2018-04-17 00:44:48 +08:00
|
|
|
void *filep;
|
2018-02-22 16:02:57 +08:00
|
|
|
const struct fs_mount_t *mp;
|
2020-06-18 17:16:35 +08:00
|
|
|
fs_mode_t flags;
|
2018-02-22 16:02:57 +08:00
|
|
|
};
|
2016-07-23 08:48:59 +08:00
|
|
|
|
2018-02-22 16:02:57 +08:00
|
|
|
/**
|
|
|
|
* @brief Directory object representing an open directory
|
|
|
|
*
|
2021-01-30 01:05:11 +08:00
|
|
|
* The object needs to be initialized with function fs_dir_t_init().
|
|
|
|
*
|
2018-04-17 00:44:48 +08:00
|
|
|
* @param dirp Pointer to directory object structure
|
2018-02-22 16:02:57 +08:00
|
|
|
* @param mp Pointer to mount point structure
|
|
|
|
*/
|
|
|
|
struct fs_dir_t {
|
2018-04-17 00:44:48 +08:00
|
|
|
void *dirp;
|
2018-02-22 16:02:57 +08:00
|
|
|
const struct fs_mount_t *mp;
|
|
|
|
};
|
2016-07-23 08:48:59 +08:00
|
|
|
|
2020-10-19 16:47:19 +08:00
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
2016-07-23 08:48:59 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2018-09-15 01:43:44 +08:00
|
|
|
#endif /* ZEPHYR_INCLUDE_FS_FS_INTERFACE_H_ */
|