xref: /kernel/linux/linux-5.10/fs/affs/amigaffs.h (revision 8c2ecf20)
18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef AMIGAFFS_H
38c2ecf20Sopenharmony_ci#define AMIGAFFS_H
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci#include <linux/types.h>
68c2ecf20Sopenharmony_ci#include <asm/byteorder.h>
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci#define FS_OFS		0x444F5300
98c2ecf20Sopenharmony_ci#define FS_FFS		0x444F5301
108c2ecf20Sopenharmony_ci#define FS_INTLOFS	0x444F5302
118c2ecf20Sopenharmony_ci#define FS_INTLFFS	0x444F5303
128c2ecf20Sopenharmony_ci#define FS_DCOFS	0x444F5304
138c2ecf20Sopenharmony_ci#define FS_DCFFS	0x444F5305
148c2ecf20Sopenharmony_ci#define MUFS_FS		0x6d754653   /* 'muFS' */
158c2ecf20Sopenharmony_ci#define MUFS_OFS	0x6d754600   /* 'muF\0' */
168c2ecf20Sopenharmony_ci#define MUFS_FFS	0x6d754601   /* 'muF\1' */
178c2ecf20Sopenharmony_ci#define MUFS_INTLOFS	0x6d754602   /* 'muF\2' */
188c2ecf20Sopenharmony_ci#define MUFS_INTLFFS	0x6d754603   /* 'muF\3' */
198c2ecf20Sopenharmony_ci#define MUFS_DCOFS	0x6d754604   /* 'muF\4' */
208c2ecf20Sopenharmony_ci#define MUFS_DCFFS	0x6d754605   /* 'muF\5' */
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci#define T_SHORT		2
238c2ecf20Sopenharmony_ci#define T_LIST		16
248c2ecf20Sopenharmony_ci#define T_DATA		8
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci#define ST_LINKFILE	-4
278c2ecf20Sopenharmony_ci#define ST_FILE		-3
288c2ecf20Sopenharmony_ci#define ST_ROOT		1
298c2ecf20Sopenharmony_ci#define ST_USERDIR	2
308c2ecf20Sopenharmony_ci#define ST_SOFTLINK	3
318c2ecf20Sopenharmony_ci#define ST_LINKDIR	4
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci#define AFFS_ROOT_BMAPS		25
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci/* Seconds since Amiga epoch of 1978/01/01 to UNIX */
368c2ecf20Sopenharmony_ci#define AFFS_EPOCH_DELTA ((8 * 365 + 2) * 86400LL)
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_cistruct affs_date {
398c2ecf20Sopenharmony_ci	__be32 days;
408c2ecf20Sopenharmony_ci	__be32 mins;
418c2ecf20Sopenharmony_ci	__be32 ticks;
428c2ecf20Sopenharmony_ci};
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_cistruct affs_short_date {
458c2ecf20Sopenharmony_ci	__be16 days;
468c2ecf20Sopenharmony_ci	__be16 mins;
478c2ecf20Sopenharmony_ci	__be16 ticks;
488c2ecf20Sopenharmony_ci};
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_cistruct affs_root_head {
518c2ecf20Sopenharmony_ci	__be32 ptype;
528c2ecf20Sopenharmony_ci	__be32 spare1;
538c2ecf20Sopenharmony_ci	__be32 spare2;
548c2ecf20Sopenharmony_ci	__be32 hash_size;
558c2ecf20Sopenharmony_ci	__be32 spare3;
568c2ecf20Sopenharmony_ci	__be32 checksum;
578c2ecf20Sopenharmony_ci	__be32 hashtable[1];
588c2ecf20Sopenharmony_ci};
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_cistruct affs_root_tail {
618c2ecf20Sopenharmony_ci	__be32 bm_flag;
628c2ecf20Sopenharmony_ci	__be32 bm_blk[AFFS_ROOT_BMAPS];
638c2ecf20Sopenharmony_ci	__be32 bm_ext;
648c2ecf20Sopenharmony_ci	struct affs_date root_change;
658c2ecf20Sopenharmony_ci	u8 disk_name[32];
668c2ecf20Sopenharmony_ci	__be32 spare1;
678c2ecf20Sopenharmony_ci	__be32 spare2;
688c2ecf20Sopenharmony_ci	struct affs_date disk_change;
698c2ecf20Sopenharmony_ci	struct affs_date disk_create;
708c2ecf20Sopenharmony_ci	__be32 spare3;
718c2ecf20Sopenharmony_ci	__be32 spare4;
728c2ecf20Sopenharmony_ci	__be32 dcache;
738c2ecf20Sopenharmony_ci	__be32 stype;
748c2ecf20Sopenharmony_ci};
758c2ecf20Sopenharmony_ci
768c2ecf20Sopenharmony_cistruct affs_head {
778c2ecf20Sopenharmony_ci	__be32 ptype;
788c2ecf20Sopenharmony_ci	__be32 key;
798c2ecf20Sopenharmony_ci	__be32 block_count;
808c2ecf20Sopenharmony_ci	__be32 spare1;
818c2ecf20Sopenharmony_ci	__be32 first_data;
828c2ecf20Sopenharmony_ci	__be32 checksum;
838c2ecf20Sopenharmony_ci	__be32 table[1];
848c2ecf20Sopenharmony_ci};
858c2ecf20Sopenharmony_ci
868c2ecf20Sopenharmony_cistruct affs_tail {
878c2ecf20Sopenharmony_ci	__be32 spare1;
888c2ecf20Sopenharmony_ci	__be16 uid;
898c2ecf20Sopenharmony_ci	__be16 gid;
908c2ecf20Sopenharmony_ci	__be32 protect;
918c2ecf20Sopenharmony_ci	__be32 size;
928c2ecf20Sopenharmony_ci	u8 comment[92];
938c2ecf20Sopenharmony_ci	struct affs_date change;
948c2ecf20Sopenharmony_ci	u8 name[32];
958c2ecf20Sopenharmony_ci	__be32 spare2;
968c2ecf20Sopenharmony_ci	__be32 original;
978c2ecf20Sopenharmony_ci	__be32 link_chain;
988c2ecf20Sopenharmony_ci	__be32 spare[5];
998c2ecf20Sopenharmony_ci	__be32 hash_chain;
1008c2ecf20Sopenharmony_ci	__be32 parent;
1018c2ecf20Sopenharmony_ci	__be32 extension;
1028c2ecf20Sopenharmony_ci	__be32 stype;
1038c2ecf20Sopenharmony_ci};
1048c2ecf20Sopenharmony_ci
1058c2ecf20Sopenharmony_cistruct slink_front
1068c2ecf20Sopenharmony_ci{
1078c2ecf20Sopenharmony_ci	__be32 ptype;
1088c2ecf20Sopenharmony_ci	__be32 key;
1098c2ecf20Sopenharmony_ci	__be32 spare1[3];
1108c2ecf20Sopenharmony_ci	__be32 checksum;
1118c2ecf20Sopenharmony_ci	u8 symname[1];	/* depends on block size */
1128c2ecf20Sopenharmony_ci};
1138c2ecf20Sopenharmony_ci
1148c2ecf20Sopenharmony_cistruct affs_data_head
1158c2ecf20Sopenharmony_ci{
1168c2ecf20Sopenharmony_ci	__be32 ptype;
1178c2ecf20Sopenharmony_ci	__be32 key;
1188c2ecf20Sopenharmony_ci	__be32 sequence;
1198c2ecf20Sopenharmony_ci	__be32 size;
1208c2ecf20Sopenharmony_ci	__be32 next;
1218c2ecf20Sopenharmony_ci	__be32 checksum;
1228c2ecf20Sopenharmony_ci	u8 data[1];	/* depends on block size */
1238c2ecf20Sopenharmony_ci};
1248c2ecf20Sopenharmony_ci
1258c2ecf20Sopenharmony_ci/* Permission bits */
1268c2ecf20Sopenharmony_ci
1278c2ecf20Sopenharmony_ci#define FIBF_OTR_READ		0x8000
1288c2ecf20Sopenharmony_ci#define FIBF_OTR_WRITE		0x4000
1298c2ecf20Sopenharmony_ci#define FIBF_OTR_EXECUTE	0x2000
1308c2ecf20Sopenharmony_ci#define FIBF_OTR_DELETE		0x1000
1318c2ecf20Sopenharmony_ci#define FIBF_GRP_READ		0x0800
1328c2ecf20Sopenharmony_ci#define FIBF_GRP_WRITE		0x0400
1338c2ecf20Sopenharmony_ci#define FIBF_GRP_EXECUTE	0x0200
1348c2ecf20Sopenharmony_ci#define FIBF_GRP_DELETE		0x0100
1358c2ecf20Sopenharmony_ci
1368c2ecf20Sopenharmony_ci#define FIBF_HIDDEN		0x0080
1378c2ecf20Sopenharmony_ci#define FIBF_SCRIPT		0x0040
1388c2ecf20Sopenharmony_ci#define FIBF_PURE		0x0020		/* no use under linux */
1398c2ecf20Sopenharmony_ci#define FIBF_ARCHIVED		0x0010		/* never set, always cleared on write */
1408c2ecf20Sopenharmony_ci#define FIBF_NOREAD		0x0008		/* 0 means allowed */
1418c2ecf20Sopenharmony_ci#define FIBF_NOWRITE		0x0004		/* 0 means allowed */
1428c2ecf20Sopenharmony_ci#define FIBF_NOEXECUTE		0x0002		/* 0 means allowed, ignored under linux */
1438c2ecf20Sopenharmony_ci#define FIBF_NODELETE		0x0001		/* 0 means allowed */
1448c2ecf20Sopenharmony_ci
1458c2ecf20Sopenharmony_ci#define FIBF_OWNER		0x000F		/* Bits pertaining to owner */
1468c2ecf20Sopenharmony_ci#define FIBF_MASK		0xEE0E		/* Bits modified by Linux */
1478c2ecf20Sopenharmony_ci
1488c2ecf20Sopenharmony_ci#endif
149