fatfs.c: update dir_size during map_cluster extend loop [fixes #241]#242
Merged
PerditionC merged 1 commit intoFDOS:masterfrom Apr 21, 2026
Merged
Conversation
Contributor
Author
|
It appears that Then |
ecm-pushbx
added a commit
to ecm-pushbx/fdkernel
that referenced
this pull request
Apr 22, 2026
Earlier fix was FDOS#242 (this got the cluster value to use wrong). Original problem recorded in FDOS#241 Reset disk scriptlet: nasm -I ~/proj/lmacros/ ~/proj/bootimg/bootimg.asm \ -D_PAYLOADFILE=::empty -o diskempt.img cp -a ~/proj/kernel/bin/kernel.sys fdkernel.sys Run dosemu2 with -I "floppy { device diskempt.img }" After a test, run /sbin/dosfsck -n diskempt.img The following Script for lDebug files are test cases: === testshrt.sld e 200 "A:\test.dat" 0 f 300 l 100 26 a mov ah, 3C mov cx, 0 mov dx, 200 int 21 xchg bx, ax mov ax, 4200 mov cx, 1000 mov dx, cx int 21 mov dx, 300 mov cx, 10 mov ah, 3F int 21 . r v0 := aao a mov ah, 40 int 21 int3 int3 jmp (v0) . === testfull.sld e 200 "A:\test.dat" 0 f 400 l 400 38 a mov ah, 3C mov cx, 0 mov dx, 200 int 21 xchg bx, ax mov ax, 4200 mov cx, ((#1424 * #1024 - 1) >> 10) mov dx, ((#1424 * #1024 - 1) & FFFF) int 21 mov ah, 40 mov dx, 400 mov cx, 1 int 21 mov ah, 68 int 21 mov ax, 4202 mov cx, -1 mov dx, -10 int 21 mov ah, 40 mov dx, 400 mov cx, 10 int 21 int3 mov ah, 68 int 21 nop int3 nop jmp 100 . === testful2.sld e 200 "A:\test.dat" 0 f 400 l 400 38 a mov ah, 3C mov cx, 0 mov dx, 200 int 21 xchg bx, ax mov ax, 4200 mov cx, ((#1424 * #1024 - #512 - 1) >> 10) mov dx, ((#1424 * #1024 - #512 - 1) & FFFF) int 21 mov ah, 40 mov dx, 400 mov cx, 1 int 21 mov ah, 68 int 21 mov ax, 4202 mov cx, -1 mov dx, -10 int 21 mov ah, 40 mov dx, 400 mov cx, 10 int 21 int3 mov ah, 68 int 21 nop int3 nop jmp 100 . === testful3.sld e 200 "A:\test.dat" 0 f 400 l 400 38 a mov ah, 3C mov cx, 0 mov dx, 200 int 21 xchg bx, ax mov ax, 4200 mov cx, ((#1424 * #1024 - #512) >> 10) mov dx, ((#1424 * #1024 - #512) & FFFF) int 21 mov ah, 40 mov dx, 400 mov cx, 0 int 21 mov ah, 68 int 21 mov ax, 4202 mov cx, -1 mov dx, -10 int 21 mov ah, 40 mov dx, 400 mov cx, 10 int 21 int3 mov ah, 68 int 21 nop int3 nop jmp 100 . ===
PerditionC
pushed a commit
that referenced
this pull request
Apr 22, 2026
Earlier fix was #242 (this got the cluster value to use wrong). Original problem recorded in #241 Reset disk scriptlet: nasm -I ~/proj/lmacros/ ~/proj/bootimg/bootimg.asm \ -D_PAYLOADFILE=::empty -o diskempt.img cp -a ~/proj/kernel/bin/kernel.sys fdkernel.sys Run dosemu2 with -I "floppy { device diskempt.img }" After a test, run /sbin/dosfsck -n diskempt.img The following Script for lDebug files are test cases: === testshrt.sld e 200 "A:\test.dat" 0 f 300 l 100 26 a mov ah, 3C mov cx, 0 mov dx, 200 int 21 xchg bx, ax mov ax, 4200 mov cx, 1000 mov dx, cx int 21 mov dx, 300 mov cx, 10 mov ah, 3F int 21 . r v0 := aao a mov ah, 40 int 21 int3 int3 jmp (v0) . === testfull.sld e 200 "A:\test.dat" 0 f 400 l 400 38 a mov ah, 3C mov cx, 0 mov dx, 200 int 21 xchg bx, ax mov ax, 4200 mov cx, ((#1424 * #1024 - 1) >> 10) mov dx, ((#1424 * #1024 - 1) & FFFF) int 21 mov ah, 40 mov dx, 400 mov cx, 1 int 21 mov ah, 68 int 21 mov ax, 4202 mov cx, -1 mov dx, -10 int 21 mov ah, 40 mov dx, 400 mov cx, 10 int 21 int3 mov ah, 68 int 21 nop int3 nop jmp 100 . === testful2.sld e 200 "A:\test.dat" 0 f 400 l 400 38 a mov ah, 3C mov cx, 0 mov dx, 200 int 21 xchg bx, ax mov ax, 4200 mov cx, ((#1424 * #1024 - #512 - 1) >> 10) mov dx, ((#1424 * #1024 - #512 - 1) & FFFF) int 21 mov ah, 40 mov dx, 400 mov cx, 1 int 21 mov ah, 68 int 21 mov ax, 4202 mov cx, -1 mov dx, -10 int 21 mov ah, 40 mov dx, 400 mov cx, 10 int 21 int3 mov ah, 68 int 21 nop int3 nop jmp 100 . === testful3.sld e 200 "A:\test.dat" 0 f 400 l 400 38 a mov ah, 3C mov cx, 0 mov dx, 200 int 21 xchg bx, ax mov ax, 4200 mov cx, ((#1424 * #1024 - #512) >> 10) mov dx, ((#1424 * #1024 - #512) & FFFF) int 21 mov ah, 40 mov dx, 400 mov cx, 0 int 21 mov ah, 68 int 21 mov ax, 4202 mov cx, -1 mov dx, -10 int 21 mov ah, 40 mov dx, 400 mov cx, 10 int 21 int3 mov ah, 68 int 21 nop int3 nop jmp 100 . ===
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem discussed in #241 With this fix, the partial extend loop updates the directory entry's file size field after allocating every cluster so that the final result is a file properly allocated all clusters left free prior.
To consider: Is
map_clusterused by directory code? Will have to re-order this then so that subdirectories aren't given a nonzero size.