Commit 7a47b4ee authored by Simon Proven's avatar Simon Proven
Browse files

Fixed 4 bugs in DoOsFunRenameBigDir involving renameing of objects between...

Fixed 4 bugs in DoOsFunRenameBigDir involving renameing of objects between dirs with long filenames.

Fixed bug in OsFunResolveWildcard on long filenames.
parent 799ee76e
;>Version Version file for FileCore
GBLS version
version SETS "3.09"
version SETS "3.10"
GBLA Version
Version SETA 309
GBLS date
date SETS "11 Feb 1998"
date SETS "17 Feb 1998"
GBLL test_version
......
......@@ -591,7 +591,7 @@ ReadBigDirEntries ROUT
BigDirFinished ROUT
Push "R4,R6,LR"
[ DebugX
[ DebugX :LAND: {FALSE}
DLINE ">BigDirFinished"
DREG R5, "dir at:"
DREG R4, "entry at:"
......@@ -1966,13 +1966,13 @@ DirE
CanBigDirShrink ROUT
Push "R0,LR"
[ DebugX
[ DebugX :LOR: DebugXg
DLINE ">CanBigDirShrink"
]
BL BigDirFreeSpace ; (R5->LR)
MOV R0, LR
[ DebugX
[ DebugX :LOR: DebugXg
DREG R0, "free space:"
]
......@@ -1981,7 +1981,7 @@ CanBigDirShrink ROUT
BICS R0, R0, LR ; clear bottom bits
MOVNE R0, #-1 ; -1 if non-0
MVNS R0, R0 ; Z=1 if can shrink
[ DebugX
[ DebugX :LOR: DebugXg
BNE %FT01
DLINE "can shrink"
01
......@@ -2006,7 +2006,7 @@ CanBigDirShrink ROUT
ShrinkBigDir ROUT
Push "R0-R11,LR"
[ DebugX
[ DebugX :LOR: DebugXg
DLINE ">ShrinkBigDir"
]
......@@ -2073,7 +2073,7 @@ ShrinkBigDir ROUT
CMP R1, R8 ; is it too close to start of frag
BGE %FT30
[ DebugX
[ DebugX :LOR: DebugXg
DLINE "frag would be too short - adjusting length"
]
......@@ -2096,7 +2096,7 @@ ShrinkBigDir ROUT
BGE %FT40 ; shortening by more than LinkBits+1, so safe
[ DebugX
[ DebugX :LOR: DebugXg
DREG LR, "shortening by:"
]
......@@ -2113,7 +2113,7 @@ ShrinkBigDir ROUT
CMPS R11, R8 ; is it a gap
BEQ %FT40
[ DebugX
[ DebugX :LOR: DebugXg
DLINE "can't shorten"
]
......@@ -2123,7 +2123,7 @@ ShrinkBigDir ROUT
40 ; here when new length is OK
Pull "R1"
[ DebugX
[ DebugX :LOR: DebugXg
DREG R0, "new length is:"
DREG R1, "old length is:"
]
......@@ -2190,7 +2190,7 @@ ShrinkBigDir ROUT
95
STRVS R0, [SP]
[ DebugX
[ DebugX :LOR: DebugXg
DLINE "<ShrinkBigDir"
]
......@@ -2257,8 +2257,9 @@ BigDirHasSharedObjects ROUT
DoOsFunRenameBigDir ROUT
Push "R1-R11, LR"
[ DebugX
[ DebugX :LOR DebugXr
DLINE ">DoOsFunRenameBigDir"
DREG r3, "source dir ind disc add: "
]
; this bit same as for DoOsFunRename
......@@ -2267,6 +2268,9 @@ DoOsFunRenameBigDir ROUT
SUB R8, R4, R5
BL ReadIndDiscAdd ;(R3,R4->LR)
MOV R9, LR
[ DebugXr
DREG r9, "Ind disc add of object being moved: "
]
BL ReadIntAtts ;(R3,R4->LR)
MOV R11,LR
[ NewFs
......@@ -2293,6 +2297,9 @@ DoOsFunRenameBigDir ROUT
BL FullLookUp ;(R1,R2->R0-R6,C,V)
BVS %FT05
TEQS R7, R3 ;if new obj already exists is it old obj
[ DebugXr
DREG R3, "Dest ind dir: "
]
SUB LR, R4, R5
TEQEQS LR, R8
BEQ %FT07
......@@ -2312,7 +2319,7 @@ DoOsFunRenameBigDir ROUT
LDR R0, [SP,#BigDirEntrySize+4+4+4];string start
BL TermStart ;backtrack to start of last term (R0,R1->R1)
[ DebugX
[ DebugX :LOR: DebugXr
DSTRING R1, "New final component:"
]
......@@ -2326,31 +2333,31 @@ DoOsFunRenameBigDir ROUT
; need to ensure that there's space
LDR R2, [SP, #BigDirObNameLen]; get the old name length
[ DebugX
[ DebugX :LOR: DebugXr
DREG R2, "From allocated name length: "
]
ADD R2, R2, #4
BIC R2, R2, #3 ; allocated length
[ DebugX
[ DebugX :LOR: DebugXr
DREG R2, "Old allocated name length:"
]
BL SkipTerm ;(R1->R0,R1)
LDR LR, [SP, #BigDirEntrySize]
[ DebugX
[ DebugX :LOR: DebugXr
DSTRING LR, "and: "
]
SUB R1, R1, LR ;new name length
STR R1, [SP, #BigDirEntrySize+4] ; store new name length
ADD R1, R1, #4
BIC R1, R1, #3 ;new required allocated length
[ DebugX
[ DebugX :LOR: DebugXr
DREG R1, "New required:"
]
SUBS R1, R1, R2 ;extra required
[ DebugX
[ DebugX :LOR: DebugXr
DREG R1, "Extra required for name:"
]
BLE %FT09 ;no extra needed
......@@ -2358,21 +2365,19 @@ DoOsFunRenameBigDir ROUT
TSTS R11, #DirBit
BEQ %FT08 ;if not moving a dir then no need to thingy
Push "R3"
Push "R1,R3"
MOV R3, R9
BL MaybeGrowBigDirForName ;(R1,R3->R0,V)
Pull "R3"
BVS %FT90
BL MaybeGrowBigDirForName ;(R1,R3->R0,R1,V)
STR R1, [SP, #BigDirLen+2*4]
Pull "R1,R3"
BVS %FT90
BL GetDir ; get the parent dir back
BVS %FT90 ; if error then error it is
; dir's length may have changed, so update our copy of the entry
LDR LR, [R8, #BigDirLen]
STR LR, [SP, #BigDirLen]
08
[ DebugX
[ DebugX :LOR: DebugXr
DLINE "Considering growing dir"
]
BL BigDirFreeSpace ; (R5->LR)
......@@ -2445,7 +2450,7 @@ DoOsFunRenameBigDir ROUT
LDR R7, [R5, #BigDirNameLen]
LDR R6, [SP, #8*4+BigDirEntrySize+4]
STR R6, [R5, #BigDirNameLen]
[ DebugX
[ DebugX :LOR: DebugXr
DREG R6, "new dir name length is:"
DREG R7, "old dir name length is:"
]
......@@ -2468,7 +2473,7 @@ DoOsFunRenameBigDir ROUT
ADD R0, R0, R7
ADD R1, R5, #BigDirHeaderSize
ADD R1, R1, R6
[ DebugX
[ DebugX :LOR: DebugXr
DREG R0, "src:"
DREG R1, "dst:"
DREG R2, "len:"
......@@ -2477,7 +2482,7 @@ DoOsFunRenameBigDir ROUT
MOV R1, R6
ADD R0, R5, #BigDirName
BL ZeroRam ; (R0, R1)
[ DebugX
[ DebugX :LOR: DebugXr
DREG R0, "zer:"
DREG R1, "len:"
]
......@@ -2499,6 +2504,9 @@ DoOsFunRenameBigDir ROUT
; Job: Fill in and write out new parent dir
;
Push "R1,LR"
[ DebugXr
DLINE "filling in and writing out new parent dir"
]
LDR R1, [SP,#2*4+BigDirEntrySize] ;new name final component
BL WriteBigName ;(R1,R4)
ADD R0, SP, #8 ;move copy of old dir entry back into new place
......@@ -2512,12 +2520,16 @@ DoOsFunRenameBigDir ROUT
]
BL SetIntAtts ;(R0,R3,R4) only needed for old format
BL IncObjSeqNum ;(R3-R5)
[ DebugXr
LDR lr, [r5, #BigDirEntries]
DREG lr, "entries: "
]
BL WriteDir ;(->R0,V)
Pull "R1,PC"
20 ; here when not in same dir
[ DebugX
[ DebugX :LOR: DebugXr
DLINE "renaming across (big) dirs"
]
......@@ -2528,23 +2540,45 @@ DoOsFunRenameBigDir ROUT
;
; Check not doing a duff rename
[ DebugXr
DLINE "check for duff rename"
]
MOV R1, R3 ;if renaming dir walk up new path pathname
[ DebugXr
DREG R3, "start from: "
DREG r9, "renaming: "
]
25
BL DiscAddToRec ;(R3->LR)
LDR R0, [LR,#RootDir]
TEQS R3, R0 ;if meet root dir
TEQNES R3, R7 ;or old parent dir
BEQ %FT30 ;then ok
[ DebugXr
DREG R3, "compare ",cc
DREG R9, "with "
]
TEQS R3, R9 ;but if meet dir to rename
MOVEQ R0, #BadRenameErr;then moan
BEQ %FT85
BL ToParent ;(R3,R6->R3)
[ DebugXr
DREG R3, "parent is:"
]
BL FindDir ;(R3->R0,R5,R6,V)
BVS %FT90
B %BT25
30
[ DebugXr
DLINE "rename OK"
]
MOV R3, R1 ;retreive new parent dir
BL GetDir ;(R3->R0,R5,R6,V)
[ DebugXr
DREG R3, "retrieving new parent dir: "
]
BVS %FT90
35
; If we're here then we're renaming something into a different directory
......@@ -2566,7 +2600,7 @@ DoOsFunRenameBigDir ROUT
ADD R2, R2, #4
BIC R2, R2, #3 ; allocated length
[ DebugX
[ DebugX :LOR: DebugXr
DREG R2, "Old allocated name length:"
DSTRING R1, "Start with name:"
]
......@@ -2577,22 +2611,22 @@ DoOsFunRenameBigDir ROUT
STR R1, [SP, #BigDirEntrySize+4] ; store new name length
ADD R1, R1, #4
BIC R1, R1, #3 ;new required allocated length
[ DebugX
[ DebugX :LOR: DebugXr
DREG R1, "New required:"
]
SUBS R1, R1, R2 ;extra required
[ DebugX
[ DebugX :LOR: DebugXr
DREG R1, "Extra required for name:"
]
BLE %FT38 ;no extra needed
TSTS R11, #DirBit
BNE %FT38 ; not a dir, so don't bother
BEQ %FT38 ; not a dir, so don't bother
Push "R3"
MOV R3, R9
BL MaybeGrowBigDirForName ;(R1,R3->R0,V)
BL MaybeGrowBigDirForName ;(R1,R3->R0,R1,V)
Pull "R3"
BVS %FT90
......@@ -2600,14 +2634,20 @@ DoOsFunRenameBigDir ROUT
BVS %FT90 ; if error then error it is
; dir's length may have changed, so update our copy of the entry
LDR LR, [R8, #BigDirLen]
STR LR, [SP, #BigDirLen]
STR R1, [SP, #BigDirLen]
[ DebugX :LOR: DebugXr
DREG R1, "Updated length is..."
]
38
; here, if child is a dir, then it's as big as needs be
TSTS R11,#1 :SHL: 31
BEQ %FT40
[ DebugXr
DLINE "renaming of shared object"
]
; If we're here then object being renamed is shared with something else. This
; means we've got to claim new space in the destination directory for it and copy
......@@ -2623,6 +2663,9 @@ DoOsFunRenameBigDir ROUT
MOVVC R1, R9
MOVVC R3, R10
BLVC DefaultMoveData ;(R1-R3->R0-R4,V)
[ DebugXr
DebugError "Error after DefaultMoveData: "
]
Pull "R3,R4,R11"
LDRVC R1, [SP, #BigDirEntrySize] ; get term again
......@@ -2637,11 +2680,29 @@ DoOsFunRenameBigDir ROUT
MOVVC R0, R6 ;adjust ind disc add to new value
BLVC WriteIndDiscAdd ;(R0,R3,R4)
BL InvalidateBufDir
[ DebugXr
DLINE "about to write target dir"
LDR lr, [r5, #BigDirEntries]
DREG lr, "entries: "
DREG r3, "In disc add in R3:"
BVC %FT01
DLINE "V set before WriteFsMapThenDir!"
01
]
BLVC WriteFsMapThenDir ;(->R0,V)
[ DebugXr
DebugError "error when writing fsmap then dir: "
]
BL UnlockMap
B %FT45
40
[ DebugXr
DLINE "renaming of unshared object"
]
LDR R1, [SP, #BigDirEntrySize] ; get term again
BL MakeBigDirSpace ;(R3-R6)
BL %BT15
......@@ -2649,6 +2710,11 @@ DoOsFunRenameBigDir ROUT
; Renaming object between directories and its already been placed in the
; destination.
[ DebugXr
DLINE "object now in destination dir"
]
MOVVC R1,R3
MOVVC R3, R7 ;old parent dir
BLVC GetDir ;(R3->R0,R5,R6,V)
MOVVC R4, R8
......@@ -2672,7 +2738,7 @@ DoOsFunRenameBigDir ROUT
MOV R3, R7
BL DecUsage ;(R3)
[ DebugX
[ DebugX :LOR: DebugXr
DLINE "<DoOsFunRenameBigDir"
]
Pull "R1-R11,PC"
......@@ -2686,8 +2752,18 @@ DoOsFunRenameBigDir ROUT
; R1 number of extra bytes required (word multiple)
; R3 ind disc add of dir to grow (isn't in dir buffer)
; exit:
; either:
; directory has been grown, R1 = new size of directory
; or:
; directory grow failed, R0 -> error block, V set
MaybeGrowBigDirForName ROUT
Push "R0-R11, LR"
Push "R0,R2-R11, LR"
[ DebugX
DLINE ">MaybeGrowBigDirForName"
......@@ -2708,10 +2784,15 @@ MaybeGrowBigDirForName ROUT
95
BL SetVOnR0
STRVS R0, [SP]
LDRVC R1, [R5, #BigDirSize] ; return new size of dir
[ DebugX
BVC %FT01
DREG R1, "New dir size: "
01
DebugError "Error from MaybeGrowBigDirForName: "
DLINE "<MaybeGrowBigDirForName"
]
Pull "R0-R11, PC"
Pull "R0,R2-R11, PC"
; =====================
......
......@@ -95,19 +95,19 @@ $a SETL F
MEND
Debug1 switch T ;communication with parent module
Debug1 switch F ;communication with parent module
Debug2 switch F ;SWI call processing
Debug2D switch F ;DiscOp SWI call processing
Debug3 switch F ;disc accesses
Debug3L switch F ;low level discops into parent
Debug4 switch T ;disc and drive record operations
Debug5 switch T ;old free space map operations
Debug6 switch T ;pathname and directory operations
Debug6f switch T ; FindDiscByName
Debug7 switch T ;OsFile operations
Debug4 switch F ;disc and drive record operations
Debug5 switch F ;old free space map operations
Debug6 switch F ;pathname and directory operations
Debug6f switch F ; FindDiscByName
Debug7 switch F ;OsFile operations
Debug8 switch F ;File Level Disc Ops
Debug9 switch F ;Misc useful routines
DebugA switch T ;OsFun operations
DebugA switch F ;OsFun operations
DebugB switch F ;Random access files
DebugBA switch F ;OS_Args specifically
DebugBE switch F ;BPut/BGet entry
......@@ -131,9 +131,9 @@ DebugH switch F ;terse file cache
DebugI switch F ;terse FIQ claim/release
DebugJ switch F ;file cache consistency checks
DebugK switch F ;setting of Interlocks
DebugL switch T ; Mounting/Identifying/Dismounting/Verifying
DebugLi switch T ; Changes to DiscId information in disc records
DebugLm switch T ; matching disc agianst other records
DebugL switch F ; Mounting/Identifying/Dismounting/Verifying
DebugLi switch F ; Changes to DiscId information in disc records
DebugLm switch F ; matching disc agianst other records
DebugM switch F ; MultiFS extensions
DebugMt switch F ; MultiFS extensions (terse)
DebugN switch F ; Disc insertion / request for insertion thread
......@@ -147,9 +147,10 @@ DebugDR switch F ; check array bounds on drive and disc record ptr calcul
DebugDL switch F ; check for data lost problems with atapi
DebugX switch F ; debug long filenames
DebugXg switch F ; debug long filenames - growin dirs
DebugXg switch T ; debug long filenames - growin dirs
DebugXm switch F ; debug long filenames - memory problems
DebugXb switch T ; debug long filenames - binary chop dir search
DebugXb switch F ; debug long filenames - binary chop dir search
DebugXr switch T ; debug long filenames - rename
DebugCW switch F ; debug write cacheing of dirs
......
......@@ -27,7 +27,7 @@
GetDir
Push "R0-R4,R7-R11,LR"
[ Debug6
[ Debug6 :LOR: DebugXr
DREG R3, "GetDir "
]
MOV R10,#0 ;FindDir/GetDir Flag
......
......@@ -1567,7 +1567,7 @@ WriteDirThenFsMap ROUT
; =================
WriteFsMapThenDir ROUT
[ Debug5
[ Debug5 ;:LOR: DebugXr
DLINE "WriteFsMapThenDir"
]
Push "R0-R11,LR"
......@@ -1575,6 +1575,9 @@ WriteFsMapThenDir ROUT
BL CriticalWriteFsMapThenDir
BL RestoreBreak
STRVS R0,[SP]
[ DebugXr :LAND: {FALSE}
DebugError "Error in WriteFsMapThenDir "
]
Pull "R0-R11,PC"
[ WriteCacheDir
......
......@@ -94,7 +94,7 @@ UserRootText ;nul names (if allowed) will be replaced by this
; ELSE C=1 if bit 7 set chars used
CheckPath
[ Debug6
[ Debug6 ;:LOR: DebugXr
DSTRING R1, "checkpath( ",cc
DREG R2, ",",cc
DLINE ")"
......@@ -2548,7 +2548,7 @@ MakeDirSpace ROUT
; exit: IF error V set, R0 result
WriteDir
[ Debug6
[ Debug6 ;:LOR: DebugXr
DLINE "enter WriteDir"
]
Push "R0-R11,LR"
......@@ -2561,7 +2561,7 @@ WriteDir
BL RestoreBreak
STRVS R0,[SP]
Pull "R0-R11,PC"
[ Debug6
[ Debug6 ;:LOR: DebugXr
DREG R0," ",cc
DLINE "leave WriteDir"
]
......
......@@ -863,6 +863,9 @@ RestoreBreak
CriticalWriteFsMap ROUT
StartCritical
[ DebugXr :LAND: {FALSE}
DLINE "CriticalWriteFsMap"
]
LDR R5, CritDiscRec
LDR R6, CritDrvRec
LDR R3, [R5,#RootDir]
......@@ -1073,6 +1076,10 @@ CriticalWriteFsMap ROUT
MOV R0, #0
95
STR R0, CritResult
[ DebugXr :LAND: {FALSE}
DREG R0, "out of CriticalWriteFsMap: "
DLINE "<CriticalWriteFsMap"
]
BL ExitCritical
; ----------------
......@@ -1085,6 +1092,9 @@ CriticalWriteFsMap ROUT
CriticalWriteDir ROUT
StartCritical
[ DebugXr :LAND: {FALSE}
DLINE ">CriticalWriteDir"
]
LDR R0, BufDir
CMPS R0, #-1
MOVNE R0, #0
......@@ -1097,6 +1107,9 @@ CriticalWriteDir ROUT
BEQ %FT99
|
sbaddr R5, DirBuffer
]
[ DebugXr :LAND: {FALSE}
DLINE "small dir"
]
BL TestDir ;(R3->LR,Z)
MOVEQ R9, #NewDirSize
......@@ -1144,6 +1157,9 @@ CriticalWriteDir ROUT
]
MOV R1, #WriteSecsOp:OR: Atomic
MOV R2, R3 ;disc add
[ DebugXr :LAND: {FALSE}
DREG r2, "Ind disc add of write dir: "
]
MOV R3, R5 ;RAM add
MOV R4, R9 ;length
BL IndDiscOp ;(R1-R4->R0,R3-R5)
......@@ -1151,11 +1167,18 @@ CriticalWriteDir ROUT
MOVVC R0,#0
95
STR R0, CritResult
[ DebugXr :LAND: {FALSE}
DREG R0, "Result:"
DLINE "<CriticalWriteDir"
]
BL ExitCritical
[ BigDir
99
; code for big dirs is different
[ DebugXr :LAND: {FALSE}
DLINE "big dir"
]
LDR R9, [R5, #BigDirSize]
ADD R6, R5, R9
BL IncDirSeqNum ; increment the master sequence numbers
......@@ -1192,6 +1215,12 @@ CriticalWriteDir ROUT
; now clear out any garbage in middle of dir
LDR R2, [R5, #BigDirEntries]
[ DebugXr :LAND: {FALSE}
DREG R2, "crit entries: "
ADD LR, R2, #BigDirName
DSTRING LR, "crit dir name: "
]
[ BigDirFix
ASSERT BigDirEntrySize=28
RSB R2, R2, R2, LSL #3 ;
......@@ -1261,6 +1290,9 @@ CriticalWriteFsMapThenDir ROUT
BL CriticalWriteFsMap
LDR R0, CritResult
BL SetVOnR0
[ DebugXr :LAND: {FALSE}
DebugError "Error from CriticalWriteFsMap: "
]
BLVC CriticalWriteDir