Commit e2242870 authored by Jeffrey Lee's avatar Jeffrey Lee Committed by ROOL
Browse files

[480] Make use of fsfile_ReadInfoNoLen

Update EnsureCanonicalObject so that it can optionally skip reading the
file/object length, based on the new argument R7. Then trace back
through the callers to have them pass in an appropriate value based on
whether they care about the length or not.

TopPath_DoBusinessToPath has also gained a new flag bit to suppress
reading the length, but so far I've only updated DoThePath to use it.

Result: If you have a file in PipeFS which is open for writing, and then
attempt to open it for reading using OS_Find, it'll now open immediately
instead of PipeFS trying to block/sleep until it's no longer open for
writing.

Why: Since at least as far back as RISC OS 3.6, PipeFS tries to sleep
inside fsfile_ReadInfo if the file is open for writing. But a
combination of buggy sleep logic and TaskWindow's lazy approach to
UpCall 6 meant that (prior to TaskWindow 0.65) it wouldn't sleep for
long and would instead allow the open to proceed while the file is still
open for write. The ab...
parent d64fdb08
...@@ -9,12 +9,12 @@ ...@@ -9,12 +9,12 @@
GBLS Module_ApplicationDate GBLS Module_ApplicationDate
GBLS Module_HelpVersion GBLS Module_HelpVersion
GBLS Module_ComponentName GBLS Module_ComponentName
Module_MajorVersion SETS "2.89" Module_MajorVersion SETS "2.90"
Module_Version SETA 289 Module_Version SETA 290
Module_MinorVersion SETS "" Module_MinorVersion SETS ""
Module_Date SETS "24 Dec 2022" Module_Date SETS "23 Jan 2023"
Module_ApplicationDate SETS "24-Dec-22" Module_ApplicationDate SETS "23-Jan-23"
Module_ComponentName SETS "FileSwitch" Module_ComponentName SETS "FileSwitch"
Module_FullVersion SETS "2.89" Module_FullVersion SETS "2.90"
Module_HelpVersion SETS "2.89 (24 Dec 2022)" Module_HelpVersion SETS "2.90 (23 Jan 2023)"
END END
/* (2.89) /* (2.90)
* *
* This file is automatically maintained by srccommit, do not edit manually. * This file is automatically maintained by srccommit, do not edit manually.
* *
*/ */
#define Module_MajorVersion_CMHG 2.89 #define Module_MajorVersion_CMHG 2.90
#define Module_MinorVersion_CMHG #define Module_MinorVersion_CMHG
#define Module_Date_CMHG 24 Dec 2022 #define Module_Date_CMHG 23 Jan 2023
#define Module_MajorVersion "2.89" #define Module_MajorVersion "2.90"
#define Module_Version 289 #define Module_Version 290
#define Module_MinorVersion "" #define Module_MinorVersion ""
#define Module_Date "24 Dec 2022" #define Module_Date "23 Jan 2023"
#define Module_ApplicationDate "24-Dec-22" #define Module_ApplicationDate "23-Jan-23"
#define Module_ComponentName "FileSwitch" #define Module_ComponentName "FileSwitch"
#define Module_FullVersion "2.89" #define Module_FullVersion "2.90"
#define Module_HelpVersion "2.89 (24 Dec 2022)" #define Module_HelpVersion "2.90 (23 Jan 2023)"
#define Module_LibraryVersionInfo "2:89" #define Module_LibraryVersionInfo "2:90"
...@@ -1192,9 +1192,10 @@ ResolveWildcardBySteam Entry "r1,r3,r4,r5,r6,r7" ...@@ -1192,9 +1192,10 @@ ResolveWildcardBySteam Entry "r1,r3,r4,r5,r6,r7"
; Out r2 = RMAlloced resolved wildcard, or NULL if not found ; Out r2 = RMAlloced resolved wildcard, or NULL if not found
; ;
ResolveWildcard Entry "r0,r1,r2,r3,r4,r5,fscb" ResolveWildcard Entry "r0,r1,r2,r3,r4,r5,r7,fscb"
; Ensure the directory exists, but don't care about it's attributes ; Ensure the directory exists, but don't care about it's attributes
MOV r7, #fsfile_ReadInfoNoLen
BL EnsureCanonicalObject BL EnsureCanonicalObject
BLVC AssessDestinationForPathTailForDirRead BLVC AssessDestinationForPathTailForDirRead
EXIT VS EXIT VS
......
...@@ -423,6 +423,7 @@ ReadDir Entry "r0-r9,fscb", ReadDir_LocalSize ...@@ -423,6 +423,7 @@ ReadDir Entry "r0-r9,fscb", ReadDir_LocalSize
MOV r3, #0 ; @-relativity MOV r3, #0 ; @-relativity
ADR r6, ReadDir_Special ADR r6, ReadDir_Special
LDR fscb, [sp, #Proc_LocalStack + 10*4] LDR fscb, [sp, #Proc_LocalStack + 10*4]
MOV r7, #fsfile_ReadInfoNoLen
BL EnsureObjectCommon BL EnsureObjectCommon
BVS %FT90 BVS %FT90
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
; ;
; In r1 = path^ with absolutes resolved and no wildcards ; In r1 = path^ with absolutes resolved and no wildcards
; r6 = special field^/scb^ ; r6 = special field^/scb^
; r7 = Operation to perform (fsfile_ReadInfo or fsfile_ReadInfoNoLen)
; fscb ; fscb
; ;
; Out r0 = Object type of end object ; Out r0 = Object type of end object
...@@ -85,6 +86,7 @@ EnsureCanonicalObject EntryS "r7,r8,r9" ...@@ -85,6 +86,7 @@ EnsureCanonicalObject EntryS "r7,r8,r9"
01 01
] ]
FramLDR r0,,r7
BL SimpleReadCatalogueInfo BL SimpleReadCatalogueInfo
[ debugensure [ debugensure
DSTRING r1, "Resulting tail is " DSTRING r1, "Resulting tail is "
...@@ -161,6 +163,7 @@ EnsureCanonicalObject EntryS "r7,r8,r9" ...@@ -161,6 +163,7 @@ EnsureCanonicalObject EntryS "r7,r8,r9"
; In r1 = path^^ ; In r1 = path^^
; r3 = relativity indicator (0=>@; <>0=>%) ; r3 = relativity indicator (0=>@; <>0=>%)
; r6 = special field^^ ; r6 = special field^^
; r7 = Op to perform (fsfile_ReadInfo or fsfile_ReadInfoNoLen)
; fscb ; fscb
; ;
; Out r0 = Object type of end object ; Out r0 = Object type of end object
...@@ -175,7 +178,7 @@ EnsureCanonicalObject EntryS "r7,r8,r9" ...@@ -175,7 +178,7 @@ EnsureCanonicalObject EntryS "r7,r8,r9"
; The performs a similar function to AssessDestinationForPath, except it ; The performs a similar function to AssessDestinationForPath, except it
; ensures the end object exists/doesn't exist. ; ensures the end object exists/doesn't exist.
; ;
EnsureObjectCommon Entry "r7" EnsureObjectCommon Entry
[ debugensure [ debugensure
Push "r1,r6" Push "r1,r6"
...@@ -515,7 +518,8 @@ AssessDestinationForPathTailForDirRead Entry "r2,r3,scb" ...@@ -515,7 +518,8 @@ AssessDestinationForPathTailForDirRead Entry "r2,r3,scb"
; ;
; SimpleReadCatalogueInfo ; SimpleReadCatalogueInfo
; ;
; In r1 = path^ to perform action on ; In r0 = operation to perform (fsfile_ReadInfo or fsfile_ReadInfoNoLen)
; r1 = path^ to perform action on
; r6 = special field^/scb^ ; r6 = special field^/scb^
; fscb for path ; fscb for path
; ;
...@@ -542,7 +546,11 @@ SimpleReadCatalogueInfo Entry ...@@ -542,7 +546,11 @@ SimpleReadCatalogueInfo Entry
; Get ifscb and file handle as necessary ; Get ifscb and file handle as necessary
BL AssessDestinationForPath BL AssessDestinationForPath
MOV r0, #fsfile_ReadInfo ; Fall back to fsfile_ReadInfo if fsfile_ReadInfoNoLen not supported
TEQ r0, #fsfile_ReadInfoNoLen
LDREQ lr, [fscb, #fscb_info]
TSTEQ lr, #fsinfo_fsfilereadinfonolen
MOVEQ r0, #fsfile_ReadInfo
BL CallFSFile_Given BL CallFSFile_Given
; If all OK, then adjust the objecttype ; If all OK, then adjust the objecttype
......
...@@ -1356,7 +1356,10 @@ CopyDirectory Entry ...@@ -1356,7 +1356,10 @@ CopyDirectory Entry
; Ensure we're set up for this object ; Ensure we're set up for this object
BL Copy_PromptDest BL Copy_PromptDest
Push "r7"
MOV r7, #fsfile_ReadInfoNoLen
BL EnsureCanonicalObject BL EnsureCanonicalObject
Pull "r7"
CMP r0, #object_file CMP r0, #object_file
BHI %FT20 ; If a dir, don't ask to recreate BHI %FT20 ; If a dir, don't ask to recreate
...@@ -1459,7 +1462,7 @@ CopyDirectory Entry ...@@ -1459,7 +1462,7 @@ CopyDirectory Entry
; VC, EQ: copy file ; VC, EQ: copy file
; VC, NE: don't copy file ; VC, NE: don't copy file
CopyFile_EnsureDestFileWriteable Entry CopyFile_EnsureDestFileWriteable Entry "r7"
[ debugcopy [ debugcopy
BL %FT00 BL %FT00
...@@ -1491,6 +1494,7 @@ CopyFile_EnsureDestFileWriteable Entry ...@@ -1491,6 +1494,7 @@ CopyFile_EnsureDestFileWriteable Entry
DREG r6, "scb/special is " DREG r6, "scb/special is "
DREG fscb, "fscb is " DREG fscb, "fscb is "
] ]
MOVVC r7, #fsfile_ReadInfoNoLen
BLVC EnsureCanonicalObject BLVC EnsureCanonicalObject
EXIT VS EXIT VS
......
...@@ -945,7 +945,10 @@ Util_IntoDirectory ROUT ...@@ -945,7 +945,10 @@ Util_IntoDirectory ROUT
STR r14, util_totalsize + 4 STR r14, util_totalsize + 4
LDMIA r7, {r1,r6,fscb} LDMIA r7, {r1,r6,fscb}
Push "r7"
MOV r7, #fsfile_ReadInfoNoLen
BL EnsureCanonicalObject BL EnsureCanonicalObject
Pull "r7"
BLVC AssessDestinationForPathTailForDirRead BLVC AssessDestinationForPathTailForDirRead
EXIT VS EXIT VS
STMIB r7, {r6, fscb} STMIB r7, {r6, fscb}
......
...@@ -347,7 +347,7 @@ DoTheOpen ...@@ -347,7 +347,7 @@ DoTheOpen
ADR r0, PassedFilename ADR r0, PassedFilename
ADR r4, FullFilename ADR r4, FullFilename
MOV r5, #0 MOV r5, #TopPath_NoLen
AND r14, r7, #open_write :OR: open_read AND r14, r7, #open_write :OR: open_read
TEQ r14, #open_write TEQ r14, #open_write
ORREQ r5, r5, #TopPath_NoMultiParts ORREQ r5, r5, #TopPath_NoMultiParts
......
...@@ -59,6 +59,8 @@ ...@@ -59,6 +59,8 @@
; 7 For EnsureThingIsDirectory. This causes entry into a partition ; 7 For EnsureThingIsDirectory. This causes entry into a partition
; if a partition itself is specified. DoBusinessToPath ignores ; if a partition itself is specified. DoBusinessToPath ignores
; this flag bit. ; this flag bit.
; 8 File length not required (use fsfile_ReadInfoNoLen if
; possible)
; r6 = Place to put linked special field ; r6 = Place to put linked special field
; ;
; Out ; Out
...@@ -82,6 +84,7 @@ TopPath_DontMindNuls * 1:SHL:4 ...@@ -82,6 +84,7 @@ TopPath_DontMindNuls * 1:SHL:4
TopPath_Canonicalise * 1:SHL:5 TopPath_Canonicalise * 1:SHL:5
TopPath_NoWildCards * 1:SHL:6 TopPath_NoWildCards * 1:SHL:6
TopPath_WantPartition * 1:SHL:7 TopPath_WantPartition * 1:SHL:7
TopPath_NoLen * 1:SHL:8
^ 0, sp ^ 0, sp
FSPath_Context # 4 FSPath_Context # 4
...@@ -323,7 +326,13 @@ TopPath_DoBusinessToPathFSPrefix Entry "r0-r9",:INDEX:TopPath_ContextSize ...@@ -323,7 +326,13 @@ TopPath_DoBusinessToPathFSPrefix Entry "r0-r9",:INDEX:TopPath_ContextSize
B %FT60 B %FT60
40 40
LDR r14, [sp, #Proc_LocalStack + 5*4]
TST r14, #TopPath_NoLen
Push "r7"
MOVEQ r7, #fsfile_ReadInfo
MOVNE r7, #fsfile_ReadInfoNoLen
BL EnsureObjectCommon ; (r1,r6,fscb)->(r0-r6,fscb) BL EnsureObjectCommon ; (r1,r6,fscb)->(r0-r6,fscb)
Pull "r7"
[ debugpath [ debugpath
BVC %FT01 BVC %FT01
DLINE "Error from EnsureObjectCommon" DLINE "Error from EnsureObjectCommon"
...@@ -383,7 +392,13 @@ TopPath_DoBusinessToPathFSPrefix Entry "r0-r9",:INDEX:TopPath_ContextSize ...@@ -383,7 +392,13 @@ TopPath_DoBusinessToPathFSPrefix Entry "r0-r9",:INDEX:TopPath_ContextSize
[ debugheapK [ debugheapK
CheckLinkedHeapBlock r1,F CheckLinkedHeapBlock r1,F
] ]
LDR r14, [sp, #Proc_LocalStack + 5*4]
TST r14, #TopPath_NoLen
Push "r7"
MOVEQ r7, #fsfile_ReadInfo
MOVNE r7, #fsfile_ReadInfoNoLen
BL EnsureCanonicalObject BL EnsureCanonicalObject
Pull "r7"
BVS %FT70 ; Once again go around for another go if bad BVS %FT70 ; Once again go around for another go if bad
; Reject anything but pure files ; Reject anything but pure files
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment