From eccab1fd22cc882836bdd34c14ff604409a01d1f Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Mon, 7 Apr 2008 16:39:15 -0700 Subject: extlinux: Correct the directory block end condition ext2/3 directory blocks are *not* ended with inode == 0; that reflects a deleted block (like 0xe5 in FAT.) Directory blocks are ended by directory block exhaustion; the last block is simply made as large as the whole directory block. --- extlinux.asm | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/extlinux.asm b/extlinux.asm index 8b2eff5b..c96e1102 100644 --- a/extlinux.asm +++ b/extlinux.asm @@ -1116,25 +1116,32 @@ searchdir: jmp .skipslash .readdir: + mov cx,[SecPerClust] + push cx + shl cx,SECTOR_SHIFT mov bx,trackbuf + add cx,bx + mov [EndBlock],cx + pop cx push bx - mov cx,[SecPerClust] call getfssec pop bx pushf ; Save EOF flag push si ; Save filesystem pointer .getent: - cmp dword [bx+d_inode],0 - je .endblock + cmp bx,[EndBlock] + jae .endblock push di + cmp dword [bx+d_inode],0 ; Zero inode = void entry + je .nope + movzx cx,byte [bx+d_name_len] lea si,[bx+d_name] repe cmpsb je .maybe .nope: pop di - add bx,[bx+d_rec_len] jmp .getent @@ -1232,6 +1239,7 @@ SymlinkBuf resb SYMLINK_SECTORS*SECTOR_SIZE+64 SymlinkTmpBuf equ trackbuf SymlinkTmpBufEnd equ trackbuf+SYMLINK_SECTORS*SECTOR_SIZE+64 ThisDir resd 1 +EndBlock resw 1 SymlinkCtr resb 1 section .text -- cgit v1.2.1