Embedded TCP/IP stack: fnet_fs.h Source File

FNET

fnet_fs.h
1 /**************************************************************************
2 *
3 * Copyright 2011-2017 by Andrey Butok. FNET Community.
4 * Copyright 2008-2010 by Andrey Butok. Freescale Semiconductor, Inc.
5 *
6 ***************************************************************************
7 *
8 * Licensed under the Apache License, Version 2.0 (the "License"); you may
9 * not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
16 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 *
20 ***************************************************************************
21 *
22 * FNET File System API.
23 *
24 ***************************************************************************/
25 
26 #ifndef _FNET_FS_H_
27 
28 #define _FNET_FS_H_
29 
30 #if FNET_CFG_FS || defined(__DOXYGEN__)
31 
139 /**************************************************************************/
143 typedef void *fnet_fs_dir_t;
144 
145 /**************************************************************************/
149 typedef void *fnet_fs_file_t;
150 
151 /**************************************************************************/
155 #define FNET_FS_SPLITTER '/'
156 
157 /**************************************************************************/
161 #define FNET_FS_EOF (-1)
162 
163 /**************************************************************************/
169 typedef enum
170 {
174 }
176 
177 /**************************************************************************/
181 typedef enum
182 {
187 
188 
189 /**************************************************************************/
196 {
197  fnet_uint32_t d_ino;
204 };
205 
206 #if defined(__cplusplus)
207 extern "C" {
208 #endif
209 
210 /***************************************************************************/
228 
229 /***************************************************************************/
240 void fnet_fs_release(void);
241 
242 /***************************************************************************/
273 fnet_return_t fnet_fs_mount( fnet_char_t *fs_name, const fnet_char_t *mount_name, const void *arg );
274 
275 /***************************************************************************/
294 fnet_return_t fnet_fs_unmount( const fnet_char_t *mount_name );
295 
296 /***************************************************************************/
314 fnet_fs_dir_t fnet_fs_opendir( const fnet_char_t *dirname);
315 
316 /***************************************************************************/
334 
335 /***************************************************************************/
359 
360 /***************************************************************************/
376 void fnet_fs_rewinddir( fnet_fs_dir_t dir );
377 
378 /***************************************************************************/
425 fnet_fs_file_t fnet_fs_fopen(const fnet_char_t *filename, const fnet_char_t *mode);
426 
427 /***************************************************************************/
478 fnet_fs_file_t fnet_fs_fopen_re(const fnet_char_t *filename, const fnet_char_t *mode, fnet_fs_dir_t dir);
479 
480 /***************************************************************************/
499 
500 /***************************************************************************/
523 fnet_size_t fnet_fs_fread(void *buf, fnet_size_t size, fnet_fs_file_t file);
524 
525 /***************************************************************************/
539 void fnet_fs_rewind( fnet_fs_file_t file );
540 
541 /***************************************************************************/
565 
566 /***************************************************************************/
586 fnet_int32_t fnet_fs_fgetc(fnet_fs_file_t file);
587 
588 /***************************************************************************/
614 fnet_return_t fnet_fs_fseek (fnet_fs_file_t file, fnet_int32_t offset, fnet_fs_seek_origin_t origin);
615 
616 /***************************************************************************/
635 fnet_int32_t fnet_fs_ftell (fnet_fs_file_t file);
636 
637 /***************************************************************************/
658 
659 #if defined(__cplusplus)
660 }
661 #endif
662 
665 #endif /* FNET_CFG_FS */
666 
667 #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.
This structure is used by the fnet_fs_finfo() and the fnet_fs_readdir() function to get information a...
Definition: fnet_fs.h:195
void fnet_fs_release(void)
Releases the FNET File System Interface.
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:202
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:183
fnet_return_t fnet_fs_finfo(fnet_fs_file_t file, struct fnet_fs_dirent *dirent)
Gets a file information.
void * fnet_fs_dir_t
Directory descriptor. This is the abstract key for accessing a directory.
Definition: fnet_fs.h:143
fnet_return_t
General return codes, used by most of API functions.
Definition: fnet_stdlib.h:90
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:56
void fnet_fs_rewinddir(fnet_fs_dir_t dir)
Resets a directory position.
const fnet_char_t * d_name
Name of the entry (null-terminated string).
Definition: fnet_fs.h:200
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:172
fnet_uint32_t d_ino
Entry serial number.
Definition: fnet_fs.h:197
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:81
fnet_fs_d_type_t
Directory entry type.
Definition: fnet_fs.h:181
fnet_fs_d_type_t d_type
Type of the entry defined by the fnet_fs_d_type_t.
Definition: fnet_fs.h:198
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:185
fnet_fs_seek_origin_t
Origin position. Used by fnet_fs_fseek() function.
Definition: fnet_fs.h:169
fnet_return_t fnet_fs_readdir(fnet_fs_dir_t dir, struct fnet_fs_dirent *dirent)
Reads a directory entry.
Origin is the start of the file.
Definition: fnet_fs.h:171
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:76
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:173
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:149
A regular file.
Definition: fnet_fs.h:184

© 2005-2018 by Andrey Butok. http://fnet.sourceforge.net