Home |
The ISO 9660 File System Structure The exFAT File System Structure RTFiles-32 in Embedded Applications Structure of an RTFiles-32 Program Mounting Devices and Logical Drives File Types |
File TypesRTFiles-32 supports four different types of files: data files, directories, logical drives, and physical devices. Logical and physical drive files are also supported by Windows with the same naming conventions as under RTFiles-32. All four file types are accessed using the same file I/O functions such as RTFOpen, RTFRead, RTFWrite, etc., or their API emulation equivalents. However, some operations may not be available for all file types. For example, you cannot rename a device file or set the file date and time of a logical drive file, since such files do not have a standard directory entry. Data FilesA data file has a name, attributes, date and time of last update, an allocated file size, and a current file size. If the file is open, it also has a current file pointer and a set of flags. The file pointer marks the offset within the file's data where the next read or write operation will start. The file pointer is advanced automatically. The file's flags define some options for the file, such as whether the file is open for read-only or read/write access, etc. Directory FilesUnlike DOS, RTFiles-32 allows opening directories as files. There are only a few differences to data files. Directories must be opened in read-only mode. The name of a root directory is X:\ (with X being the drive letter) while the name of any subdirectory is the subdirectory's file name, and directory files do not have a current file size. Instead, their allocated file size is used. Directory files can be useful for scanning directories for entries not accessible through RTFFindFirst and RTFFindNext (e.g., deleted file entries, etc.). Logical Drive FilesRTFiles-32 allows a logical drive to be opened as a file. Both read-only and read/write access are supported. The file name of a drive file is \\.\X:, where X must be replaced with the desired drive letter. A drive file spans the complete logical drive, starting at the first sector of the drive (the boot sector). Access to drive files must be sector size aligned. This means you can only read or write data in complete sector size multiples. The same restriction applies to seek operations. Logical drive files bypass RTFiles-32's buffers. Read and write requests are passed directly to the device drivers. However, RTFiles-32 will ensure that the buffer contents remains consistent with the drive's contents when a device or drive file accesses data also present in the buffer cache. Logical drive file I/O is possible even on unformatted drives as long as low-level sector I/O is possible. Logical drive files can be used to high-level format a volume. Physical Device FilesPhysical device files are similar to logical drive files. However, device files span a complete hard disk, not just a single logical drive of that disk. Since device files would be identical to logical drive files on floppy disks, they are not required here. The file name of a device file is \\.\PHYSICALDRIVEx where x is a digit representing the xthe hard disk. Thus, file name \\.\PHYSICALDRIVE0 would open the first hard disk, \\.\PHYSICALDRIVE1 the second, etc. Hard disks are numbered starting with 0 for each RTF_DEVICE_FDISK entry in RTFiles-32's device list which are mounted successfully. For obvious reasons, using logical drive files and physical device files with read/write access is dangerous. Writing incorrect data to critical areas of a device such as the partition table, a boot record, the FAT or directory can completely destroy a file system. Raw I/OAn even lower level of access to a device is available through RTFiles-32's raw I/O functions. Raw I/O functions call the device driver directly and bypass RTFiles-32's file system core. However, consistency with the buffer cache is maintained. RTFiles-32 in Embedded Applications
|