Embedded TCP/IP stack  4.7.0
fnet_fs.h
1 /**************************************************************************
2 *
3 * Copyright 2008-2018 by Andrey Butok. FNET Community.
4 *
5 ***************************************************************************
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License"); you may
8 * not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 *
19 ***************************************************************************
20 *
21 * FNET File System API.
22 *
23 ***************************************************************************/
24 
25 #ifndef _FNET_FS_H_
26 
27 #define _FNET_FS_H_
28 
29 #if FNET_CFG_FS || defined(__DOXYGEN__)
30 
138 /**************************************************************************/
142 typedef void *fnet_fs_dir_t;
143 
144 /**************************************************************************/
148 typedef void *fnet_fs_file_t;
149 
150 /**************************************************************************/
154 #define FNET_FS_SPLITTER '/'
155 
156 /**************************************************************************/
160 #define FNET_FS_EOF (-1)
161 
162 /**************************************************************************/
168 typedef enum
169 {
173 }
175 
176 /**************************************************************************/
180 typedef enum
181 {
186 
187 
188 /**************************************************************************/
194 typedef struct
195 {
196  fnet_uint32_t d_ino;
204 
205 #if defined(__cplusplus)
206 extern "C" {
207 #endif
208 
209 /***************************************************************************/
227 
228 /***************************************************************************/
239 void fnet_fs_release(void);
240 
241 /***************************************************************************/
272 fnet_return_t fnet_fs_mount( fnet_char_t *fs_name, const fnet_char_t *mount_name, const void *arg );
273 
274 /***************************************************************************/
293 fnet_return_t fnet_fs_unmount( const fnet_char_t *mount_name );
294 
295 /***************************************************************************/
313 fnet_fs_dir_t fnet_fs_opendir( const fnet_char_t *dirname);
314 
315 /***************************************************************************/
333 
334 /***************************************************************************/
358 
359 /***************************************************************************/
375 void fnet_fs_rewinddir( fnet_fs_dir_t dir );
376 
377 /***************************************************************************/
424 fnet_fs_file_t fnet_fs_fopen(const fnet_char_t *filename, const fnet_char_t *mode);
425 
426 /***************************************************************************/
477 fnet_fs_file_t fnet_fs_fopen_re(const fnet_char_t *filename, const fnet_char_t *mode, fnet_fs_dir_t dir);
478 
479 /***************************************************************************/
498 
499 /***************************************************************************/
522 fnet_size_t fnet_fs_fread(void *buf, fnet_size_t size, fnet_fs_file_t file);
523 
524 /***************************************************************************/
538 void fnet_fs_rewind( fnet_fs_file_t file );
539 
540 /***************************************************************************/
564 
565 /***************************************************************************/
585 fnet_int32_t fnet_fs_fgetc(fnet_fs_file_t file);
586 
587 /***************************************************************************/
613 fnet_return_t fnet_fs_fseek (fnet_fs_file_t file, fnet_int32_t offset, fnet_fs_seek_origin_t origin);
614 
615 /***************************************************************************/
634 fnet_int32_t fnet_fs_ftell (fnet_fs_file_t file);
635 
636 /***************************************************************************/
657 
658 #if defined(__cplusplus)
659 }
660 #endif
661 
664 #endif /* FNET_CFG_FS */
665 
666 #endif /* _FNET_FS_H_ */
fnet_int32_t fnet_fs_ftell(fnet_fs_file_t file)
Gets the current position in a file.
fnet_fs_file_t fnet_fs_fopen(const fnet_char_t *filename, const fnet_char_t *mode)
Opens a file descriptor.
void fnet_fs_rewind(fnet_fs_file_t file)
Resets a file position.
void fnet_fs_release(void)
Releases the FNET File System Interface.
fnet_uint32_t d_ino
Entry serial number.
Definition: fnet_fs.h:196
fnet_return_t fnet_fs_unmount(const fnet_char_t *mount_name)
Unmounts a file system.
fnet_return_t fnet_fs_closedir(fnet_fs_dir_t dir)
Closes a directory descriptor.
Unspecified.
Definition: fnet_fs.h:182
void * fnet_fs_dir_t
Directory descriptor. This is the abstract key for accessing a directory.
Definition: fnet_fs.h:142
fnet_return_t
General return codes, used by most of API functions.
Definition: fnet_stdlib.h:89
fnet_return_t fnet_fs_mount(fnet_char_t *fs_name, const fnet_char_t *mount_name, const void *arg)
Mounts a file system.
unsigned long fnet_size_t
Unsigned integer type representing the size in bytes.
Definition: fnet_stdlib.h:55
void fnet_fs_rewinddir(fnet_fs_dir_t dir)
Resets a directory position.
fnet_return_t fnet_fs_fseek(fnet_fs_file_t file, fnet_int32_t offset, fnet_fs_seek_origin_t origin)
Changes the file-position indicator for the specified file.
Origin is the current position.
Definition: fnet_fs.h:171
fnet_fs_d_type_t d_type
Type of the entry defined by the fnet_fs_d_type_t.
Definition: fnet_fs.h:197
fnet_return_t fnet_fs_readdir(fnet_fs_dir_t dir, fnet_fs_dirent_t *dirent)
Reads a directory entry.
const fnet_char_t * d_name
Name of the entry (null-terminated string).
Definition: fnet_fs.h:199
fnet_return_t fnet_fs_init(void)
Initializes the FNET File System Interface.
fnet_return_t fnet_fs_fclose(fnet_fs_file_t file)
Closes a file descriptor.
fnet_bool_t
Boolean type.
Definition: fnet_stdlib.h:80
fnet_size_t d_size
Size of the file entry. If the entry is a directory this field is set to 0.
Definition: fnet_fs.h:201
fnet_fs_d_type_t
Directory entry type.
Definition: fnet_fs.h:180
fnet_return_t fnet_fs_finfo(fnet_fs_file_t file, fnet_fs_dirent_t *dirent)
Gets a file information.
fnet_bool_t fnet_fs_feof(fnet_fs_file_t file)
Checks the End-of-File indicator.
fnet_size_t fnet_fs_fread(void *buf, fnet_size_t size, fnet_fs_file_t file)
Reads data from a file.
A directory.
Definition: fnet_fs.h:184
fnet_fs_seek_origin_t
Origin position. Used by fnet_fs_fseek() function.
Definition: fnet_fs.h:168
Origin is the start of the file.
Definition: fnet_fs.h:170
This structure is used by the fnet_fs_finfo() and the fnet_fs_readdir() function to get information a...
Definition: fnet_fs.h:194
fnet_int32_t fnet_fs_fgetc(fnet_fs_file_t file)
Gets a character from a file.
char fnet_char_t
Type representing the charecter.
Definition: fnet_stdlib.h:75
fnet_fs_file_t fnet_fs_fopen_re(const fnet_char_t *filename, const fnet_char_t *mode, fnet_fs_dir_t dir)
Opens a file relatively in an opened directory.
Origin is the end of the file.
Definition: fnet_fs.h:172
fnet_fs_dir_t fnet_fs_opendir(const fnet_char_t *dirname)
Opens a directory descriptor.
void * fnet_fs_file_t
File descriptor. This is the abstract key for accessing a file.
Definition: fnet_fs.h:148
A regular file.
Definition: fnet_fs.h:183

© 2005-2020 by Andrej Butok. http://fnet.sourceforge.net