DIRECTORY BasicTime USING [GMT, nullGMT], File USING [Error, FP, GetProperties, Handle, PropertyStorage, RC, WriteProperties], FSBackdoor USING [ProduceError, Version], FSFileOps, FSReport USING [FileError], GVBasics USING [MakeKey, Password], PrincOps USING [ByteBltBlock], PrincOpsUtils USING [ByteBlt], Rope USING [Length, NewText, ROPE, Text]; FSPropertiesImpl: CEDAR MONITOR IMPORTS File, FSBackdoor, FSReport, GVBasics, PrincOpsUtils, Rope EXPORTS FSFileOps = BEGIN PropertiesObject: TYPE = RECORD [ validation: GVBasics.Password, bytes: INT, keep: CARDINAL, created: BasicTime.GMT, version: FSBackdoor.Version, nameBody: TextRep]; TextRep: TYPE = RECORD[length: CARDINAL, chars: PACKED ARRAY [0 .. 0) OF CHARACTER]; Properties: TYPE = LONG POINTER TO PropertiesObject; GetProps: PUBLIC PROC [f: File.Handle] RETURNS [bytes: INT, keep: CARDINAL, created: BasicTime.GMT] = BEGIN InnerGet: ENTRY PROC = TRUSTED BEGIN ENABLE UNWIND => NULL; pPtr: Properties = LOOPHOLE[File.GetProperties[f], Properties]; IF pPtr.validation = validation THEN BEGIN bytes _ pPtr.bytes; keep _ pPtr.keep; created _ pPtr.created; END ELSE invalidPP _ TRUE; -- invalid property page END; fileRC: File.RC _ ok; invalidPP: BOOLEAN _ FALSE; InnerGet[ ! File.Error => {fileRC _ why; CONTINUE} ]; IF invalidPP THEN InvalidPropertyPage[]; IF fileRC # ok THEN FSReport.FileError[fileRC]; END; GetNameBodyAndVersion: PUBLIC PROC [f: File.Handle] RETURNS [nameBody: Rope.Text, version: FSBackdoor.Version] = BEGIN InnerGetNameBodyAndVersion: ENTRY PROC = TRUSTED BEGIN ENABLE UNWIND => NULL; pPtr: Properties = LOOPHOLE[File.GetProperties[f], Properties]; IF pPtr.validation = validation THEN BEGIN nameBody _ GetText[@pPtr.nameBody]; version _ pPtr.version; END ELSE invalidPP _ TRUE; -- invalid property page END; fileRC: File.RC _ ok; invalidPP: BOOLEAN _ FALSE; InnerGetNameBodyAndVersion[ ! File.Error => {fileRC _ why; CONTINUE} ]; IF invalidPP THEN InvalidPropertyPage[]; IF fileRC # ok THEN FSReport.FileError[fileRC]; END; InitializePropertyStorage: PUBLIC PROC [fp: File.FP, propStorage: File.PropertyStorage] = TRUSTED { LOOPHOLE[propStorage, Properties].validation _ validation }; SetProps: PUBLIC PROC [f: File.Handle, bytes: INT, keep: CARDINAL, created: BasicTime.GMT, nameBody: Rope.Text, version: FSBackdoor.Version] = BEGIN InnerSet: ENTRY PROC = TRUSTED BEGIN ENABLE UNWIND => NULL; pPtr: Properties = LOOPHOLE[File.GetProperties[f], Properties]; IF pPtr.validation = validation THEN BEGIN IF bytes # -1 THEN pPtr.bytes _ bytes; pPtr.keep _ keep; IF created # BasicTime.nullGMT THEN pPtr.created _ created; pPtr.version _ version; PutText[nameBody, @(pPtr.nameBody)]; File.WriteProperties[f]; END ELSE invalidPP _ TRUE; -- invalid property page here is a bug END; fileRC: File.RC _ ok; invalidPP: BOOLEAN _ FALSE; InnerSet[ ! File.Error => {fileRC _ why; CONTINUE} ]; IF invalidPP THEN ERROR; IF fileRC # ok THEN FSReport.FileError[fileRC]; END; SetBytesAndCreated: PUBLIC PROC [f: File.Handle, bytes: INT, created: BasicTime.GMT] = BEGIN InnerSetBytesAndCreated: ENTRY PROC = TRUSTED BEGIN ENABLE UNWIND => NULL; pPtr: Properties = LOOPHOLE[File.GetProperties[f], Properties]; IF pPtr.validation = validation THEN BEGIN IF bytes # -1 THEN pPtr.bytes _ bytes; IF created # BasicTime.nullGMT THEN pPtr.created _ created; File.WriteProperties[f]; END ELSE invalidPP _ TRUE; -- invalid property page END; fileRC: File.RC _ ok; invalidPP: BOOLEAN _ FALSE; InnerSetBytesAndCreated[ ! File.Error => {fileRC _ why; CONTINUE} ]; IF invalidPP THEN InvalidPropertyPage[]; IF fileRC # ok THEN FSReport.FileError[fileRC]; END; SetKeep: PUBLIC PROC [f: File.Handle, keep: CARDINAL] = BEGIN InnerSetKeep: ENTRY PROC = TRUSTED BEGIN ENABLE UNWIND => NULL; pPtr: Properties = LOOPHOLE[File.GetProperties[f], Properties]; IF pPtr.validation = validation THEN BEGIN pPtr.keep _ keep; File.WriteProperties[f]; END ELSE invalidPP _ TRUE; -- invalid property page END; fileRC: File.RC _ ok; invalidPP: BOOLEAN _ FALSE; InnerSetKeep[ ! File.Error => {fileRC _ why; CONTINUE} ]; IF invalidPP THEN InvalidPropertyPage[]; IF fileRC # ok THEN FSReport.FileError[fileRC]; END; InvalidPropertyPage: PROC = { FSBackdoor.ProduceError[invalidPropertyPage, "The property page of a file on the local volume has an unrecognizable property page format."] }; GetText: PROC [tR: LONG POINTER TO TextRep] RETURNS [t: Rope.Text] = TRUSTED BEGIN IF tR.length = 0 THEN t _ NIL ELSE BEGIN t _ Rope.NewText[tR.length]; LOOPHOLE[t, LONG POINTER TO CARDINAL]^ _ tR.length; -- sets t.length [] _ PrincOpsUtils.ByteBlt[ to: [BASE[DESCRIPTOR[t]], 0, tR.length], from: [@tR.chars, 0, tR.length] ]; END; END; PutText: PROC [t: Rope.Text, tR: LONG POINTER TO TextRep] = TRUSTED BEGIN tR.length _ Rope.Length[t]; [] _ PrincOpsUtils.ByteBlt[ to: [@tR.chars, 0, tR.length], from: [BASE[DESCRIPTOR[t]], 0, tR.length] ]; END; validation: GVBasics.Password _ ALL[0]; ComputeValidation: PROC = BEGIN stamp: Rope.ROPE = "August 19, 1983 1:16 pm"; -- DON'T CHANGE THIS!!! -- validation _ GVBasics.MakeKey[stamp]; END; ComputeValidation[]; END.  FSPropertiesImpl.mesa Last Edited by: Schroeder, November 15, 1983 1:36 pm Last Edited by: Levin, September 22, 1983 1:04 pm Exported to FSFileOps Internal procedures Validation stuff for leader pages; changing the stamp will require all nucleus volumes to be erased. Start code. Κš– "Cedar" style˜Icode2™K™4K™1code1šΟk ˜ Lšœ œœ ˜Lšœœ œ*œ˜TLšœ œ˜)Lšœ ˜ Lšœ œ ˜Lšœ œ˜#Lšœ œ˜Lšœœ ˜Lšœœœ˜)—šœœ˜Lšœ:˜ALšœ ˜Lšœ˜šœœœ˜!Kšœ˜Kšœœ˜ Kšœœ˜Kšœœ˜Kšœ˜Kšœ˜—šœ œœ œ œœ œ œ˜TK˜—Kš œ œœœœ˜4—™šΟnœœœœ œœœ˜eKš˜šžœœœ˜Kšœœœœ˜Kšœœ$˜?Kšœ˜šœ˜ Kšœ˜Kšœ˜Kšœ˜Kš˜—Kšœ œΟc˜/Kšœ˜—Kšœ œ˜Kšœ œœ˜Kšœ)œ˜5Kšœ œ˜(Kšœ œ˜/Kšœ˜—šžœœœœ5˜pKš˜šžœœœ˜0Kšœœœœ˜Kšœœ$˜?Kšœ˜šœ˜ Kšœ#˜#Kšœ˜Kš˜—Kšœ œŸ˜/Kšœ˜—Kšœ œ˜Kšœ œœ˜šœ˜Kšœœ˜+—Kšœ œ˜(Kšœ œ˜/Kšœ˜—š žœœœ œ'˜aKšœœ4˜>—š žœœœœœœ5˜ŽKš˜šžœœœ˜Kšœœœœ˜Kšœœ$˜?Kšœ˜šœ˜ Kšœ œ˜&Kšœ˜Kšœœ˜;Kšœ˜Kšœ$˜$K˜Kš˜—Kšœ œŸ&˜=Kšœ˜—Kšœ œ˜Kšœ œœ˜Kšœ)œ˜5Kšœ œœ˜Kšœ œ˜/Kšœ˜—š žœœœœœ˜VKš˜šžœœœ˜-Kšœœœœ˜Kšœœ$˜?Kšœ˜šœ˜ Kšœ œ˜&Kšœœ˜;Kšœ˜Kš˜—Kšœ œŸ˜/Kšœ˜—Kšœ œ˜Kšœ œœ˜Kšœ8œ˜DKšœ œ˜(Kšœ œ˜/Kšœ˜—šžœœœœ˜7Kš˜šž œœœ˜"Kšœœœœ˜Kšœœ$˜?Kšœ˜šœ˜ Kšœ˜Kšœ˜Kš˜—Kšœ œŸ˜/Kšœ˜—Kšœ œ˜Kšœ œœ˜Kšœ-œ˜9Kšœ œ˜(Kšœ œ˜/Kšœ˜——™šœœ˜Kšœ‘˜‘—š žœœœœœ œ˜LKš˜Kšœ˜Kšœ˜ šœœ˜ Kšœ˜Kš œœœœœŸ˜Dšœ˜Kšœœ œ˜(Kšœ˜Kšœ˜—Kšœ˜—Kšœ˜—š žœœœœœ ˜CKš˜K˜šœ˜Kšœ˜Kšœœ œ˜)Kšœ˜—Kšœ˜——™eKšœ œ˜'šžœœ˜Kš˜Kšœ œŸ˜HKšœ%˜%Kšœ˜——™ Kšœ˜—Kšœ˜—…—ά–