70 likes | 182 Views
Clib File System. CLIB File System. BSP hook up Initialization—filesystem_init() Supported functions Limitations. BSP hook up. In bsp.h, #define BSP_INCLUDE_FILESYSTEM_FOR_CLIBRARY 1 Call filesystem_init() after TCP/IP stack is up and the time is setup. Initialization—filesystem_init().
E N D
CLIB File System • BSP hook up • Initialization—filesystem_init() • Supported functions • Limitations
BSP hook up • In bsp.h, #define BSP_INCLUDE_FILESYSTEM_FOR_CLIBRARY 1 • Call filesystem_init() after TCP/IP stack is up and the time is setup
Initialization—filesystem_init() • In file bsp\platforms\yourboard\startfilesystem.c struct fs_config_t { char volume_type; char volume_name[NAFS_VOLUME_NAME_SIZE]; int user_permissions; unsigned int group_id; unsigned char media_type; NAFS_MEDIA_CB *media_cb; TX_THREAD *media_thread; TX_QUEUE *media_queue; NAFS_BUFFER_POOL *buffer_pool; void *media_stack_addr; void *media_queue_addr; NAFS_IO_INTF *io_intf; NAFS_VOLUME_CB *volume_cb; int volume_size; char *volume; int flash_start_sector; int flash_end_sector; int flash_option; int flash_compacting_threshold; };
Supported functions • mkdir() • rename() • remove() • open() • close() • read() • write() • fopen() • fclose() • fread() • fwrite() • fseek()
Limitations • The file IO functions are implemented as binary and block only • In function mkdir(dirname, mode) implementation, the mode is ignored since creating directory in NETOS6's native filesystem requires group id and group access mode. group id and group access mode is hardcoded in the filesystem configuration and can be changed in \bsp\platforms\your_board\startfilesystem.c
Limitations • In function open(filename, mode), the mode is implemented to be consistent with fopen(filename, fmode) as the following table: r w a r+ w+ a+ File must exist before open * * Old file truncated to zero length * * File can be read * * * * File can be written * * * * * File can be written only at end * *