From 04599613bd3fa33e99dde9d3bc12f0cf3b3769fb Mon Sep 17 00:00:00 2001 From: Liu Aleaxander Date: Mon, 17 Aug 2009 16:28:52 +0800 Subject: [PATCH] Core: fat: make the file->file_len to store the dir sector number when we search a dir Because the opendir function in com32/lib/opendir.c use the eax to store the dir sector, where we store the file_len before. Well, we may need add a union structure in the file structure to store the file_len for file, file_dir for dir respecifictly Signed-off-by: Liu Aleaxander --- core/comboot.inc | 1 - core/fs/fat/fat.c | 5 +++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/core/comboot.inc b/core/comboot.inc index fb0f57f..60c5d6f 100644 --- a/core/comboot.inc +++ b/core/comboot.inc @@ -908,7 +908,6 @@ comapi_opendir: pop ds pm_call searchdir jz comapi_err ; Didn't find a directory - mov eax,[si] ; the sector number where the dir stores cmp eax,0 jz comapi_err ; Found nothing mov P_EAX,eax diff --git a/core/fs/fat/fat.c b/core/fs/fat/fat.c index 4ba43fe..2f0bac7 100644 --- a/core/fs/fat/fat.c +++ b/core/fs/fat/fat.c @@ -657,6 +657,11 @@ static void vfat_searchdir(char *filename, struct file *file) dir_sector = PrevDir; found_dir: open_file = alloc_fill_dir(dir_sector); + /* + * for dir, we use the file->file_len to store the sector number + * where the dir is. + */ + file_len = dir_sector; } else if ((attr & 0x18) || (file_len == 0)) { fail: file_len = 0; -- 2.7.4