/*
 *		DOSHEADER.H
 *
 *		This file contains a few structures which map out the main
 *		AmigaDOS disk structures (root block, directory block etc.)
 *		These are valid for both the old and new filing systems.
 *
 *		Taken from Betty Clay's article on the differences between the
 *		old FS and new FS under 1.3, in Transactor UK, V1.6, May 1989, and
 *		from the original AmigaDOS Technical Reference manual.
 */

#define BTOC(x)		((void *)((long)(x)<<2))		/* BPTR to C pointer	*/
#define CTOB(x)		((ULONG) ((long)(x)>>2))		/* C pointer to BPTR	*/

/*
 *		Disk block types
 */

#define Type_Short		0x02
#define Type_Data		0x08
#define Type_List		0x10

#define SecType_File	0xfffffffd
#define SecType_Root	0x01
#define SecType_UserDir	0x02

struct RootBlock {
	LONG	Type;
	ULONG	OwnKey;
	ULONG	SeqNum;
	ULONG	HtSize;
	ULONG	Nothing1;
	ULONG	Checksum;
	ULONG	HashTable[72];
	LONG	BitmapFlag;
	ULONG	BitmapKeys[25];
	ULONG	BitmapExtend;
	ULONG	DirAltered[3];
	char	Name[40];
	ULONG	DiskAltered[3];
	ULONG	DiskMade[3];
	ULONG	Nothing2;
	ULONG	Nothing3;
	ULONG	Nothing4;
	LONG	SecondaryType;
};

struct UserDirectoryBlock {
	LONG	Type;
	ULONG	OwnKey;
	ULONG	Spare1;
	ULONG	Spare2;
	ULONG	Spare3;
	LONG	Checksum;
	ULONG	HashTable[72];
	LONG	Spare4;
	LONG	Spare5;
	ULONG	Protection;
	LONG	Spare6;
	char	Comment[92];
	ULONG	Created[3];
	char	DirName[36];
	LONG	Spare7[7];
	ULONG	HashChain;
	ULONG	Parent;
	ULONG	Spare8;
	LONG	SecondaryType;
};

struct FileHeaderBlock {
	LONG	Type;
	ULONG	OwnKey;
	ULONG	HighSeq;
	ULONG	DataSize;
	ULONG	FirstBlock;
	LONG	Checksum;
	ULONG	DataBlocks[72];
	ULONG	Spare1;
	ULONG	Spare2;
	ULONG	Protect;
	ULONG	FileSize;
	char	Comment[92];
	ULONG	Date[3];
	char	FileName[36];
	ULONG	Spare3[7];
	ULONG	HashChain;
	ULONG	Parent;
	ULONG	Extension;
	LONG	SecondaryType;
};

struct FileListBlock {
	LONG	Type;
	ULONG	OwnKey;
	ULONG	BlockCount;
	ULONG	DataSize;
	ULONG	FirstBlock;
	LONG	Checksum;
	ULONG	DataBlocks[72];
	ULONG	Unused[47];
	ULONG	Parent;
	ULONG	Extension;
	LONG	SecondaryType;
};

struct DataBlock {			/* Old Filing System only */
	LONG	Type;
	ULONG	Header;
	ULONG	SeqNum;
	ULONG	DataSize;
	ULONG	NextData;
	LONG	Checksum;
	ULONG	Data[122];
};
