4 #include <asm/byteorder.h>
5 #include <linux/types.h>
7 /* AmigaOS allows file names with up to 30 characters length.
8 * Names longer than that will be silently truncated. If you
9 * want to disallow this, comment out the following #define.
10 * Creating filesystem objects with longer names will then
11 * result in an error (ENAMETOOLONG).
13 /*#define AFFS_NO_TRUNCATE */
15 /* Ugly macros make the code more pretty. */
17 #define GET_END_PTR(st,p,sz) ((st *)((char *)(p)+((sz)-sizeof(st))))
18 #define AFFS_GET_HASHENTRY(data,hashkey) be32_to_cpu(((struct dir_front *)data)->hashtable[hashkey])
19 #define AFFS_BLOCK(data,ino,blk) ((struct file_front *)data)->blocks[AFFS_I2HSIZE(ino)-1-(blk)]
21 #define FILE_END(p,i) GET_END_PTR(struct file_end,p,AFFS_I2BSIZE(i))
22 #define ROOT_END(p,i) GET_END_PTR(struct root_end,p,AFFS_I2BSIZE(i))
23 #define DIR_END(p,i) GET_END_PTR(struct dir_end,p,AFFS_I2BSIZE(i))
24 #define LINK_END(p,i) GET_END_PTR(struct hlink_end,p,AFFS_I2BSIZE(i))
25 #define ROOT_END_S(p,s) GET_END_PTR(struct root_end,p,(s)->s_blocksize)
26 #define DATA_FRONT(bh) ((struct data_front *)(bh)->b_data)
27 #define DIR_FRONT(bh) ((struct dir_front *)(bh)->b_data)
29 /* Only for easier debugging if need be */
30 #define affs_bread bread
31 #define affs_brelse brelse
33 #ifdef __LITTLE_ENDIAN
34 #define BO_EXBITS 0x18UL
35 #elif defined(__BIG_ENDIAN)
36 #define BO_EXBITS 0x00UL
38 #error Endianness must be known for affs to work.
41 #define FS_OFS 0x444F5300
42 #define FS_FFS 0x444F5301
43 #define FS_INTLOFS 0x444F5302
44 #define FS_INTLFFS 0x444F5303
45 #define FS_DCOFS 0x444F5304
46 #define FS_DCFFS 0x444F5305
47 #define MUFS_FS 0x6d754653 /* 'muFS' */
48 #define MUFS_OFS 0x6d754600 /* 'muF\0' */
49 #define MUFS_FFS 0x6d754601 /* 'muF\1' */
50 #define MUFS_INTLOFS 0x6d754602 /* 'muF\2' */
51 #define MUFS_INTLFFS 0x6d754603 /* 'muF\3' */
52 #define MUFS_DCOFS 0x6d754604 /* 'muF\4' */
53 #define MUFS_DCFFS 0x6d754605 /* 'muF\5' */
59 #define ST_LINKFILE -4
81 struct DateStamp dir_altered
;
83 struct DateStamp disk_altered
;
84 struct DateStamp disk_made
;
106 struct DateStamp created
;
136 struct DateStamp created
;
139 s32 original
; /* not really in file_end */
163 struct DateStamp created
;
181 u8 symname
[288]; /* depends on block size */
192 u8 data
[488]; /* depends on block size */
195 /* Permission bits */
197 #define FIBF_OTR_READ 0x8000
198 #define FIBF_OTR_WRITE 0x4000
199 #define FIBF_OTR_EXECUTE 0x2000
200 #define FIBF_OTR_DELETE 0x1000
201 #define FIBF_GRP_READ 0x0800
202 #define FIBF_GRP_WRITE 0x0400
203 #define FIBF_GRP_EXECUTE 0x0200
204 #define FIBF_GRP_DELETE 0x0100
206 #define FIBF_SCRIPT 0x0040
207 #define FIBF_PURE 0x0020 /* no use under linux */
208 #define FIBF_ARCHIVE 0x0010 /* never set, always cleared on write */
209 #define FIBF_READ 0x0008 /* 0 means allowed */
210 #define FIBF_WRITE 0x0004 /* 0 means allowed */
211 #define FIBF_EXECUTE 0x0002 /* 0 means allowed, ignored under linux */
212 #define FIBF_DELETE 0x0001 /* 0 means allowed */
214 #define FIBF_OWNER 0x000F /* Bits pertaining to owner */
216 #define AFFS_UMAYWRITE(prot) (((prot) & (FIBF_WRITE|FIBF_DELETE)) == (FIBF_WRITE|FIBF_DELETE))
217 #define AFFS_UMAYREAD(prot) ((prot) & FIBF_READ)
218 #define AFFS_UMAYEXECUTE(prot) ((prot) & FIBF_EXECUTE)
219 #define AFFS_GMAYWRITE(prot) (((prot)&(FIBF_GRP_WRITE|FIBF_GRP_DELETE))==\
220 (FIBF_GRP_WRITE|FIBF_GRP_DELETE))
221 #define AFFS_GMAYREAD(prot) ((prot) & FIBF_GRP_READ)
222 #define AFFS_GMAYEXECUTE(prot) ((prot) & FIBF_EXECUTE)
223 #define AFFS_OMAYWRITE(prot) (((prot)&(FIBF_OTR_WRITE|FIBF_OTR_DELETE))==\
224 (FIBF_OTR_WRITE|FIBF_OTR_DELETE))
225 #define AFFS_OMAYREAD(prot) ((prot) & FIBF_OTR_READ)
226 #define AFFS_OMAYEXECUTE(prot) ((prot) & FIBF_EXECUTE)