From 966741d3dced5b165e7c9ffc2a975dbd37a174d9 Mon Sep 17 00:00:00 2001 From: devin Date: Wed, 30 Sep 2026 19:10:52 +0000 Subject: [PATCH] Link pf_fat32, pf_sector, pf_volume_apiadd, pf_buffering Co-Authored-By: wch --- configure.py | 8 ++++---- libs/RVL_SDK/src/fa/pf_entry_iterator.c | 8 ++++---- libs/RVL_SDK/src/fa/pf_fat.c | 10 ++++++---- libs/RVL_SDK/src/fa/pf_path.c | 10 +++++----- libs/RVL_SDK/src/fa/pf_volume.c | 25 +++++++++++++------------ 5 files changed, 32 insertions(+), 29 deletions(-) diff --git a/configure.py b/configure.py index 66cb69f3..e62785b0 100644 --- a/configure.py +++ b/configure.py @@ -1699,17 +1699,17 @@ config.libs = [ Object(NonMatching, "fa/pf_fat.c"), Object(NonMatching, "fa/pf_fat12.c"), Object(NonMatching, "fa/pf_fat16.c"), - Object(NonMatching, "fa/pf_fat32.c"), + Object(Matching, "fa/pf_fat32.c"), Object(Matching, "fa/pf_fatfs.c"), Object(NonMatching, "fa/pf_file.c"), Object(NonMatching, "fa/pf_path.c"), - Object(NonMatching, "fa/pf_sector.c"), + Object(Matching, "fa/pf_sector.c"), Object(NonMatching, "fa/pf_volume.c"), - Object(NonMatching, "fa/pf_volume_apiadd.c"), + Object(Matching, "fa/pf_volume_apiadd.c"), Object(NonMatching, "fa/pf_cp932.c"), Object(Matching, "fa/pf_api_util.c"), Object(Matching, "fa/pf_attach.c"), - Object(NonMatching, "fa/pf_buffering.c"), + Object(Matching, "fa/pf_buffering.c"), Object(NonMatching, "fa/pf_cdelete.c"), Object(NonMatching, "fa/pf_chdir.c"), Object(NonMatching, "fa/pf_chdmod.c"), diff --git a/libs/RVL_SDK/src/fa/pf_entry_iterator.c b/libs/RVL_SDK/src/fa/pf_entry_iterator.c index 3e9581d7..cdd22745 100644 --- a/libs/RVL_SDK/src/fa/pf_entry_iterator.c +++ b/libs/RVL_SDK/src/fa/pf_entry_iterator.c @@ -347,7 +347,7 @@ pf_s32 PFENT_ITER_DoGetEntry(PFITER_ENT_ITER* p_iter, PF_DIR_ENT* p_ent, PF_VOLU if (err != 0) { return err; } - if (PFSTR_StrNumChar(p_path, 1) == 1 && (PFSTR_StrNCmp(p_path, (pf_s8*)"\0", 2, 0, 1) == 0)) { + if (PFSTR_StrNumChar(p_path, 1) == 1 && (PFSTR_StrNCmp(p_path, (pf_s8*)"\0\0\0", 2, 0, 1) == 0)) { return 0; } } else { @@ -366,7 +366,7 @@ pf_s32 PFENT_ITER_DoGetEntry(PFITER_ENT_ITER* p_iter, PF_DIR_ENT* p_ent, PF_VOLU if (err != 0) { return err; } - if (no_look_last_token != 0 && (PFSTR_StrNCmp(&token, (pf_s8*)"\0", 2, 0, 1) == 0)) { + if (no_look_last_token != 0 && (PFSTR_StrNCmp(&token, (pf_s8*)"\0\0\0", 2, 0, 1) == 0)) { break; } @@ -424,7 +424,7 @@ pf_s32 PFENT_ITER_DoGetEntry(PFITER_ENT_ITER* p_iter, PF_DIR_ENT* p_ent, PF_VOLU } if ((p_ent->attr & 0x10) == 0 || p_ent->short_name[0] != '.') { p_ent->path_len = (PFSTR_StrNumChar(&token, 1) + 1) + p_ent->path_len; - if ((PFSTR_StrNCmp(&token, (pf_s8*)"\0", 2, 0, 1) != 0)) { + if ((PFSTR_StrNCmp(&token, (pf_s8*)"\0\0\0", 2, 0, 1) != 0)) { p_ent->path_len -= PFSTR_StrNumChar(&token, 2); } } @@ -689,7 +689,7 @@ pf_s32 PFENT_ITER_FindEntry(PFITER_ENT_ITER* p_iter, PF_DIR_ENT* p_ent, PF_STR* if (PFSTR_StrNCmp(p_pattern, (pf_s8*)"\\", 1, 0, 1) == 0 || PFSTR_StrNCmp(p_pattern, (pf_s8*)"/", 1, 0, 1) == 0) { err = PFENT_GetRootDir(p_iter->p_vol, p_ent); if (err != 0) return err; - if (PFSTR_StrNumChar(p_pattern, 1) == 1 && PFSTR_StrNCmp(p_pattern, (pf_s8*)"\0", 2, 0, 1) == 0) return 0; + if (PFSTR_StrNumChar(p_pattern, 1) == 1 && PFSTR_StrNCmp(p_pattern, (pf_s8*)"\0\0\0", 2, 0, 1) == 0) return 0; } else { err = PFVOL_GetCurrentDir(p_iter->p_vol, p_ent); if (err != 0) return err; diff --git a/libs/RVL_SDK/src/fa/pf_fat.c b/libs/RVL_SDK/src/fa/pf_fat.c index 97a65db5..1809415e 100644 --- a/libs/RVL_SDK/src/fa/pf_fat.c +++ b/libs/RVL_SDK/src/fa/pf_fat.c @@ -1852,13 +1852,15 @@ s32 PFFAT_RefreshFSINFO(PF_VOLUME* volume) s32 alreadyAllocated; u32 completedBytes; s32 error; + s32 error2; error = 0; if ((volume->fsi_flag & 4) != 0) { - error = PFCACHE_AllocateDataPage(volume, -1, &page, - &alreadyAllocated); - if (error != 0) { goto finished; } - { + error2 = PFCACHE_AllocateDataPage(volume, -1, &page, + &alreadyAllocated); + if (error2 != 0) { + return error2; + } else { error = PFSEC_ReadData( volume, page->p_buf, volume->bpb.fs_info_sector, 0, volume->bpb.bytes_per_sector, &completedBytes, 0); diff --git a/libs/RVL_SDK/src/fa/pf_path.c b/libs/RVL_SDK/src/fa/pf_path.c index 0a9805bc..eff9a473 100644 --- a/libs/RVL_SDK/src/fa/pf_path.c +++ b/libs/RVL_SDK/src/fa/pf_path.c @@ -1014,7 +1014,7 @@ void PFPATH_SetSearchPattern(pf_s8* p_buf_local, pf_u16* p_buf_unicode, PF_STR* pf_u32 PFPATH_CheckExtShortNameSignature(PF_STR* p_str) { pf_u32 result = 0; - pf_s8 sig[2] = {1, 2}; + pf_s8 sig[2] = "\x01\x02"; if (PFSTR_StrNCmp(p_str, sig, 1, 0, 2) == 0) { result = 1; @@ -1027,7 +1027,7 @@ pf_u32 PFPATH_CheckExtShortName(PF_STR* p_str, pf_u32 target, pf_bool wildcard) pf_s16 i; pf_s16 num; pf_bool is_wildcard = PF_FALSE; - pf_s8 sig[2] = {1, 2}; + pf_s8 sig[2] = "\x01\x02"; pf_s8* p_c; pf_u16* p_wc; @@ -1035,7 +1035,7 @@ pf_u32 PFPATH_CheckExtShortName(PF_STR* p_str, pf_u32 target, pf_bool wildcard) (PFSTR_StrNCmp(p_str, (pf_s8*)"?", target, 0, 1) == 0 && (PFSTR_StrNCmp(p_str, (pf_s8*)"?", target, 1, 1) == 0 || PFSTR_StrNCmp(p_str, (pf_s8*)"*", target, 0, 1) == 0)) || PFSTR_StrNCmp(p_str, (pf_s8*)"*", target, 0, 1) == 0) { - for (i = 2; i < 8 && PF_IS_PATH_SEPERATOR(p_str, target, i) == PF_FALSE && PFSTR_StrNCmp(p_str, (pf_s8*)" ", target, i, 1) != 0 && + for (i = 2; i < 8 && PF_IS_PATH_SEPERATOR(p_str, target, i) == PF_FALSE && PFSTR_StrNCmp(p_str, (pf_s8*)"\x20\0\0", target, i, 1) != 0 && PF_IS_PATH_NOT_NULL(p_str, target, i); i++) { if (PFSTR_GetCodeMode(p_str) == 1) { @@ -1059,7 +1059,7 @@ pf_u32 PFPATH_CheckExtShortName(PF_STR* p_str, pf_u32 target, pf_bool wildcard) } } if (i == 8 || is_wildcard == PF_TRUE) { - if (PFSTR_StrNCmp(p_str, (pf_s8*)" ", target, i, 1) == 0 || PF_IS_PATH_SEPERATOR(p_str, target, i) == 0 || + if (PFSTR_StrNCmp(p_str, (pf_s8*)"\x20\0\0", target, i, 1) == 0 || PF_IS_PATH_SEPERATOR(p_str, target, i) == 0 || PF_IS_PATH_NULL(p_str, target, i)) { result = i; } @@ -1073,7 +1073,7 @@ pf_u32 PFPATH_GetExtShortNameIndex(PF_STR* p_str, pf_u32* p_index) { pf_s16 i; pf_s16 num; pf_u32 index; - pf_s8 sig[2] = {1, 2}; + pf_s8 sig[2] = "\x01\x02"; pf_s8* p_c; pf_u16* p_wc; diff --git a/libs/RVL_SDK/src/fa/pf_volume.c b/libs/RVL_SDK/src/fa/pf_volume.c index 9f8db06c..bd91415b 100644 --- a/libs/RVL_SDK/src/fa/pf_volume.c +++ b/libs/RVL_SDK/src/fa/pf_volume.c @@ -224,6 +224,9 @@ typedef struct PFVOL_SET { PFVOL_SET pf_vol_set; +static s8 default_volume_label[12] = "NO NAME "; +static const u8 deleted_entry_mark[8] = {0xE5}; + extern s32 PFDRV_mount(PFVOL_VOLUME* volume); extern s32 PFDRV_unmount(PFVOL_VOLUME* volume, u32 mode); extern s32 PFDRV_format(PFVOL_VOLUME* volume, const u8* format_options); @@ -370,12 +373,7 @@ static inline s32 finalize_volume(PFVOL_VOLUME* volume) { return 0; } static inline s32 copy_codeset(const PFVOL_CHARCODE* code_set) { - pf_vol_set.codeset.oem2unicode = code_set->oem2unicode; - pf_vol_set.codeset.unicode2oem = code_set->unicode2oem; - pf_vol_set.codeset.oem_char_width = code_set->oem_char_width; - pf_vol_set.codeset.is_oem_mb_char = code_set->is_oem_mb_char; - pf_vol_set.codeset.unicode_char_width = code_set->unicode_char_width; - pf_vol_set.codeset.is_unicode_mb_char = code_set->is_unicode_mb_char; + pf_vol_set.codeset = *code_set; return 0; } s32 PFVOL_DoMountVolume(PFVOL_VOLUME* volume) { @@ -500,7 +498,9 @@ s32 PFVOL_p_setvol(PFVOL_VOLUME* volume, const s8* label) { s32 error; error = PFENT_GetRootDir(volume, &root_entry); - if (error == 0) { + if (error != 0) { + return error; + } else { PFFAT_InitFFD(&ffd, &hint, volume, &root_entry.start_cluster); PFSTR_InitStr(&path, "*", 1); PFSTR_SetLocalStr(&path, 0); @@ -514,7 +514,7 @@ s32 PFVOL_p_setvol(PFVOL_VOLUME* volume, const s8* label) { entry.start_cluster = 0; } } else { - PFSTR_InitStr(&path, "", 1); + PFSTR_InitStr(&path, "\0\0\0", 1); PFSTR_SetLocalStr(&path, 0); error = PFENT_allocateEntry(&entry, 1, &ffd, previous_cluster, &path); if (error != 0) { @@ -584,7 +584,7 @@ s32 PFVOL_p_rmvvol(PFVOL_VOLUME* volume) { u32 logical_position; u32 entry_position; u32 processed; - u8 deleted = (u8)"\xE5"[0]; + u8 deleted = deleted_entry_mark[0]; s32 error; error = PFENT_GetRootDir(volume, &root_entry); @@ -913,7 +913,7 @@ s32 PFVOL_getvol(s8 drive, PFVOL_VOLUME_INFO* volume_info) { } else { volume = &pf_vol_set.volumes[volume_index]; } - if (pf_memcmp(volume->label, "NO NAME ", 11) == 0) { + if (pf_memcmp(volume->label, default_volume_label, 11) == 0) { pf_vol_set.last_error = 3; volume->last_error = 3; return 3; @@ -945,7 +945,7 @@ s32 PFVOL_rmvvol(s8 drive) { } else { volume = &pf_vol_set.volumes[volume_index]; } - if (pf_memcmp(volume->label, "NO NAME ", 11) == 0) { + if (pf_memcmp(volume->label, default_volume_label, 11) == 0) { pf_vol_set.last_error = 3; volume->last_error = 3; return 3; @@ -956,7 +956,7 @@ s32 PFVOL_rmvvol(s8 drive) { volume->last_error = error; return error; } - error = PFDRV_StoreVolumeLabelToBPB(volume, (const s8*)"NO NAME "); + error = PFDRV_StoreVolumeLabelToBPB(volume, default_volume_label); if (error != 0) { pf_vol_set.last_error = error; volume->last_error = error; @@ -1536,3 +1536,4 @@ s32 PFVOL_setencode(u32 mode) { pf_vol_set.setting = pf_vol_set.setting & ~3 | mode; return 0; } + -- 2.49.1