fs

package
v0.0.0-...-4b6a73b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 11, 2023 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const BlockDataSize = 1024
View Source
const BlockHeaderSize = 32
View Source
const MaxLogicalVolumes = 10

Variables

View Source
var (
	UIDpvlabel  = UID{0x0200, 0x0000}
	UIDlvlabel  = UID{0x0201, 0x0000}
	UIDvtoc     = UID{0x0202, 0x0000}
	UIDbat      = UID{0x0203, 0x0000}
	UIDvtoc_bkt = UID{0x0204, 0x000}

	UIDrecords        = UID{0x0300, 0x0000}
	UIDhdr_undef      = UID{0x0301, 0x0000}
	UIDobject_file    = UID{0x0302, 0x0000}
	UIDundef          = UID{0x0304, 0x0000}
	UIDpad            = UID{0x0305, 0x0000}
	UIDroot           = UID{0x0308, 0x0000}
	UIDinput_pad      = UID{0x0309, 0x0000}
	UIDsio            = UID{0x030a, 0x0000}
	UIDddf            = UID{0x030b, 0x0000}
	UIDmbx            = UID{0x030c, 0x0000}
	UIDnulldev        = UID{0x030d, 0x0000}
	UIDd3m_area       = UID{0x030e, 0x0000}
	UIDd3m_sch        = UID{0x030f, 0x0000}
	UIDpipe           = UID{0x0310, 0x0000}
	UIDuasc           = UID{0x0311, 0x0000}
	UIDdirectory      = UID{0x0312, 0x0000}
	UIDunix_directory = UID{0x0313, 0x0000}
	UIDmt             = UID{0x0314, 0x0000}
	UIDsysboot        = UID{0x0315, 0x0000}
)

some canned UIDs from the docs that we recognize further down in String()

Functions

This section is empty.

Types

type BATHeader

type BATHeader struct {
	NumBlocksRepresented  int32
	NumFreeBlocks         int32
	FirstBATBlockDAddr    DAddr
	BlockNumOfFirstBATBit DAddr
	VolumeTrouble         uint16
	Unused1               int16
	BatStep               uint32
	Unused2               [8]byte // padding to get us to 32 bytes
}

func (BATHeader) Print

func (h BATHeader) Print()

type BATManager

type BATManager struct {
	// contains filtered or unexported fields
}

func NewBATManager

func NewBATManager(lvol *LogicalVolume) *BATManager

func (*BATManager) AllocateBlock

func (bm *BATManager) AllocateBlock() (DAddr, error)

type Block

type Block struct {
	Header BlockHeader
	Data   [1024]byte // must match BlockDataSize above
}

func NewBlock

func NewBlock(header BlockHeader, data any) Block

func (*Block) Print

func (b *Block) Print(includeContents bool, raw bool)

func (*Block) ReadInto

func (b *Block) ReadInto(data any) error

type BlockHeader

type BlockHeader struct {
	ObjectUID        UID
	PageWithinObject int32
	LastWritten      int32

	BlockSystemTypes int32
	Ignore1          int32
	Ignore2          int16
	DataChecksum     int16
	PVBlockDAddr     DAddr
}

func (*BlockHeader) BlockType

func (bh *BlockHeader) BlockType() int

func (*BlockHeader) Print

func (h *BlockHeader) Print()

func (*BlockHeader) SystemType

func (bh *BlockHeader) SystemType() int

type BlockReadable

type BlockReadable interface {
	FromReader(*bytes.Reader) error
}

type DAddr

type DAddr uint32

type Dir

type Dir struct {
	// dont-care-for-now [0x84]byte
	Entries []DirEntry
}

func (*Dir) FromReader

func (d *Dir) FromReader(r *bytes.Reader) error

type DirEntry

type DirEntry struct {
	EntryType uint8 // 0x*2 = file.  0x*4 = symlink
	// nameLength uint8
	LinkTextLength uint16
	// unknown2   uint32
	Name string

	UID      UID    // entry type == 0x*2
	LinkText string // entry type == 0x*4
}

looks like 10.4 filesystem has the following format per entry

[0] uint8 .version [1] uint8 .name_length [2] uint8 .unknown (entry type?) [3] uint8 .unknown (entry length?) [4] uid_t .uid (not sure what. it's the same for all entries it seems) [5]

func (*DirEntry) FromReader

func (de *DirEntry) FromReader(r *bytes.Reader) error

func (*DirEntry) HasLinkText

func (de *DirEntry) HasLinkText() bool

func (*DirEntry) HasUID

func (de *DirEntry) HasUID() bool

type DirEntrySR9

type DirEntrySR9 struct {
	Name              [32]byte
	NetworkNumberHint uint16
	Unused            uint16
	Reserved          uint16
	EntryType         uint8
	Length            uint8
	Rest              [8]byte
}

func (DirEntrySR9) UID

func (de DirEntrySR9) UID() (UID, error)

type DirInformationBlock

type DirInformationBlock struct {
	MBZ          uint8
	Version      uint8
	TotalLength  uint16
	HeaderLength uint16
	MBZ2         uint16

	DefaultDirectoryACL UID
	DefaultFileACL      UID

	// rest is unused
	Padding [24]byte
}

type DirSR9

type DirSR9 struct {
	Version         uint16
	HashValue       uint16
	LastSize        uint16
	PoolSize        uint16
	EntriesPerBlock uint16
	HighBlock       uint16
	FreeChain       uint16
	ParentUID       UID
	EntryCount      uint16
	MaxCount        uint16
	Linear          [18]DirEntry
	InfoBlock       DirInformationBlock
	HashThreads     [43]uint16
	EntryBlockPool  [429]uint16
}

type DriveType

type DriveType struct {
	DType          int16
	Name           string
	Cylinders      int16
	Heads          int16
	BlocksPerTrack int16
}

func GetDriveType

func GetDriveType(dtype int16) (DriveType, error)

func GetDriveTypes

func GetDriveTypes() []DriveType

func (DriveType) TotalBlocks

func (dt DriveType) TotalBlocks() int32

type File

type File struct {
}

type FileManager

type FileManager struct {
	// contains filtered or unexported fields
}

func (*FileManager) CreateFile

func (fm *FileManager) CreateFile(containingDirectory UID) (*File, error)

type LVLabel

type LVLabel struct {
	Version         int16
	Ignore1         int16
	Name            [32]byte
	UID             UID
	BATHeader       BATHeader
	VTOCHeader      VTOCHeader
	LabelWritten    uint32 // time LV label writtern
	Ignore2         int16
	LastMountedNode int16
	BootTime        uint32
	DismountedTime  uint32
}

func (LVLabel) Print

func (l LVLabel) Print()

type LogicalVolume

type LogicalVolume struct {
	Label LVLabel

	// there will be 8 of these
	VTOCMap VTOCMap
	// contains filtered or unexported fields
}

func NewLogicalVolume

func NewLogicalVolume(pvol *PhysicalVolume, startDAddr DAddr) (*LogicalVolume, error)

func (*LogicalVolume) PrintLabel

func (lvol *LogicalVolume) PrintLabel()

func (*LogicalVolume) ReadBlock

func (lvol *LogicalVolume) ReadBlock(blockNum DAddr) (*Block, error)

type NamingManager

type NamingManager struct {
	// contains filtered or unexported fields
}

func NewNamingManager

func NewNamingManager(lvol *LogicalVolume, vtoc *VTOCManager) *NamingManager

func (*NamingManager) CreateDirectory

func (nm *NamingManager) CreateDirectory(p string) (*Dir, error)

func (*NamingManager) CreateFile

func (nm *NamingManager) CreateFile(p string) (*File, error)

func (*NamingManager) GetDirEntryUID

func (nm *NamingManager) GetDirEntryUID(dirUID UID, name string) (UID, error)

func (*NamingManager) Resolve

func (nm *NamingManager) Resolve(p string) (UID, error)

type PVLabel

type PVLabel struct {
	Version             int16
	APOLLO              [6]byte
	Name                [32]byte
	UID                 UID
	Ignore1             int16
	DriveType           int16
	TotalBlocksInVolume int32
	BlocksPerTrack      int16
	TracksPerCylinder   int16
	LVDAddr             [10]DAddr
	AltLVLabelDAddr     [10]DAddr

	// start of phys bad spot cylinder
	PhysBadspotDAddr DAddr

	// start of phys diag cylinder
	PhysDiagDAddr DAddr

	SectorStart     uint16
	SectorSize      uint16
	PreCompCylinder uint16
}

func (PVLabel) Print

func (l PVLabel) Print()

type PhysicalVolume

type PhysicalVolume struct {
	Label PVLabel
	LV    *LogicalVolume
	// contains filtered or unexported fields
}

func Mount

func Mount(diskImage string) (*PhysicalVolume, error)

func (*PhysicalVolume) LogicalVolumes

func (pvol *PhysicalVolume) LogicalVolumes() []int

func (*PhysicalVolume) PrintLabel

func (pvol *PhysicalVolume) PrintLabel()

func (*PhysicalVolume) ReadBlock

func (pvol *PhysicalVolume) ReadBlock(blockNum DAddr) (*Block, error)

func (*PhysicalVolume) Unmount

func (pvol *PhysicalVolume) Unmount() error

type UID

type UID struct {
	Hi uint32
	Lo uint32
}

func (UID) String

func (u UID) String() string

type VTOCBlock

type VTOCBlock struct {
	Padding        uint32 // not sure what this is, but VTOCE_$READ uses 8 bytes to offset to the entries instead of 4
	NextBlockDAddr DAddr
	Entries        [3]VTOCE
}

func (VTOCBlock) Print

func (b VTOCBlock) Print()

type VTOCBlockSR9

type VTOCBlockSR9 struct {
	NextBlockDAddr DAddr
	Entries        [5]VTOCESR9
}

type VTOCBucket

type VTOCBucket struct {
	// bucket header (next daddr/index)
	NextBlockDAddr DAddr
	NextIndex      uint16
	Padding        uint16

	// bucket entries
	Entries [20]VTOCBucketEntry
}

type VTOCBucketBlock

type VTOCBucketBlock struct {
	Buckets [4]VTOCBucket
}

this seem to be a struct in SR10 only, and not present in SR9?

func (VTOCBucketBlock) Print

func (b VTOCBucketBlock) Print()

type VTOCBucketEntry

type VTOCBucketEntry struct {
	UID   UID
	VTOCX VTOCX
}

type VTOCE

type VTOCE struct {
	Header      VTOCEHeader
	FileMap1Ptr DAddr
	FileMap2Ptr DAddr
	FileMap3Ptr DAddr
	FileMap0    [32]DAddr // daddrs for the first 32 pages of an object
}

func (VTOCE) IsDirectory

func (e VTOCE) IsDirectory() bool

func (VTOCE) Print

func (e VTOCE) Print()

type VTOCEHeader

type VTOCEHeader struct {
	Version          uint8
	SystemType       uint8
	Flags            uint16
	ObjectUID        UID
	ObjectTypeDefUID UID
	CurrentLength    uint32
	BlocksUsed       uint32
	LastModifiedTime uint32
	ExtDtm           uint16
	RefCount         uint16
	LastUsedTime     uint32
	U5               uint32
	U6               uint32
	U7               uint32
	U8               uint32
	U9               uint32
	DirectoryUID     UID
	ObjectLockKey    uint32
	ObjectUserUID    UID
	ObjectGroupUID   UID
	ObjectOrgUID     UID
	U19              uint32
	U20              uint32
	U21              uint32
	U22              uint32
	U23              uint32
	U24              uint32
	U25              uint32
	U26              uint32
	U27              uint32
	U28              uint32
	ObjectACLUID     UID
	Padding          [52]byte
}

type VTOCEHeaderSR9

type VTOCEHeaderSR9 struct {
	// "VTOCE & Object Info" in the docs
	Version    uint8
	SystemType uint8
	Flags      uint16

	ObjectUID        UID
	ObjectTypeDefUID UID
	ObjectACLUID     UID
	CurrentLength    int32
	BlocksUsed       int32
	LastUsedTime     int32
	LastModifiedTime int32
	DirectoryUID     UID   // "UID of Directory in which object catalogued" in the docs.  containing dir?
	MoreStuff        int32 // "DTM Ext. / Unused / Ref. Count" in the docs
	ObjectLockKey    int32

	Padding [4]byte // Aegis Internals doesn't have this, but EH'87 does.
}

type VTOCESR9

type VTOCESR9 struct {
	Header      VTOCEHeaderSR9
	FileMap0    [32]DAddr
	FileMap1Ptr DAddr
	FileMap2Ptr DAddr
	FileMap3Ptr DAddr
}

type VTOCHeader

type VTOCHeader struct {
	Version             int16
	VTOCSizeInBlocks    int16
	VTOCBlocksUsed      int32
	NetworkRootDirVTOCX VTOCX
	DiskEntryDirVTOCX   VTOCX
	OSPagingFileVTOCX   VTOCX
	SysbootVTOCX        VTOCX
	VTOCMapData         VTOCMapData
	Unused              [28]byte
}

func (VTOCHeader) Print

func (h VTOCHeader) Print()

type VTOCManager

type VTOCManager struct {
	// contains filtered or unexported fields
}

func NewVTOCManager

func NewVTOCManager(lvol *LogicalVolume) *VTOCManager

func (*VTOCManager) AllocateEntry

func (vm *VTOCManager) AllocateEntry(uid UID) (VTOCX, error)

func (*VTOCManager) GetEntry

func (vm *VTOCManager) GetEntry(vtocx VTOCX) (*VTOCE, error)

func (*VTOCManager) GetEntryForUID

func (vm *VTOCManager) GetEntryForUID(uid UID) (*VTOCE, error)

func (VTOCManager) GetFMBlocks

func (vm VTOCManager) GetFMBlocks(e *VTOCE) ([]DAddr, error)

func (*VTOCManager) GetIndexForUID

func (vm *VTOCManager) GetIndexForUID(uid UID) (VTOCX, error)

func (*VTOCManager) LookupEntry

func (vm *VTOCManager) LookupEntry(uid UID) (*VTOCE, error)

type VTOCMap

type VTOCMap []VTOCMapExtent

the next two are the parsed form of VTOCMapData. check logical_volume.go

func (VTOCMap) Print

func (m VTOCMap) Print()

type VTOCMapData

type VTOCMapData [60]byte

type VTOCMapDataSR9

type VTOCMapDataSR9 [48]byte

type VTOCMapExtent

type VTOCMapExtent struct {
	NumBlocks       uint16
	FirstBlockDAddr DAddr
}

type VTOCX

type VTOCX uint32

func NewVTOCX

func NewVTOCX(blockDAddr DAddr, index int) VTOCX

func (VTOCX) BlockDAddr

func (x VTOCX) BlockDAddr() DAddr

func (VTOCX) Index

func (x VTOCX) Index() int

func (VTOCX) String

func (x VTOCX) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL