xref: /linux/fs/affs/amigaffs.h (revision 38a381a0bc57be2927c6744733ba274cefd13e9f)
1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
2d2d58e0eSFabian Frederick #ifndef AMIGAFFS_H
3d2d58e0eSFabian Frederick #define AMIGAFFS_H
4d2d58e0eSFabian Frederick 
5d2d58e0eSFabian Frederick #include <linux/types.h>
6d2d58e0eSFabian Frederick #include <asm/byteorder.h>
7d2d58e0eSFabian Frederick 
8d2d58e0eSFabian Frederick #define FS_OFS		0x444F5300
9d2d58e0eSFabian Frederick #define FS_FFS		0x444F5301
10d2d58e0eSFabian Frederick #define FS_INTLOFS	0x444F5302
11d2d58e0eSFabian Frederick #define FS_INTLFFS	0x444F5303
12d2d58e0eSFabian Frederick #define FS_DCOFS	0x444F5304
13d2d58e0eSFabian Frederick #define FS_DCFFS	0x444F5305
14d2d58e0eSFabian Frederick #define MUFS_FS		0x6d754653   /* 'muFS' */
15d2d58e0eSFabian Frederick #define MUFS_OFS	0x6d754600   /* 'muF\0' */
16d2d58e0eSFabian Frederick #define MUFS_FFS	0x6d754601   /* 'muF\1' */
17d2d58e0eSFabian Frederick #define MUFS_INTLOFS	0x6d754602   /* 'muF\2' */
18d2d58e0eSFabian Frederick #define MUFS_INTLFFS	0x6d754603   /* 'muF\3' */
19d2d58e0eSFabian Frederick #define MUFS_DCOFS	0x6d754604   /* 'muF\4' */
20d2d58e0eSFabian Frederick #define MUFS_DCFFS	0x6d754605   /* 'muF\5' */
21d2d58e0eSFabian Frederick 
22d2d58e0eSFabian Frederick #define T_SHORT		2
23d2d58e0eSFabian Frederick #define T_LIST		16
24d2d58e0eSFabian Frederick #define T_DATA		8
25d2d58e0eSFabian Frederick 
26d2d58e0eSFabian Frederick #define ST_LINKFILE	-4
27d2d58e0eSFabian Frederick #define ST_FILE		-3
28d2d58e0eSFabian Frederick #define ST_ROOT		1
29d2d58e0eSFabian Frederick #define ST_USERDIR	2
30d2d58e0eSFabian Frederick #define ST_SOFTLINK	3
31d2d58e0eSFabian Frederick #define ST_LINKDIR	4
32d2d58e0eSFabian Frederick 
33d2d58e0eSFabian Frederick #define AFFS_ROOT_BMAPS		25
34d2d58e0eSFabian Frederick 
35487b25bcSDeepa Dinamani /* Seconds since Amiga epoch of 1978/01/01 to UNIX */
36487b25bcSDeepa Dinamani #define AFFS_EPOCH_DELTA ((8 * 365 + 2) * 86400LL)
37487b25bcSDeepa Dinamani 
38d2d58e0eSFabian Frederick struct affs_date {
39d2d58e0eSFabian Frederick 	__be32 days;
40d2d58e0eSFabian Frederick 	__be32 mins;
41d2d58e0eSFabian Frederick 	__be32 ticks;
42d2d58e0eSFabian Frederick };
43d2d58e0eSFabian Frederick 
44d2d58e0eSFabian Frederick struct affs_short_date {
45d2d58e0eSFabian Frederick 	__be16 days;
46d2d58e0eSFabian Frederick 	__be16 mins;
47d2d58e0eSFabian Frederick 	__be16 ticks;
48d2d58e0eSFabian Frederick };
49d2d58e0eSFabian Frederick 
50d2d58e0eSFabian Frederick struct affs_root_head {
51d2d58e0eSFabian Frederick 	__be32 ptype;
52d2d58e0eSFabian Frederick 	__be32 spare1;
53d2d58e0eSFabian Frederick 	__be32 spare2;
54d2d58e0eSFabian Frederick 	__be32 hash_size;
55d2d58e0eSFabian Frederick 	__be32 spare3;
56d2d58e0eSFabian Frederick 	__be32 checksum;
57d2d58e0eSFabian Frederick 	__be32 hashtable[1];
58d2d58e0eSFabian Frederick };
59d2d58e0eSFabian Frederick 
60d2d58e0eSFabian Frederick struct affs_root_tail {
61d2d58e0eSFabian Frederick 	__be32 bm_flag;
62d2d58e0eSFabian Frederick 	__be32 bm_blk[AFFS_ROOT_BMAPS];
63d2d58e0eSFabian Frederick 	__be32 bm_ext;
64d2d58e0eSFabian Frederick 	struct affs_date root_change;
65d2d58e0eSFabian Frederick 	u8 disk_name[32];
66d2d58e0eSFabian Frederick 	__be32 spare1;
67d2d58e0eSFabian Frederick 	__be32 spare2;
68d2d58e0eSFabian Frederick 	struct affs_date disk_change;
69d2d58e0eSFabian Frederick 	struct affs_date disk_create;
70d2d58e0eSFabian Frederick 	__be32 spare3;
71d2d58e0eSFabian Frederick 	__be32 spare4;
72d2d58e0eSFabian Frederick 	__be32 dcache;
73d2d58e0eSFabian Frederick 	__be32 stype;
74d2d58e0eSFabian Frederick };
75d2d58e0eSFabian Frederick 
76d2d58e0eSFabian Frederick struct affs_head {
77d2d58e0eSFabian Frederick 	__be32 ptype;
78d2d58e0eSFabian Frederick 	__be32 key;
79d2d58e0eSFabian Frederick 	__be32 block_count;
80d2d58e0eSFabian Frederick 	__be32 spare1;
81d2d58e0eSFabian Frederick 	__be32 first_data;
82d2d58e0eSFabian Frederick 	__be32 checksum;
83*38a381a0SKees Cook 	__be32 table[];
84d2d58e0eSFabian Frederick };
85d2d58e0eSFabian Frederick 
86d2d58e0eSFabian Frederick struct affs_tail {
87d2d58e0eSFabian Frederick 	__be32 spare1;
88d2d58e0eSFabian Frederick 	__be16 uid;
89d2d58e0eSFabian Frederick 	__be16 gid;
90d2d58e0eSFabian Frederick 	__be32 protect;
91d2d58e0eSFabian Frederick 	__be32 size;
92d2d58e0eSFabian Frederick 	u8 comment[92];
93d2d58e0eSFabian Frederick 	struct affs_date change;
94d2d58e0eSFabian Frederick 	u8 name[32];
95d2d58e0eSFabian Frederick 	__be32 spare2;
96d2d58e0eSFabian Frederick 	__be32 original;
97d2d58e0eSFabian Frederick 	__be32 link_chain;
98d2d58e0eSFabian Frederick 	__be32 spare[5];
99d2d58e0eSFabian Frederick 	__be32 hash_chain;
100d2d58e0eSFabian Frederick 	__be32 parent;
101d2d58e0eSFabian Frederick 	__be32 extension;
102d2d58e0eSFabian Frederick 	__be32 stype;
103d2d58e0eSFabian Frederick };
104d2d58e0eSFabian Frederick 
105d2d58e0eSFabian Frederick struct slink_front
106d2d58e0eSFabian Frederick {
107d2d58e0eSFabian Frederick 	__be32 ptype;
108d2d58e0eSFabian Frederick 	__be32 key;
109d2d58e0eSFabian Frederick 	__be32 spare1[3];
110d2d58e0eSFabian Frederick 	__be32 checksum;
111d2d58e0eSFabian Frederick 	u8 symname[1];	/* depends on block size */
112d2d58e0eSFabian Frederick };
113d2d58e0eSFabian Frederick 
114d2d58e0eSFabian Frederick struct affs_data_head
115d2d58e0eSFabian Frederick {
116d2d58e0eSFabian Frederick 	__be32 ptype;
117d2d58e0eSFabian Frederick 	__be32 key;
118d2d58e0eSFabian Frederick 	__be32 sequence;
119d2d58e0eSFabian Frederick 	__be32 size;
120d2d58e0eSFabian Frederick 	__be32 next;
121d2d58e0eSFabian Frederick 	__be32 checksum;
122d2d58e0eSFabian Frederick 	u8 data[1];	/* depends on block size */
123d2d58e0eSFabian Frederick };
124d2d58e0eSFabian Frederick 
125d2d58e0eSFabian Frederick /* Permission bits */
126d2d58e0eSFabian Frederick 
127d2d58e0eSFabian Frederick #define FIBF_OTR_READ		0x8000
128d2d58e0eSFabian Frederick #define FIBF_OTR_WRITE		0x4000
129d2d58e0eSFabian Frederick #define FIBF_OTR_EXECUTE	0x2000
130d2d58e0eSFabian Frederick #define FIBF_OTR_DELETE		0x1000
131d2d58e0eSFabian Frederick #define FIBF_GRP_READ		0x0800
132d2d58e0eSFabian Frederick #define FIBF_GRP_WRITE		0x0400
133d2d58e0eSFabian Frederick #define FIBF_GRP_EXECUTE	0x0200
134d2d58e0eSFabian Frederick #define FIBF_GRP_DELETE		0x0100
135d2d58e0eSFabian Frederick 
136d2d58e0eSFabian Frederick #define FIBF_HIDDEN		0x0080
137d2d58e0eSFabian Frederick #define FIBF_SCRIPT		0x0040
138d2d58e0eSFabian Frederick #define FIBF_PURE		0x0020		/* no use under linux */
139d2d58e0eSFabian Frederick #define FIBF_ARCHIVED		0x0010		/* never set, always cleared on write */
140d2d58e0eSFabian Frederick #define FIBF_NOREAD		0x0008		/* 0 means allowed */
141d2d58e0eSFabian Frederick #define FIBF_NOWRITE		0x0004		/* 0 means allowed */
142d2d58e0eSFabian Frederick #define FIBF_NOEXECUTE		0x0002		/* 0 means allowed, ignored under linux */
143d2d58e0eSFabian Frederick #define FIBF_NODELETE		0x0001		/* 0 means allowed */
144d2d58e0eSFabian Frederick 
145d2d58e0eSFabian Frederick #define FIBF_OWNER		0x000F		/* Bits pertaining to owner */
146d2d58e0eSFabian Frederick #define FIBF_MASK		0xEE0E		/* Bits modified by Linux */
147d2d58e0eSFabian Frederick 
148d2d58e0eSFabian Frederick #endif
149