§ IO and File System
分层结构
-
Stardand I/O (stdio, fioLib) is based on Basic I/O
-
Stardand I/O routines use file pointer
-
Basic I/O routines use file descriptor
IO System Interface
-
分层结构:Application ---> I/O system ---> xxDriver ---> Device
-
VxWorks I/O system provides a simple device-independent and portable interface to these device drivers.
-
A device driver must be installed in the I/O system.
-
-> devs
-
File Descriptors
-
-> iosFdShow
Character I/O
Reserved file descriptors
-
STD_IN, STD_OUT, STD_ERR
-
相关的操作:ioGlobalStdSet, ioGlobalStdGet, ioTaskStdSet, ioTaskStdGet
Basic I/O Routines
Open, close, create, remove, read, write, ioctl, select
Standard I/O
-
VxWorks provides two libraries for higher level I/O functionality:
-
ansiStdio: Buffered I/O package. “stdio.h”. Not reentrant.
-
fioLib: Formatted, non-buffered I/O. “FioLib.h”. Reentrant.
Block I/O
-
调用关系:File system routines ---> Block driver
-
Block driver的功能: 1) Reads/writes disk sectors. 2) Formats disk (marks sector boundaries).
-
File system routines manage files on a disk.
-
VxWorks提供了一些Block Drivers 和file systems
-
使用:Create block device ---> Initialize file system ---> use read( ), write( ), etc. to manipulate files on the file system