mac-rom/OS/HFS/MFSRFN1.a
Elliot Nunn 4325cdcc78 Bring in CubeE sources
Resource forks are included only for .rsrc files. These are DeRezzed into their data fork. 'ckid' resources, from the Projector VCS, are not included.

The Tools directory, containing mostly junk, is also excluded.
2017-12-26 09:52:23 +08:00

125 lines
4.4 KiB
Plaintext

;
; File: MFSRFN1.a
;
; Contains: This file contains routines for MFS cache I/O.
;
; Copyright: © 1982-1991 by Apple Computer, Inc., all rights reserved.
;
; Change History (most recent first):
;
; <2> 9/12/91 JSM Add a header.
; <1.1> 11/10/88 CCH Fixed Header.
; <1.0> 11/9/88 CCH Adding to EASE.
; <1.0> 2/11/88 BBM Adding file for the first time into EASEÉ
; 10/1/85 LAK Most code moved to Cache and TFSRfn1.
; 9/6/85 LAK Tag data Time field is now set correctly. Call MFSRWSub instead
; of MyRWSub since D3 disk block is word length for MFS.
; 8/15/85 PWD Added code to save A6 before ,ASYNC calls
; 7/1/85 PWD Changed to use A6 stack to save context
; 3/1/85 GJC Limited MFS to portions of routines not handled by TFS
; 6/27/84 GSS Put in line the WrPart patch from MSFileFix
; 8/30/83 LAK Removed redundant set of FCB dirty bit in FileWrite (gets set by
; AdjEOF).
; 8/15/83 LAK Flushes file buffer now if block is dirty and falls within
; read-in-place . . . saved some bytes, too.
; 8/11/83 LAK Added support for a read-verify mode.
; 8/2/83 LAK Fixed read bug (read count 0 with position past EOF). Changed
; file positioning mode 2 (relative to end of file) by defining
; IOPosOffset to be either positive or negative . . .
; 6/2/83 LAK Changes for FCBBfAdr=0 meaning use volume buffer.
; 2/10/83 LAK Fixed bugs in Read with EOL character.
; 2/9/83 LAK Fixed MyWriteIP bug (now invalidates file's buffer if it happens
; to write that block . . .)
; 1/17/83 LAK Latest changes for final structures. Brought SetFPos and GetFPos
; here from FSRFN2. Made GetFPos and SetFPos call FileRead with
; zero bytes requested.
; 12/14/82 LAK Rewrote for new file system data structures.
;
;_______________________________________________________________________
;
; External Routines: None
;
; Internal Routines: MFSRd1stDB,MFSRdNxtDB,MFSDirRead,MFSMapRead,MFSVolRead.
;
;_______________________________________________________________________
;
;_______________________________________________________________________
;
; Routine: MFSRd1stDB,MFSRdNxtDB
; Arguments: A2.L (input) -- VCB ptr
; D0.W (output) -- error code
; A5.L (output) -- ptr to buffer
; Clobbers: D4,A6
; Preserves: D1,D2,D5,D6,D7,A0,A1,A2,A3,A4
; others: see MyReadDB
; Calls: MyReadDB,GetCurBlk
; Called By: FndFilNam,FndFilSpc
; Function: These two routines are used when scanning through a volume
; directory for a filename or for space. Rd1stDB must be
; called for the first block as it sets up certain lomem
; variables (MaxDB). RdNxtDB is called for
; remaining blocks (if any).
;
;_______________________________________________________________________
; Called By: MFSMount (consistency check)
; FndMFSFile (directory search)
; FndFilSpc (looking for space for Create, Rename)
MFSRd1stDB:
BLANKS ON
STRING ASIS
MOVE.W VCBBlLn(A2),D0 ; len in blocks of dir
MOVE.W VCBDirSt(A2),D3 ; starting block of dir on disk
ADD.W D3,D0 ; make D4=ptr to last dir blk+1
MOVE.W D0,MaxDB ; max DB block + 1
BRA.S MFSDirRead
; A2=VCB ptr
; MaxDB=last DB+1
; NxtDB=next DB to check
MFSRdNxtDB:
MOVE.W CurDB,D3 ; next block to read
ADDQ.W #1,D3 ; and increment this field
CMP.W MaxDB,D3 ; past the last block?
BCS.S MFSDirRead ; br if not
MOVEQ #DirFulErr,D0 ; the directory may be full
RTS
; Called By: MFSCLose (find block for update)
; MFSRd1stDB, MFSRdNxtDB (directoy searches)
MFSDirRead:
MOVE.W D3,CurDB ; save current directory block <01Oct85>
BSR ReadBlock
MOVE.L SysCtlCPtr,A1 ; catalog blk read: MFS catalog blks <01Oct85>
BRA.S MFSMapR2
; Function: Get a volume map/master directory block.
; Called By: MFSMount
MFSVolRead
BSR ReadBlock ; use common code, pass ptr to next inst
BRA.S MFSMapR1 ; share code with map read
; Function: Get a volume map/master directory block without reading it first.
; Called By: MFSFlush
MFSMapRead:
BSR ReadBlock ; use common code, pass ptr to next inst
MOVEQ #kGBNoRead,D1 ; don't bother to read it <01Oct85>
MFSMapR1:
MOVE.L SysVolCPtr,A1 ; Use volume cache for MFS vol reads <01Oct85>
MFSMapR2:
MOVEQ #0,D2 ; clear high word
MOVE.W D3,D2 ; block number <01Oct85>
MOVE.W VCBVRefNum(A2),D0 ; volume refnum <01Oct85>
RTS ; return to ReadBlock <01Oct85>