RTEMS 6.1-rc6
Loading...
Searching...
No Matches
Files | Data Structures | Macros | Typedefs | Enumerations | Functions | Variables

FAT file system configuration support, format and mount options. More...

Files

file  dosfs.h
 Application Interface to FAT Filesystem.
 
file  fat.c
 Low-level Operations on a Volume with a DOSFS FAT filesystem.
 
file  fat.h
 Constants/Data Structures/Prototypes on a Volume with FAT Filesystem.
 
file  msdos.h
 The MSDOS Filesystem Constants/Data Structures/Prototypes.
 
file  msdos_conv_default.c
 Default Converter.
 
file  msdos_conv_utf8.c
 UTF-8 Converter.
 
file  msdos_eval.c
 MSDOS Evaluation Routines.
 
file  msdos_file.c
 MSDOS File Handlers Implementation.
 
file  msdos_format.c
 RTEMS MSDOS Format Functionality.
 
file  msdos_handlers_dir.c
 Directory Handlers Table for MSDOS FileSystem.
 
file  msdos_handlers_file.c
 File Operations Table for MSDOS FileSystem.
 
file  msdos_init.c
 Init Routine for MSDOS.
 
file  msdos_misc.c
 Miscellaneous Routines Implementation for MSDOS FileSystem.
 

Data Structures

struct  rtems_dosfs_mount_options
 FAT filesystem mount options. More...
 
struct  msdos_format_request_param_t
 FAT file system format request parameters. More...
 
struct  fat_vol_s
 
struct  fat_cache_s
 
struct  fat_fs_info_s
 
struct  fat_pos_s
 
struct  fat_dir_pos_s
 
struct  msdos_fs_info_s
 

Macros

#define RTEMS_DOSFS_SEMAPHORES_PER_INSTANCE   1
 Semaphore count per FAT filesystem instance.
 
#define MSDOS_FMT_INFO_LEVEL_NONE   (0)
 
#define MSDOS_FMT_INFO_LEVEL_INFO   (1)
 
#define MSDOS_FMT_INFO_LEVEL_DETAIL   (2)
 
#define MSDOS_FMT_INFO_LEVEL_DEBUG   (3)
 
#define RC_OK   0
 
#define CF_LE_W(v)   le16toh(v)
 
#define CF_LE_L(v)   le32toh(v)
 
#define CT_LE_W(v)   htole16(v)
 
#define CT_LE_L(v)   htole32(v)
 
#define FAT_HASH_SIZE   2
 
#define FAT_HASH_MODULE   FAT_HASH_SIZE
 
#define FAT_SECTOR512_SIZE   512 /* sector size (bytes) */
 
#define FAT_SECTOR512_BITS   9 /* log2(SECTOR_SIZE) */
 
#define FAT_FAT12_MAX_CLN   4085
 
#define FAT_FAT16_MAX_CLN   65525
 
#define FAT_FAT12   0x01
 
#define FAT_FAT16   0x02
 
#define FAT_FAT32   0x04
 
#define FAT_UNDEFINED_VALUE   (uint32_t)0xFFFFFFFF
 
#define FAT_FAT12_EOC   0x0FF8
 
#define FAT_FAT16_EOC   0xFFF8
 
#define FAT_FAT32_EOC   (uint32_t)0x0FFFFFF8
 
#define FAT_FAT12_FREE   0x0000
 
#define FAT_FAT16_FREE   0x0000
 
#define FAT_FAT32_FREE   0x00000000
 
#define FAT_GENFAT_EOC   (uint32_t)0xFFFFFFFF
 
#define FAT_GENFAT_FREE   (uint32_t)0x00000000
 
#define FAT_FAT12_SHIFT   0x04
 
#define FAT_FAT12_MASK   0x00000FFF
 
#define FAT_FAT16_MASK   0x0000FFFF
 
#define FAT_FAT32_MASK   (uint32_t)0x0FFFFFFF
 
#define FAT_MAX_BPB_SIZE   90
 
#define FAT_TOTAL_MBR_SIZE   512
 
#define FAT_USEFUL_INFO_SIZE   12
 
#define FAT_GET_ADDR(x, ofs)   ((uint8_t *)(x) + (ofs))
 
#define FAT_GET_VAL8(x, ofs)   (uint8_t)(*((uint8_t *)(x) + (ofs)))
 
#define FAT_GET_VAL16(x, ofs)
 
#define FAT_GET_VAL32(x, ofs)
 
#define FAT_SET_VAL8(x, ofs, val)    (*((uint8_t *)(x)+(ofs))=(uint8_t)(val))
 
#define FAT_SET_VAL16(x, ofs, val)
 
#define FAT_SET_VAL32(x, ofs, val)
 
#define FAT_GET_BR_JMPBOOT(x)   FAT_GET_VAL8( x, 0)
 
#define FAT_SET_BR_JMPBOOT(x, val)   FAT_SET_VAL8( x, 0,val)
 
#define FAT_GET_ADDR_BR_OEMNAME(x)   FAT_GET_ADDR( x, 3)
 
#define FAT_BR_OEMNAME_SIZE   (8)
 
#define FAT_GET_BR_BYTES_PER_SECTOR(x)   FAT_GET_VAL16(x, 11)
 
#define FAT_SET_BR_BYTES_PER_SECTOR(x, val)   FAT_SET_VAL16(x, 11,val)
 
#define FAT_GET_BR_SECTORS_PER_CLUSTER(x)   FAT_GET_VAL8( x, 13)
 
#define FAT_SET_BR_SECTORS_PER_CLUSTER(x, val)   FAT_SET_VAL8( x, 13,val)
 
#define FAT_GET_BR_RESERVED_SECTORS_NUM(x)   FAT_GET_VAL16(x, 14)
 
#define FAT_SET_BR_RESERVED_SECTORS_NUM(x, val)   FAT_SET_VAL16(x, 14,val)
 
#define FAT_GET_BR_FAT_NUM(x)   FAT_GET_VAL8( x, 16)
 
#define FAT_SET_BR_FAT_NUM(x, val)   FAT_SET_VAL8( x, 16,val)
 
#define FAT_GET_BR_FILES_PER_ROOT_DIR(x)   FAT_GET_VAL16(x, 17)
 
#define FAT_SET_BR_FILES_PER_ROOT_DIR(x, val)   FAT_SET_VAL16(x, 17,val)
 
#define FAT_GET_BR_TOTAL_SECTORS_NUM16(x)   FAT_GET_VAL16(x, 19)
 
#define FAT_SET_BR_TOTAL_SECTORS_NUM16(x, val)   FAT_SET_VAL16(x, 19,val)
 
#define FAT_GET_BR_MEDIA(x)   FAT_GET_VAL8( x, 21)
 
#define FAT_SET_BR_MEDIA(x, val)   FAT_SET_VAL8( x, 21,val)
 
#define FAT_GET_BR_SECTORS_PER_FAT(x)   FAT_GET_VAL16(x, 22)
 
#define FAT_SET_BR_SECTORS_PER_FAT(x, val)   FAT_SET_VAL16(x, 22,val)
 
#define FAT_GET_BR_SECTORS_PER_TRACK(x)   FAT_GET_VAL16(x, 24)
 
#define FAT_SET_BR_SECTORS_PER_TRACK(x, val)   FAT_SET_VAL16(x, 24,val)
 
#define FAT_GET_BR_NUMBER_OF_HEADS(x)   FAT_GET_VAL16(x, 26)
 
#define FAT_SET_BR_NUMBER_OF_HEADS(x, val)   FAT_SET_VAL16(x, 26,val)
 
#define FAT_GET_BR_HIDDEN_SECTORS(x)   FAT_GET_VAL32(x, 28)
 
#define FAT_SET_BR_HIDDEN_SECTORS(x, val)   FAT_SET_VAL32(x, 28,val)
 
#define FAT_GET_BR_TOTAL_SECTORS_NUM32(x)   FAT_GET_VAL32(x, 32)
 
#define FAT_SET_BR_TOTAL_SECTORS_NUM32(x, val)   FAT_SET_VAL32(x, 32,val)
 
#define FAT_GET_BR_DRVNUM(x)   FAT_GET_VAL8( x, 36)
 
#define FAT_SET_BR_DRVNUM(x, val)   FAT_SET_VAL8( x, 36,val)
 
#define FAT_GET_BR_RSVD1(x)   FAT_GET_VAL8( x, 37)
 
#define FAT_SET_BR_RSVD1(x, val)   FAT_SET_VAL8( x, 37,val)
 
#define FAT_GET_BR_BOOTSIG(x)   FAT_GET_VAL8( x, 38)
 
#define FAT_SET_BR_BOOTSIG(x, val)   FAT_SET_VAL8( x, 38,val)
 
#define FAT_BR_BOOTSIG_VAL   (0x29)
 
#define FAT_GET_BR_VOLID(x)   FAT_GET_VAL32(x, 39)
 
#define FAT_SET_BR_VOLID(x, val)   FAT_SET_VAL32(x, 39,val)
 
#define FAT_GET_ADDR_BR_VOLLAB(x)   FAT_GET_ADDR (x, 43)
 
#define FAT_BR_VOLLAB_SIZE   (11)
 
#define FAT_GET_ADDR_BR_FILSYSTYPE(x)   FAT_GET_ADDR (x, 54)
 
#define FAT_BR_FILSYSTYPE_SIZE   (8)
 
#define FAT_GET_BR_SECTORS_PER_FAT32(x)   FAT_GET_VAL32(x, 36)
 
#define FAT_SET_BR_SECTORS_PER_FAT32(x, val)   FAT_SET_VAL32(x, 36,val)
 
#define FAT_GET_BR_EXT_FLAGS(x)   FAT_GET_VAL16(x, 40)
 
#define FAT_SET_BR_EXT_FLAGS(x, val)   FAT_SET_VAL16(x, 40,val)
 
#define FAT_GET_BR_FSVER(x)   FAT_GET_VAL16(x, 42)
 
#define FAT_SET_BR_FSVER(x, val)   FAT_SET_VAL16(x, 42,val)
 
#define FAT_GET_BR_FAT32_ROOT_CLUSTER(x)   FAT_GET_VAL32(x, 44)
 
#define FAT_SET_BR_FAT32_ROOT_CLUSTER(x, val)   FAT_SET_VAL32(x, 44,val)
 
#define FAT_GET_BR_FAT32_FS_INFO_SECTOR(x)   FAT_GET_VAL16(x, 48)
 
#define FAT_SET_BR_FAT32_FS_INFO_SECTOR(x, val)   FAT_SET_VAL16(x, 48,val)
 
#define FAT_GET_BR_FAT32_BK_BOOT_SECTOR(x)   FAT_GET_VAL16(x, 50)
 
#define FAT_SET_BR_FAT32_BK_BOOT_SECTOR(x, val)   FAT_SET_VAL16(x, 50,val)
 
#define FAT_GET_ADDR_BR_FAT32_RESERVED(x)   FAT_GET_ADDR (x, 52)
 
#define FAT_BR_FAT32_RESERVED_SIZE   (12)
 
#define FAT_GET_BR_FAT32_DRVNUM(x)   FAT_GET_VAL8( x, 64)
 
#define FAT_SET_BR_FAT32_DRVNUM(x, val)   FAT_SET_VAL8( x, 64,val)
 
#define FAT_GET_BR_FAT32_RSVD1(x)   FAT_GET_VAL8( x, 65)
 
#define FAT_SET_BR_FAT32_RSVD1(x, val)   FAT_SET_VAL8( x, 65,val)
 
#define FAT_GET_BR_FAT32_BOOTSIG(x)   FAT_GET_VAL8( x, 66)
 
#define FAT_SET_BR_FAT32_BOOTSIG(x, val)   FAT_SET_VAL8( x, 66,val)
 
#define FAT_BR_FAT32_BOOTSIG_VAL   (0x29)
 
#define FAT_GET_BR_FAT32_VOLID(x)   FAT_GET_VAL32(x, 67)
 
#define FAT_SET_BR_FAT32_VOLID(x, val)   FAT_SET_VAL32(x, 67,val)
 
#define FAT_GET_ADDR_BR_FAT32_VOLLAB(x)   FAT_GET_ADDR (x, 71)
 
#define FAT_BR_FAT32_VOLLAB_SIZE   (11)
 
#define FAT_GET_ADDR_BR_FAT32_FILSYSTYPE(x)   FAT_GET_ADDR (x, 82)
 
#define FAT_BR_FAT32_FILSYSTYPE_SIZE   (8)
 
#define FAT_GET_BR_SIGNATURE(x)   FAT_GET_VAL16(x,510)
 
#define FAT_SET_BR_SIGNATURE(x, val)   FAT_SET_VAL16(x,510,val)
 
#define FAT_BR_SIGNATURE_VAL   (0xAA55)
 
#define FAT_GET_FSINFO_LEAD_SIGNATURE(x)   FAT_GET_VAL32(x, 0)
 
#define FAT_SET_FSINFO_LEAD_SIGNATURE(x, val)   FAT_SET_VAL32(x, 0,val)
 
#define FAT_FSINFO_LEAD_SIGNATURE_VALUE   (0x41615252)
 
#define FAT_GET_FSINFO_STRUC_SIGNATURE(x)   FAT_GET_VAL32(x,484)
 
#define FAT_SET_FSINFO_STRUC_SIGNATURE(x, val)   FAT_SET_VAL32(x,484,val)
 
#define FAT_FSINFO_STRUC_SIGNATURE_VALUE   (0x61417272)
 
#define FAT_GET_FSINFO_TRAIL_SIGNATURE(x)   FAT_GET_VAL32(x,508)
 
#define FAT_SET_FSINFO_TRAIL_SIGNATURE(x, val)   FAT_SET_VAL32(x,508,val)
 
#define FAT_FSINFO_TRAIL_SIGNATURE_VALUE   (0xAA550000)
 
#define FAT_GET_FSINFO_FREE_CLUSTER_COUNT(x)   FAT_GET_VAL32(x, 4)
 
#define FAT_SET_FSINFO_FREE_CLUSTER_COUNT(x, val)   FAT_SET_VAL32(x, 4,val)
 
#define FAT_GET_FSINFO_NEXT_FREE_CLUSTER(x)   FAT_GET_VAL32(x, 8)
 
#define FAT_SET_FSINFO_NEXT_FREE_CLUSTER(x, val)   FAT_SET_VAL32(x, 8,val)
 
#define FAT_FSI_INFO   484
 
#define FAT_FSINFO_STRUCT_OFFSET   488
 
#define FAT_FSINFO_FREE_CLUSTER_COUNT_OFFSET   (FAT_FSINFO_STRUCT_OFFSET+0)
 
#define FAT_FSINFO_NEXT_FREE_CLUSTER_OFFSET   (FAT_FSINFO_STRUCT_OFFSET+4)
 
#define FAT_RSRVD_CLN   0x02
 
#define FAT_FSI_LEADSIG_SIZE   0x04
 
#define FAT_TOTAL_FSINFO_SIZE   512
 
#define MS_BYTES_PER_CLUSTER_LIMIT   0x10000 /* 64K */
 
#define MS_BYTES_PER_CLUSTER_LIMIT_FAT12   0x1000 /* 4K */
 
#define FAT_BR_EXT_FLAGS_MIRROR   0x0080
 
#define FAT_BR_EXT_FLAGS_FAT_NUM   0x000F
 
#define FAT_BR_MEDIA_FIXED   0xf8
 
#define FAT_DIRENTRY_SIZE   32
 
#define FAT_DIRENTRIES_PER_SEC512   16
 
#define FAT_FILE_SHORT_NAME   (0xffffffff)
 
#define FAT_FAT_OFFSET(fat_type, cln)
 
#define FAT_CLUSTER_IS_ODD(n)   ((n) & 0x0001)
 
#define FAT12_SHIFT   0x4 /* half of a byte */
 
#define FAT_UINO_POOL_INIT_SIZE   0x100
 
#define FAT_CACHE_EMPTY   0x0
 
#define FAT_CACHE_ACTUAL   0x1
 
#define FAT_OP_TYPE_READ   0x1
 
#define FAT_OP_TYPE_GET   0x2
 
#define MSDOS_NAME_NOT_FOUND_ERR   0x7D01
 
#define MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE   32 /* 32 bytes */
 
#define MSDOS_DIR_NAME(x)   (char *)((x) + 0)
 
#define MSDOS_DIR_ENTRY_TYPE(x)   (uint8_t *)((x) + 0)
 
#define MSDOS_DIR_ATTR(x)   (uint8_t *)((x) + 11)
 
#define MSDOS_DIR_NT_RES(x)   (uint8_t *)((x) + 12)
 
#define MSDOS_DIR_LFN_CHECKSUM(x)   (uint8_t *)((x) + 13)
 
#define MSDOS_DIR_CRT_TIME_TENTH(x)   (uint8_t *)((x) + 13)
 
#define MSDOS_DIR_CRT_TIME(x)   (uint16_t *)((x) + 14)
 
#define MSDOS_DIR_CRT_DATE(x)   (uint16_t *)((x) + 16)
 
#define MSDOS_DIR_LAST_ACCESS_DATE(x)   (uint16_t *)((x) + 18)
 
#define MSDOS_DIR_FIRST_CLUSTER_HI(x)   (uint16_t *)((x) + 20)
 
#define MSDOS_DIR_WRITE_TIME(x)   (uint16_t *)((x) + 22)
 
#define MSDOS_DIR_WRITE_DATE(x)   (uint16_t *)((x) + 24)
 
#define MSDOS_DIR_FIRST_CLUSTER_LOW(x)   (uint16_t *)((x) + 26)
 
#define MSDOS_DIR_FILE_SIZE(x)   (uint32_t *)((x) + 28)
 
#define MSDOS_EXTRACT_CLUSTER_NUM(p)
 
#define MSDOS_FILE_SIZE_OFFSET   28
 
#define MSDOS_FILE_NAME_OFFSET   0
 
#define MSDOS_FIRST_CLUSTER_HI_OFFSET   20
 
#define MSDOS_FIRST_CLUSTER_LOW_OFFSET   26
 
#define MSDOS_FILE_WDATE_OFFSET   24
 
#define MSDOS_FILE_WTIME_OFFSET   22
 
#define MSDOS_FILE_ADATE_OFFSET   18
 
#define MSDOS_FILE_CDATE_OFFSET   16
 
#define MSDOS_FILE_CTIME_OFFSET   14
 
#define MSDOS_ATTR_READ_ONLY   0x01
 
#define MSDOS_ATTR_HIDDEN   0x02
 
#define MSDOS_ATTR_SYSTEM   0x04
 
#define MSDOS_ATTR_VOLUME_ID   0x08
 
#define MSDOS_ATTR_DIRECTORY   0x10
 
#define MSDOS_ATTR_ARCHIVE   0x20
 
#define MSDOS_ATTR_LFN
 
#define MSDOS_ATTR_LFN_MASK
 
#define MSDOS_LAST_LONG_ENTRY   0x40
 
#define MSDOS_LAST_LONG_ENTRY_MASK   0x3F
 
#define MSDOS_DT_2SECONDS_MASK   0x1F /* seconds divided by 2 */
 
#define MSDOS_DT_2SECONDS_SHIFT   0
 
#define MSDOS_DT_MINUTES_MASK   0x7E0 /* minutes */
 
#define MSDOS_DT_MINUTES_SHIFT   5
 
#define MSDOS_DT_HOURS_MASK   0xF800 /* hours */
 
#define MSDOS_DT_HOURS_SHIFT   11
 
#define MSDOS_DD_DAY_MASK   0x1F /* day of month */
 
#define MSDOS_DD_DAY_SHIFT   0
 
#define MSDOS_DD_MONTH_MASK   0x1E0 /* month */
 
#define MSDOS_DD_MONTH_SHIFT   5
 
#define MSDOS_DD_YEAR_MASK   0xFE00 /* year - 1980 */
 
#define MSDOS_DD_YEAR_SHIFT   9
 
#define MSDOS_THIS_DIR_ENTRY_EMPTY   0xE5
 
#define MSDOS_THIS_DIR_ENTRY_AND_REST_EMPTY   0x00
 
#define MSDOS_LFN_LEN_PER_ENTRY   (13)
 
#define MSDOS_NAME_MAX_UTF8_BYTES_PER_CHAR   4
 
#define MSDOS_NAME_MIN_UTF8_BYTES_PER_CHAR   1
 
#define MSDOS_SHORT_BASE_LEN   8 /* 8 characters */
 
#define MSDOS_SHORT_EXT_LEN   3 /* 3 characters */
 
#define MSDOS_SHORT_NAME_LEN
 
#define MSDOS_NAME_MAX_LNF_LEN   (255)
 
#define MSDOS_NAME_MAX   MSDOS_SHORT_NAME_LEN
 
#define MSDOS_NAME_MAX_UTF8_SFN_BYTES
 
#define MSDOS_NAME_MAX_WITH_DOT   (MSDOS_NAME_MAX + 1)
 
#define MSDOS_SFN_MAX_WITH_DOT_UTF8_BYTES
 
#define MSDOS_NAME_MAX_LFN_WITH_DOT   (260)
 
#define MSDOS_NAME_LFN_BYTES_PER_CHAR   (2)
 
#define MSDOS_NAME_MAX_LFN_BYTES
 
#define MSDOS_NAME_MAX_UTF8_LFN_BYTES
 
#define MSDOS_ENTRY_LFN_UTF8_BYTES
 
#define MSDOS_RES_NT_VALUE   0x00
 
#define MSDOS_INIT_DIR_SIZE   0x00
 
#define MSDOS_DOT_DIR_ENTRY_OFFSET   0x00 /* first entry in directory */
 
#define MSDOS_DOTDOT_DIR_ENTRY_OFFSET   0x20 /* second entry in directory */
 
#define DOT_NODE_P(p)   ((char *)(p))
 
#define DOTDOT_NODE_P(p)   ((char *)((p) + MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE))
 
#define MSDOS_MAX_DIR_LENGTH   0x200000 /* 2,097,152 bytes */
 
#define MSDOS_MAX_FILE_SIZE   0xFFFFFFFF /* 4 Gb */
 
#define MSDOS_DPS512_NUM   16
 

Typedefs

typedef struct fat_vol_s fat_vol_t
 
typedef struct fat_cache_s fat_cache_t
 
typedef struct fat_fs_info_s fat_fs_info_t
 
typedef struct fat_pos_s fat_pos_t
 
typedef struct fat_dir_pos_s fat_dir_pos_t
 
typedef struct msdos_fs_info_s msdos_fs_info_t
 
typedef enum msdos_name_types_e msdos_name_type_t
 
typedef enum msdos_token_types_e msdos_token_types_t
 

Enumerations

enum  msdos_name_types_e { MSDOS_NAME_INVALID = 0 , MSDOS_NAME_SHORT , MSDOS_NAME_LONG }
 
enum  msdos_token_types_e {
  MSDOS_NO_MORE_PATH , MSDOS_CURRENT_DIR , MSDOS_UP_DIR , MSDOS_NAME ,
  MSDOS_INVALID_TOKEN
}
 

Functions

rtems_dosfs_convert_controlrtems_dosfs_create_default_converter (void)
 Allocates and initializes a default converter.
 
rtems_dosfs_convert_controlrtems_dosfs_create_utf8_converter (const char *codepage)
 Allocates and initializes a UTF-8 converter.
 
int msdos_format (const char *devname, const msdos_format_request_param_t *rqdata)
 Formats a block device with a FAT file system.
 
int fat_buf_access (fat_fs_info_t *fs_info, uint32_t sec_num, int op_type, uint8_t **sec_buf)
 
int fat_buf_release (fat_fs_info_t *fs_info)
 
ssize_t _fat_block_read (fat_fs_info_t *fs_info, uint32_t start, uint32_t offset, uint32_t count, void *buff)
 
void fat_block_peek (fat_fs_info_t *fs_info, const uint32_t blk, const uint32_t blk_cnt)
 
ssize_t fat_cluster_write (fat_fs_info_t *fs_info, uint32_t start_cln, uint32_t offset, uint32_t count, const void *buff)
 
ssize_t fat_sector_write (fat_fs_info_t *fs_info, uint32_t start, uint32_t offset, uint32_t count, const void *buff)
 
ssize_t fat_cluster_set (fat_fs_info_t *fs_info, uint32_t start, uint32_t offset, uint32_t count, uint8_t pattern)
 
int fat_init_volume_info (fat_fs_info_t *fs_info, const char *device)
 
int fat_init_clusters_chain (fat_fs_info_t *fs_info, uint32_t start_cln)
 
int fat_shutdown_drive (fat_fs_info_t *fs_info)
 
uint32_t fat_get_unique_ino (fat_fs_info_t *fs_info)
 
bool fat_ino_is_unique (fat_fs_info_t *fs_info, uint32_t ino)
 
void fat_free_unique_ino (fat_fs_info_t *fs_info, uint32_t ino)
 
int fat_sync (fat_fs_info_t *fs_info)
 
void msdos_shut_down (rtems_filesystem_mount_table_entry_t *temp_mt_entry)
 Shut down the MSDOS filesystem.
 
void msdos_eval_path (rtems_filesystem_eval_path_context_t *ctx)
 
void msdos_free_node_info (const rtems_filesystem_location_info_t *pathloc)
 Call the Fat-File close routine.
 
int msdos_mknod (const rtems_filesystem_location_info_t *loc, const char *name, size_t namelen, mode_t mode, dev_t dev)
 Routine for node creation in a MSDOS filesystem.
 
int msdos_rmnod (const rtems_filesystem_location_info_t *parentloc, const rtems_filesystem_location_info_t *loc)
 Remove node from MSDOS directory.
 
int msdos_rename (const rtems_filesystem_location_info_t *old_parent_loc, const rtems_filesystem_location_info_t *old_loc, const rtems_filesystem_location_info_t *new_parent_loc, const char *new_name, size_t new_namelen)
 Rename a MSDOS filesystem node.
 
int msdos_statvfs (const rtems_filesystem_location_info_t *root_loc, struct statvfs *sb)
 
void msdos_lock (const rtems_filesystem_mount_table_entry_t *mt_entry)
 
void msdos_unlock (const rtems_filesystem_mount_table_entry_t *mt_entry)
 
int msdos_initialize_support (rtems_filesystem_mount_table_entry_t *temp_mt_entry, const rtems_filesystem_operations_table *op_table, const rtems_filesystem_file_handlers_r *file_handlers, const rtems_filesystem_file_handlers_r *directory_handlers, rtems_dosfs_convert_control *converter)
 MSDOS filesystem initialization routine.
 
ssize_t msdos_file_read (rtems_libio_t *iop, void *buffer, size_t count)
 
ssize_t msdos_file_write (rtems_libio_t *iop, const void *buffer, size_t count)
 
int msdos_file_stat (const rtems_filesystem_location_info_t *loc, struct stat *buf)
 
int msdos_file_ftruncate (rtems_libio_t *iop, off_t length)
 
int msdos_file_sync (rtems_libio_t *iop)
 
ssize_t msdos_dir_read (rtems_libio_t *iop, void *buffer, size_t count)
 
int msdos_dir_sync (rtems_libio_t *iop)
 
int msdos_dir_stat (const rtems_filesystem_location_info_t *loc, struct stat *buf)
 
int msdos_creat_node (const rtems_filesystem_location_info_t *parent_loc, fat_file_type_t type, const char *name, int name_len, mode_t mode, fat_file_fd_t *link_fd)
 Implements wake up version of the "signal" operation.
 
int msdos_find_name (rtems_filesystem_location_info_t *parent_loc, const char *name, int name_len)
 
int msdos_get_name_node (const rtems_filesystem_location_info_t *parent_loc, bool create_node, const char *name, int name_len, msdos_name_type_t name_type, fat_dir_pos_t *dir_pos, char *name_dir_entry)
 
int msdos_dir_info_remove (rtems_filesystem_location_info_t *pathloc)
 
ssize_t msdos_format_dirent_with_dot (char *dst, const char *src)
 
msdos_name_type_t msdos_long_to_short (rtems_dosfs_convert_control *converter, const char *lfn, int lfn_len, char *sfn, int sfn_len)
 
ssize_t msdos_filename_utf8_to_short_name_for_compare (rtems_dosfs_convert_control *converter, const uint8_t *utf8_name, const size_t utf8_name_size, void *short_name, const size_t short_name_size)
 
ssize_t msdos_filename_utf8_to_short_name_for_save (rtems_dosfs_convert_control *converter, const uint8_t *utf8_name, const size_t utf8_name_size, void *short_name, const size_t short_name_size)
 
ssize_t msdos_filename_utf8_to_long_name_for_compare (rtems_dosfs_convert_control *converter, const uint8_t *utf8_name, const size_t utf8_name_size, uint8_t *long_name, const size_t long_name_size)
 
ssize_t msdos_filename_utf8_to_long_name_for_save (rtems_dosfs_convert_control *converter, const uint8_t *utf8_name, const size_t utf8_name_size, uint16_t *long_name, const size_t long_name_size)
 
ssize_t msdos_get_utf16_string_from_long_entry (const char *entry, uint16_t *entry_string_buf, const size_t buf_size, bool is_first_entry)
 
void msdos_date_unix2dos (unsigned int tsp, uint16_t *ddp, uint16_t *dtp)
 
unsigned int msdos_date_dos2unix (unsigned int dd, unsigned int dt)
 
int msdos_set_first_char4file_name (rtems_filesystem_mount_table_entry_t *mt_entry, fat_dir_pos_t *dir_pos, unsigned char first_char)
 
int msdos_dir_is_empty (rtems_filesystem_mount_table_entry_t *mt_entry, fat_file_fd_t *fat_fd, bool *ret_val)
 
int msdos_find_name_in_fat_file (rtems_filesystem_mount_table_entry_t *mt_entry, fat_file_fd_t *fat_fd, bool create_node, const uint8_t *name_utf8, int name_len, msdos_name_type_t name_type, fat_dir_pos_t *dir_pos, char *name_dir_entry)
 
int msdos_find_node_by_cluster_num_in_fat_file (rtems_filesystem_mount_table_entry_t *mt_entry, fat_file_fd_t *fat_fd, uint32_t cl4find, fat_dir_pos_t *dir_pos, char *dir_entry)
 
int msdos_get_dotdot_dir_info_cluster_num_and_offset (rtems_filesystem_mount_table_entry_t *mt_entry, uint32_t cln, fat_dir_pos_t *dir_pos, char *dir_entry)
 
int msdos_sync (rtems_libio_t *iop)
 
uint8_t msdos_lfn_checksum (const void *entry)
 

Variables

const rtems_filesystem_file_handlers_r msdos_dir_handlers
 
const rtems_filesystem_file_handlers_r msdos_file_handlers
 
const char *const MSDOS_DOT_NAME
 
const char *const MSDOS_DOTDOT_NAME
 

Detailed Description

FAT file system configuration support, format and mount options.

A block device can be formatted with a FAT file system with the msdos_format() function.

The FAT file system mount operation can be controlled with FAT file system specific mount options, see rtems_dosfs_mount_options.

Macro Definition Documentation

◆ FAT_FAT_OFFSET

#define FAT_FAT_OFFSET (   fat_type,
  cln 
)
Value:
((fat_type) & FAT_FAT12 ? ((cln) + ((cln) >> 1)) : \
(fat_type) & FAT_FAT16 ? ((cln) << 1) : \
((cln) << 2))

◆ FAT_GET_VAL16

#define FAT_GET_VAL16 (   x,
  ofs 
)
Value:
(uint16_t)( (*((uint8_t *)(x) + (ofs))) | \
((*((uint8_t *)(x) + (ofs) + 1)) << 8) )

◆ FAT_GET_VAL32

#define FAT_GET_VAL32 (   x,
  ofs 
)
Value:
(uint32_t)( (uint32_t)(*((uint8_t *)(x) + (ofs))) | \
((uint32_t)(*((uint8_t *)(x) + (ofs) + 1)) << 8) | \
((uint32_t)(*((uint8_t *)(x) + (ofs) + 2)) << 16) | \
((uint32_t)(*((uint8_t *)(x) + (ofs) + 3)) << 24) )

◆ FAT_SET_VAL16

#define FAT_SET_VAL16 (   x,
  ofs,
  val 
)
Value:
do { \
FAT_SET_VAL8((x),(ofs),(val)); \
FAT_SET_VAL8((x),(ofs)+1,(val)>>8);\
} while (0)

◆ FAT_SET_VAL32

#define FAT_SET_VAL32 (   x,
  ofs,
  val 
)
Value:
do { \
uint32_t val1 = val; \
FAT_SET_VAL16((x),(ofs),(val1)&0xffff);\
FAT_SET_VAL16((x),(ofs)+2,(val1)>>16);\
} while (0)

◆ MSDOS_ATTR_LFN

#define MSDOS_ATTR_LFN
Value:
(MSDOS_ATTR_READ_ONLY | \
MSDOS_ATTR_HIDDEN | \
MSDOS_ATTR_SYSTEM | \
MSDOS_ATTR_VOLUME_ID)

◆ MSDOS_ATTR_LFN_MASK

#define MSDOS_ATTR_LFN_MASK
Value:
(MSDOS_ATTR_READ_ONLY | \
MSDOS_ATTR_HIDDEN | \
MSDOS_ATTR_SYSTEM | \
MSDOS_ATTR_VOLUME_ID | \
MSDOS_ATTR_DIRECTORY | \
MSDOS_ATTR_ARCHIVE)

◆ MSDOS_ENTRY_LFN_UTF8_BYTES

#define MSDOS_ENTRY_LFN_UTF8_BYTES
Value:
(MSDOS_LFN_LEN_PER_ENTRY *\
MSDOS_NAME_MAX_UTF8_BYTES_PER_CHAR)

◆ MSDOS_EXTRACT_CLUSTER_NUM

#define MSDOS_EXTRACT_CLUSTER_NUM (   p)
Value:
(uint32_t)( (CF_LE_W(*MSDOS_DIR_FIRST_CLUSTER_LOW(p))) | \
((uint32_t)(CF_LE_W((*MSDOS_DIR_FIRST_CLUSTER_HI(p))))<<16) )
unsigned p
Definition: tte.h:17

◆ MSDOS_NAME_MAX_LFN_BYTES

#define MSDOS_NAME_MAX_LFN_BYTES
Value:
(MSDOS_NAME_MAX_LFN_WITH_DOT *\
MSDOS_NAME_LFN_BYTES_PER_CHAR)

◆ MSDOS_NAME_MAX_UTF8_LFN_BYTES

#define MSDOS_NAME_MAX_UTF8_LFN_BYTES
Value:
(MSDOS_NAME_MAX_LFN_WITH_DOT *\
MSDOS_NAME_MAX_UTF8_BYTES_PER_CHAR)

◆ MSDOS_NAME_MAX_UTF8_SFN_BYTES

#define MSDOS_NAME_MAX_UTF8_SFN_BYTES
Value:
(MSDOS_NAME_MAX *\
MSDOS_NAME_MAX_UTF8_BYTES_PER_CHAR)

◆ MSDOS_SFN_MAX_WITH_DOT_UTF8_BYTES

#define MSDOS_SFN_MAX_WITH_DOT_UTF8_BYTES
Value:
(MSDOS_NAME_MAX_WITH_DOT *\
MSDOS_NAME_MAX_UTF8_BYTES_PER_CHAR)

◆ MSDOS_SHORT_NAME_LEN

#define MSDOS_SHORT_NAME_LEN
Value:
(MSDOS_SHORT_BASE_LEN+\
MSDOS_SHORT_EXT_LEN) /* 11 chars */

◆ RTEMS_DOSFS_SEMAPHORES_PER_INSTANCE

#define RTEMS_DOSFS_SEMAPHORES_PER_INSTANCE   1

Semaphore count per FAT filesystem instance.

This can be used for system configuration via <rtems/confdefs.h>.

Function Documentation

◆ msdos_creat_node()

int msdos_creat_node ( const rtems_filesystem_location_info_t parent_loc,
fat_file_type_t  type,
const char *  name,
int  name_len,
mode_t  mode,
fat_file_fd_t link_fd 
)

Implements wake up version of the "signal" operation.

Routine to create a new MSDOS filesystem node

◆ msdos_format()

int msdos_format ( const char *  devname,
const msdos_format_request_param_t rqdata 
)

Formats a block device with a FAT file system.

Parameters
[in]devnameThe block device path.
[in]rqdataThe FAT file system format request data. Use NULL for default parameters.
Return values
0Successful operation.
-1An error occurred. The errno indicates the error.

◆ msdos_free_node_info()

void msdos_free_node_info ( const rtems_filesystem_location_info_t pathloc)

Call the Fat-File close routine.

Free node handler implementation for the filesystem operations table.

◆ msdos_initialize_support()

int msdos_initialize_support ( rtems_filesystem_mount_table_entry_t temp_mt_entry,
const rtems_filesystem_operations_table op_table,
const rtems_filesystem_file_handlers_r file_handlers,
const rtems_filesystem_file_handlers_r directory_handlers,
rtems_dosfs_convert_control converter 
)

MSDOS filesystem initialization routine.

MSDOS Initialization support routine implementation

◆ msdos_mknod()

int msdos_mknod ( const rtems_filesystem_location_info_t loc,
const char *  name,
size_t  namelen,
mode_t  mode,
dev_t  dev 
)

Routine for node creation in a MSDOS filesystem.

MSDOS Directory Handlers Implementation

◆ msdos_rename()

int msdos_rename ( const rtems_filesystem_location_info_t old_parent_loc,
const rtems_filesystem_location_info_t old_loc,
const rtems_filesystem_location_info_t new_parent_loc,
const char *  new_name,
size_t  new_namelen 
)

Rename a MSDOS filesystem node.

Routine to rename a MSDOS filesystem node

◆ msdos_rmnod()

int msdos_rmnod ( const rtems_filesystem_location_info_t parentloc,
const rtems_filesystem_location_info_t loc 
)

Remove node from MSDOS directory.

MSDOS Directory Handlers Implementation

◆ msdos_shut_down()

void msdos_shut_down ( rtems_filesystem_mount_table_entry_t temp_mt_entry)

Shut down the MSDOS filesystem.

MSDOS shut down handler implementation

◆ rtems_dosfs_create_default_converter()

rtems_dosfs_convert_control * rtems_dosfs_create_default_converter ( void  )

Allocates and initializes a default converter.

This default converter will accept only POSIX file names with pure ASCII characters. This largely corresponds to the file name handling before the optional UTF-8 support was added to the RTEMS implementation of the FAT file system. This handling is mostly backwards compatible to the previous RTEMS implementation of the FAT file system.

For backwards compatibility and the previous RTEMS implementation of the FAT file system please see also rtems_dosfs_mount_options and mount().

Return values
NULLSomething failed.
otherPointer to initialized converter.

◆ rtems_dosfs_create_utf8_converter()

rtems_dosfs_convert_control * rtems_dosfs_create_utf8_converter ( const char *  codepage)

Allocates and initializes a UTF-8 converter.

This converter will assume that all file names passed to POSIX file handling methods are UTF-8 strings and will convert them to the selected code page for short file names and to UTF-16 for long file names. This conversion will be done during reading and writing. These conversions correspond to the specification of the FAT file system. This handling is mostly backwards compatible to the previous RTEMS implementation of the FAT file system.

For backwards compatibility and the previous RTEMS implementation of the FAT file system please see also rtems_dosfs_mount_options and mount().

One possible issue with this converter is: When reading file names which have been created with other implementations of the FAT file system, it can happen that during the conversion to UTF-8 a long file name becomes longer and exceeds the 255 bytes limit. In such a case only the short file name will get read.

Parameters
[in]codepageThe iconv() identification string for the used code page.
Return values
NULLSomething failed.
otherPointer to initialized converter.