mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2025-12-05 15:15:44 +00:00
@@ -482,6 +482,8 @@ int msdos_get_dotdot_dir_info_cluster_num_and_offset(
|
|||||||
|
|
||||||
int msdos_sync(rtems_libio_t *iop);
|
int msdos_sync(rtems_libio_t *iop);
|
||||||
|
|
||||||
|
uint8_t msdos_lfn_checksum(const void *entry);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -281,14 +281,8 @@ msdos_dir_read(rtems_libio_t *iop, void *buffer, size_t count)
|
|||||||
*/
|
*/
|
||||||
if (lfn_start != FAT_FILE_SHORT_NAME)
|
if (lfn_start != FAT_FILE_SHORT_NAME)
|
||||||
{
|
{
|
||||||
uint8_t cs = 0;
|
if (lfn_entries ||
|
||||||
uint8_t* p = (uint8_t*) entry;
|
lfn_checksum != msdos_lfn_checksum(entry))
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < 11; i++, p++)
|
|
||||||
cs = ((cs & 1) ? 0x80 : 0) + (cs >> 1) + *p;
|
|
||||||
|
|
||||||
if (lfn_entries || (lfn_checksum != cs))
|
|
||||||
lfn_start = FAT_FILE_SHORT_NAME;
|
lfn_start = FAT_FILE_SHORT_NAME;
|
||||||
|
|
||||||
eno = (*convert_handler->utf16_to_utf8) (
|
eno = (*convert_handler->utf16_to_utf8) (
|
||||||
|
|||||||
@@ -55,6 +55,23 @@
|
|||||||
const char *const MSDOS_DOT_NAME = ". ";
|
const char *const MSDOS_DOT_NAME = ". ";
|
||||||
const char *const MSDOS_DOTDOT_NAME = ".. ";
|
const char *const MSDOS_DOTDOT_NAME = ".. ";
|
||||||
|
|
||||||
|
uint8_t
|
||||||
|
msdos_lfn_checksum(const void *entry)
|
||||||
|
{
|
||||||
|
const uint8_t *name;
|
||||||
|
uint8_t cs;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
name = (const uint8_t *) MSDOS_DIR_NAME(entry);
|
||||||
|
cs = 0;
|
||||||
|
|
||||||
|
for (i = 0; i < MSDOS_SHORT_NAME_LEN; ++i) {
|
||||||
|
cs = ((cs & 1) ? 0x80 : 0) + (cs >> 1) + name[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
return cs;
|
||||||
|
}
|
||||||
|
|
||||||
/* msdos_is_valid_name_char --
|
/* msdos_is_valid_name_char --
|
||||||
* Routine to check the character in a file or directory name.
|
* Routine to check the character in a file or directory name.
|
||||||
* The characters support in the short file name are letters,
|
* The characters support in the short file name are letters,
|
||||||
@@ -1535,14 +1552,8 @@ msdos_find_file_in_directory (
|
|||||||
*/
|
*/
|
||||||
if (entry_matched)
|
if (entry_matched)
|
||||||
{
|
{
|
||||||
uint8_t cs = 0;
|
if (lfn_entry ||
|
||||||
uint8_t* p = (uint8_t*) MSDOS_DIR_NAME(entry);
|
lfn_checksum != msdos_lfn_checksum(entry))
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < MSDOS_SHORT_NAME_LEN; i++, p++)
|
|
||||||
cs = ((cs & 1) ? 0x80 : 0) + (cs >> 1) + *p;
|
|
||||||
|
|
||||||
if (lfn_entry || (lfn_checksum != cs))
|
|
||||||
entry_matched = false;
|
entry_matched = false;
|
||||||
else if (filename_size_remaining == 0) {
|
else if (filename_size_remaining == 0) {
|
||||||
filename_matched = true;
|
filename_matched = true;
|
||||||
@@ -1561,7 +1572,7 @@ msdos_find_file_in_directory (
|
|||||||
|
|
||||||
#if MSDOS_FIND_PRINT
|
#if MSDOS_FIND_PRINT
|
||||||
printf ("MSFS:[9.2] checksum, entry_matched:%i, lfn_entry:%i, lfn_checksum:%02x/%02x\n",
|
printf ("MSFS:[9.2] checksum, entry_matched:%i, lfn_entry:%i, lfn_checksum:%02x/%02x\n",
|
||||||
entry_matched, lfn_entry, lfn_checksum, cs);
|
entry_matched, lfn_entry, lfn_checksum, msdos_lfn_checksum(entry));
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
bytes_in_entry = MSDOS_SHORT_NAME_LEN + 1;
|
bytes_in_entry = MSDOS_SHORT_NAME_LEN + 1;
|
||||||
@@ -1670,11 +1681,7 @@ msdos_add_file (
|
|||||||
|
|
||||||
if (fat_entries)
|
if (fat_entries)
|
||||||
{
|
{
|
||||||
uint8_t* p = (uint8_t*) MSDOS_DIR_NAME(name_dir_entry);
|
lfn_checksum = msdos_lfn_checksum(name_dir_entry);
|
||||||
int i;
|
|
||||||
for (i = 0; i < 11; i++, p++)
|
|
||||||
lfn_checksum =
|
|
||||||
((lfn_checksum & 1) ? 0x80 : 0) + (lfn_checksum >> 1) + *p;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user