Zephyr API Documentation 4.0.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
fs_interface.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2016 Intel Corporation.
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#ifndef ZEPHYR_INCLUDE_FS_FS_INTERFACE_H_
8#define ZEPHYR_INCLUDE_FS_FS_INTERFACE_H_
9
10#include <stdint.h>
11
12#ifdef __cplusplus
13extern "C" {
14#endif
15
16#if defined(CONFIG_FILE_SYSTEM_MAX_FILE_NAME) && (CONFIG_FILE_SYSTEM_MAX_FILE_NAME - 0) > 0
17
18/* No in-tree file system supports name longer than 255 characters */
19#if (CONFIG_FILE_SYSTEM_LITTLEFS || CONFIG_FAT_FILESYSTEM_ELM || \
20 CONFIG_FILE_SYSTEM_EXT2) && (CONFIG_FILE_SYSTEM_MAX_FILE_NAME > 255)
21#error "Max allowed CONFIG_FILE_SYSTEM_MAX_FILE_NAME is 255 characters, when any in-tree FS enabled"
22#endif
23
24/* Enabled FAT driver, without LFN, restricts name length to 12 characters */
25#if defined(CONFIG_FAT_FILESYSTEM_ELM) && !(CONFIG_FS_FATFS_LFN) && \
26 (CONFIG_FILE_SYSTEM_MAX_FILE_NAME > 12)
27#error "CONFIG_FILE_SYSTEM_MAX_FILE_NAME can not be > 12 if FAT is enabled without LFN"
28#endif
29
30#define MAX_FILE_NAME CONFIG_FILE_SYSTEM_MAX_FILE_NAME
31
32#else
33/* Select from enabled file systems */
34
35#if defined(CONFIG_FAT_FILESYSTEM_ELM)
36
37#if defined(CONFIG_FS_FATFS_LFN)
38#define MAX_FILE_NAME CONFIG_FS_FATFS_MAX_LFN
39#else /* CONFIG_FS_FATFS_LFN */
40#define MAX_FILE_NAME 12 /* Uses 8.3 SFN */
41#endif /* CONFIG_FS_FATFS_LFN */
42
43#endif
44
45#if !defined(MAX_FILE_NAME) && defined(CONFIG_FILE_SYSTEM_EXT2)
46#define MAX_FILE_NAME 255
47#endif
48
49#if !defined(MAX_FILE_NAME) && defined(CONFIG_FILE_SYSTEM_LITTLEFS)
50#define MAX_FILE_NAME 255
51#endif
52
53#if !defined(MAX_FILE_NAME) /* filesystem selection */
54/* Use standard 8.3 when no filesystem is explicitly selected */
55#define MAX_FILE_NAME 12
56#endif /* filesystem selection */
57
58#endif /* CONFIG_FILE_SYSTEM_MAX_FILE_NAME */
59
60
61/* Type for fs_open flags */
63
64struct fs_mount_t;
65
76struct fs_file_t {
78 void *filep;
80 const struct fs_mount_t *mp;
83};
84
90struct fs_dir_t {
92 void *dirp;
94 const struct fs_mount_t *mp;
95};
96
101#ifdef __cplusplus
102}
103#endif
104
105#endif /* ZEPHYR_INCLUDE_FS_FS_INTERFACE_H_ */
uint8_t fs_mode_t
Definition fs_interface.h:62
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
Directory object representing an open directory.
Definition fs_interface.h:90
const struct fs_mount_t * mp
Pointer to mount point structure.
Definition fs_interface.h:94
void * dirp
Pointer to directory object structure.
Definition fs_interface.h:92
File object representing an open file.
Definition fs_interface.h:76
fs_mode_t flags
Open/create flags.
Definition fs_interface.h:82
void * filep
Pointer to file object structure.
Definition fs_interface.h:78
const struct fs_mount_t * mp
Pointer to mount point structure.
Definition fs_interface.h:80
File system mount info structure.
Definition fs.h:91