21 #ifndef __DOSFS_MSDOS_H__ 22 #define __DOSFS_MSDOS_H__ 26 #include <rtems/dosfs.h> 41 #define MSDOS_NAME_NOT_FOUND_ERR 0x7D01 86 #define MSDOS_VOLUME_SEMAPHORE_TIMEOUT RTEMS_NO_TIMEOUT 92 #define MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE 32 94 #define MSDOS_DIR_NAME(x) (char *)((x) + 0) 95 #define MSDOS_DIR_ENTRY_TYPE(x) (uint8_t *)((x) + 0) 96 #define MSDOS_DIR_ATTR(x) (uint8_t *)((x) + 11) 97 #define MSDOS_DIR_NT_RES(x) (uint8_t *)((x) + 12) 98 #define MSDOS_DIR_LFN_CHECKSUM(x) (uint8_t *)((x) + 13) 99 #define MSDOS_DIR_CRT_TIME_TENTH(x) (uint8_t *)((x) + 13) 100 #define MSDOS_DIR_CRT_TIME(x) (uint16_t *)((x) + 14) 101 #define MSDOS_DIR_CRT_DATE(x) (uint16_t *)((x) + 16) 102 #define MSDOS_DIR_LAST_ACCESS_DATE(x) (uint16_t *)((x) + 18) 103 #define MSDOS_DIR_FIRST_CLUSTER_HI(x) (uint16_t *)((x) + 20) 104 #define MSDOS_DIR_WRITE_TIME(x) (uint16_t *)((x) + 22) 105 #define MSDOS_DIR_WRITE_DATE(x) (uint16_t *)((x) + 24) 106 #define MSDOS_DIR_FIRST_CLUSTER_LOW(x) (uint16_t *)((x) + 26) 107 #define MSDOS_DIR_FILE_SIZE(x) (uint32_t *)((x) + 28) 109 #define MSDOS_EXTRACT_CLUSTER_NUM(p) \ 110 (uint32_t)( (CF_LE_W(*MSDOS_DIR_FIRST_CLUSTER_LOW(p))) | \ 111 ((uint32_t)(CF_LE_W((*MSDOS_DIR_FIRST_CLUSTER_HI(p))))<<16) ) 117 #define MSDOS_FILE_SIZE_OFFSET 28 118 #define MSDOS_FILE_NAME_OFFSET 0 119 #define MSDOS_FIRST_CLUSTER_HI_OFFSET 20 120 #define MSDOS_FIRST_CLUSTER_LOW_OFFSET 26 121 #define MSDOS_FILE_WDATE_OFFSET 24 122 #define MSDOS_FILE_WTIME_OFFSET 22 123 #define MSDOS_FILE_ADATE_OFFSET 18 124 #define MSDOS_FILE_CDATE_OFFSET 16 125 #define MSDOS_FILE_CTIME_OFFSET 14 131 #define MSDOS_ATTR_READ_ONLY 0x01 132 #define MSDOS_ATTR_HIDDEN 0x02 133 #define MSDOS_ATTR_SYSTEM 0x04 134 #define MSDOS_ATTR_VOLUME_ID 0x08 135 #define MSDOS_ATTR_DIRECTORY 0x10 136 #define MSDOS_ATTR_ARCHIVE 0x20 137 #define MSDOS_ATTR_LFN (MSDOS_ATTR_READ_ONLY | \ 138 MSDOS_ATTR_HIDDEN | \ 139 MSDOS_ATTR_SYSTEM | \ 140 MSDOS_ATTR_VOLUME_ID) 141 #define MSDOS_ATTR_LFN_MASK (MSDOS_ATTR_READ_ONLY | \ 142 MSDOS_ATTR_HIDDEN | \ 143 MSDOS_ATTR_SYSTEM | \ 144 MSDOS_ATTR_VOLUME_ID | \ 145 MSDOS_ATTR_DIRECTORY | \ 148 #define MSDOS_LAST_LONG_ENTRY 0x40 149 #define MSDOS_LAST_LONG_ENTRY_MASK 0x3F 151 #define MSDOS_DT_2SECONDS_MASK 0x1F 152 #define MSDOS_DT_2SECONDS_SHIFT 0 153 #define MSDOS_DT_MINUTES_MASK 0x7E0 154 #define MSDOS_DT_MINUTES_SHIFT 5 155 #define MSDOS_DT_HOURS_MASK 0xF800 156 #define MSDOS_DT_HOURS_SHIFT 11 158 #define MSDOS_DD_DAY_MASK 0x1F 159 #define MSDOS_DD_DAY_SHIFT 0 160 #define MSDOS_DD_MONTH_MASK 0x1E0 161 #define MSDOS_DD_MONTH_SHIFT 5 162 #define MSDOS_DD_YEAR_MASK 0xFE00 163 #define MSDOS_DD_YEAR_SHIFT 9 170 #define MSDOS_THIS_DIR_ENTRY_EMPTY 0xE5 171 #define MSDOS_THIS_DIR_ENTRY_AND_REST_EMPTY 0x00 176 #define MSDOS_LFN_LEN_PER_ENTRY (13) 181 #define MSDOS_NAME_MAX_UTF8_BYTES_PER_CHAR 4 182 #define MSDOS_NAME_MIN_UTF8_BYTES_PER_CHAR 1 184 #define MSDOS_SHORT_BASE_LEN 8 185 #define MSDOS_SHORT_EXT_LEN 3 186 #define MSDOS_SHORT_NAME_LEN (MSDOS_SHORT_BASE_LEN+\ 188 #define MSDOS_NAME_MAX_LNF_LEN (255) 189 #define MSDOS_NAME_MAX MSDOS_SHORT_NAME_LEN 190 #define MSDOS_NAME_MAX_UTF8_SFN_BYTES (MSDOS_NAME_MAX *\ 191 MSDOS_NAME_MAX_UTF8_BYTES_PER_CHAR) 192 #define MSDOS_NAME_MAX_WITH_DOT (MSDOS_NAME_MAX + 1) 193 #define MSDOS_SFN_MAX_WITH_DOT_UTF8_BYTES (MSDOS_NAME_MAX_WITH_DOT *\ 194 MSDOS_NAME_MAX_UTF8_BYTES_PER_CHAR) 195 #define MSDOS_NAME_MAX_LFN_WITH_DOT (260) 197 #define MSDOS_NAME_LFN_BYTES_PER_CHAR (2) 198 #define MSDOS_NAME_MAX_LFN_BYTES (MSDOS_NAME_MAX_LFN_WITH_DOT *\ 199 MSDOS_NAME_LFN_BYTES_PER_CHAR) 200 #define MSDOS_NAME_MAX_UTF8_LFN_BYTES (MSDOS_NAME_MAX_LFN_WITH_DOT *\ 201 MSDOS_NAME_MAX_UTF8_BYTES_PER_CHAR) 202 #define MSDOS_ENTRY_LFN_UTF8_BYTES (MSDOS_LFN_LEN_PER_ENTRY *\ 203 MSDOS_NAME_MAX_UTF8_BYTES_PER_CHAR) 205 extern const char *
const MSDOS_DOT_NAME;
206 extern const char *
const MSDOS_DOTDOT_NAME;
208 typedef enum msdos_name_types_e
210 MSDOS_NAME_INVALID = 0,
215 typedef enum msdos_token_types_e
222 } msdos_token_types_t;
225 #define MSDOS_RES_NT_VALUE 0x00 226 #define MSDOS_INIT_DIR_SIZE 0x00 229 #define MSDOS_DOT_DIR_ENTRY_OFFSET 0x00 232 #define MSDOS_DOTDOT_DIR_ENTRY_OFFSET 0x20 235 #define DOT_NODE_P(p) ((char *)(p)) 236 #define DOTDOT_NODE_P(p) ((char *)((p) + MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE)) 239 #define MSDOS_MAX_DIR_LENGHT 0x200000 240 #define MSDOS_MAX_FILE_SIZE 0xFFFFFFFF 246 #define MSDOS_DPS512_NUM 16 296 const char *new_name,
321 ssize_t msdos_file_read(
327 ssize_t msdos_file_write(
339 msdos_file_ftruncate(
346 ssize_t msdos_dir_read(
366 fat_file_type_t type,
380 int msdos_get_name_node(
385 msdos_name_type_t name_type,
393 msdos_format_dirent_with_dot(
char *dst,
const char *src);
396 const char *lfn,
int lfn_len,
397 char* sfn,
int sfn_len);
400 msdos_filename_utf8_to_short_name_for_compare (
402 const uint8_t *utf8_name,
403 const size_t utf8_name_size,
405 const size_t short_name_size);
408 msdos_filename_utf8_to_short_name_for_save (
410 const uint8_t *utf8_name,
411 const size_t utf8_name_size,
413 const size_t short_name_size);
416 msdos_filename_utf8_to_long_name_for_compare (
418 const uint8_t *utf8_name,
419 const size_t utf8_name_size,
421 const size_t long_name_size);
424 msdos_filename_utf8_to_long_name_for_save (
426 const uint8_t *utf8_name,
427 const size_t utf8_name_size,
429 const size_t long_name_size);
432 msdos_get_utf16_string_from_long_entry (
434 uint16_t *entry_string_buf,
435 const size_t buf_size,
439 void msdos_date_unix2dos(
440 unsigned int tsp, uint16_t *ddp,
443 unsigned int msdos_date_dos2unix(
unsigned int dd,
unsigned int dt);
445 int msdos_set_first_char4file_name(
448 unsigned char first_char
451 int msdos_dir_is_empty(
457 int msdos_find_name_in_fat_file(
461 const uint8_t *name_utf8,
463 msdos_name_type_t name_type,
468 int msdos_find_node_by_cluster_num_in_fat_file(
476 int msdos_get_dotdot_dir_info_cluster_num_and_offset(
485 uint8_t msdos_lfn_checksum(
const void *entry);
Objects_Id rtems_id
Used to manage and manipulate RTEMS object identifiers.
Definition: types.h:80
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.
Definition: msdos_mknod.c:37
Constants/Data Structures/Prototypes for Operations on "fat-file".
int msdos_rmnod(const rtems_filesystem_location_info_t *parentloc, const rtems_filesystem_location_info_t *loc)
Remove node from MSDOS directory.
Definition: msdos_rmnod.c:24
void msdos_free_node_info(const rtems_filesystem_location_info_t *pathloc)
Call the Fat-File close routine.
Definition: msdos_free.c:36
FAT filesystem convert control.
Definition: dosfs.h:182
File system node operations table.
Definition: libio.h:982
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.
Definition: msdos_initsupp.c:51
void msdos_shut_down(rtems_filesystem_mount_table_entry_t *temp_mt_entry)
Shut down the MSDOS filesystem.
Definition: msdos_fsunmount.c:46
Descriptor of a fat-file.
Definition: fat_file.h:73
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, const fat_file_fd_t *link_fd)
Implements wake up version of the "signal" operation.
Definition: msdos_create.c:61
Mount table entry.
Definition: libio.h:1542
File system operations table.
Definition: libio.h:471
LibIO Internal Interface.
Path evaluation context.
Definition: libio.h:83
An open file data structure.
Definition: libio.h:1281
Definition: nfs_prot.h:234
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.
Definition: msdos_rename.c:38
Constants/Data Structures/Prototypes on a Volume with FAT Filesystem.
File system location.
Definition: fs.h:53