OpenCores
URL https://opencores.org/ocsvn/or1k_old/or1k_old/trunk

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [rc203soc/] [sw/] [uClinux/] [include/] [linux/] [amigaffs.h] - Blame information for rev 1782

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1633 jcastillo
#ifndef AMIGAFFS_H
2
#define AMIGAFFS_H
3
 
4
#include <asm/byteorder.h>
5
#include <linux/types.h>
6
 
7
/* Ugly macros make the code more pretty. */
8
 
9
#define GET_END_PTR(st,p,sz)             ((st *)((char *)(p)+((sz)-sizeof(st))))
10
#define AFFS_GET_HASHENTRY(data,hashkey) htonl(((struct dir_front *)data)->hashtable[hashkey])
11
#define AFFS_BLOCK(data,ino,blk)         ((struct file_front *)data)->blocks[AFFS_I2HSIZE(ino)-1-(blk)]
12
 
13
#define FILE_END(p,i)   GET_END_PTR(struct file_end,p,AFFS_I2BSIZE(i))
14
#define ROOT_END(p,i)   GET_END_PTR(struct root_end,p,AFFS_I2BSIZE(i))
15
#define DIR_END(p,i)    GET_END_PTR(struct dir_end,p,AFFS_I2BSIZE(i))
16
#define LINK_END(p,i)   GET_END_PTR(struct hlink_end,p,AFFS_I2BSIZE(i))
17
#define ROOT_END_S(p,s) GET_END_PTR(struct root_end,p,(s)->s_blocksize)
18
#define DATA_FRONT(bh)  ((struct data_front *)(bh)->b_data)
19
 
20
/* Only for easier debugging if need be */
21
#define affs_bread      bread
22
#define affs_brelse     brelse
23
 
24
#ifdef __LITTLE_ENDIAN
25
#define BO_EXBITS       0x18UL
26
#elif defined(__BIG_ENDIAN)
27
#define BO_EXBITS       0x00UL
28
#else
29
#error Endianness must be known for affs to work.
30
#endif
31
 
32
#define FS_OFS          0x444F5300
33
#define FS_FFS          0x444F5301
34
#define FS_INTLOFS      0x444F5302
35
#define FS_INTLFFS      0x444F5303
36
#define FS_DCOFS        0x444F5304
37
#define FS_DCFFS        0x444F5305
38
#define MUFS_FS         0x6d754653   /* 'muFS' */
39
#define MUFS_OFS        0x6d754600   /* 'muF\0' */
40
#define MUFS_FFS        0x6d754601   /* 'muF\1' */
41
#define MUFS_INTLOFS    0x6d754602   /* 'muF\2' */
42
#define MUFS_INTLFFS    0x6d754603   /* 'muF\3' */
43
#define MUFS_DCOFS      0x6d754604   /* 'muF\4' */
44
#define MUFS_DCFFS      0x6d754605   /* 'muF\5' */
45
 
46
#define T_SHORT         2
47
#define T_LIST          16
48
#define T_DATA          8
49
 
50
#define ST_LINKFILE     -4
51
#define ST_FILE         -3
52
#define ST_ROOT         1
53
#define ST_USERDIR      2
54
#define ST_SOFTLINK     3
55
#define ST_LINKDIR      4
56
 
57
struct root_front
58
{
59
  __s32 primary_type;
60
  __s32 spare1[2];
61
  __s32 hash_size;
62
  __s32 spare2;
63
  __u32 checksum;
64
  __s32 hashtable[0];
65
};
66
 
67
struct root_end
68
{
69
  __s32 bm_flag;
70
  __s32 bm_keys[25];
71
  __s32 bm_extend;
72
  struct DateStamp dir_altered;
73
  __u8 disk_name[40];
74
  struct DateStamp disk_altered;
75
  struct DateStamp disk_made;
76
  __s32 spare1[3];
77
  __s32 secondary_type;
78
};
79
 
80
struct dir_front
81
{
82
  __s32 primary_type;
83
  __s32 own_key;
84
  __s32 spare1[3];
85
  __u32 checksum;
86
  __s32 hashtable[0];
87
};
88
 
89
struct dir_end
90
{
91
  __s32 spare1;
92
  __s16 owner_uid;
93
  __s16 owner_gid;
94
  __u32 protect;
95
  __s32 spare2;
96
  __u8 comment[92];
97
  struct DateStamp created;
98
  __u8 dir_name[32];
99
  __s32 spare3[2];
100
  __s32 link_chain;
101
  __s32 spare4[5];
102
  __s32 hash_chain;
103
  __s32 parent;
104
  __s32 spare5;
105
  __s32 secondary_type;
106
};
107
 
108
struct file_front
109
{
110
  __s32 primary_type;
111
  __s32 own_key;
112
  __s32 block_count;
113
  __s32 unknown1;
114
  __s32 first_data;
115
  __u32 checksum;
116
  __s32 blocks[0];
117
};
118
 
119
struct file_end
120
{
121
  __s32 spare1;
122
  __s16 owner_uid;
123
  __s16 owner_gid;
124
  __u32 protect;
125
  __s32 byte_size;
126
  __u8 comment[92];
127
  struct DateStamp created;
128
  __u8 file_name[32];
129
  __s32 spare2;
130
  __s32 original;       /* not really in file_end */
131
  __s32 link_chain;
132
  __s32 spare3[5];
133
  __s32 hash_chain;
134
  __s32 parent;
135
  __s32 extension;
136
  __s32 secondary_type;
137
};
138
 
139
struct hlink_front
140
{
141
  __s32 primary_type;
142
  __s32 own_key;
143
  __s32 spare1[3];
144
  __u32 checksum;
145
};
146
 
147
struct hlink_end
148
{
149
  __s32 spare1;
150
  __s16 owner_uid;
151
  __s16 owner_gid;
152
  __u32 protect;
153
  __u8 comment[92];
154
  struct DateStamp created;
155
  __u8 link_name[32];
156
  __s32 spare2;
157
  __s32 original;
158
  __s32 link_chain;
159
  __s32 spare3[5];
160
  __s32 hash_chain;
161
  __s32 parent;
162
  __s32 spare4;
163
  __s32 secondary_type;
164
};
165
 
166
struct slink_front
167
{
168
  __s32 primary_type;
169
  __s32 own_key;
170
  __s32 spare1[3];
171
  __s32 checksum;
172
  __u8  symname[288];   /* depends on block size */
173
};
174
 
175
struct data_front
176
{
177
  __s32 primary_type;
178
  __s32 header_key;
179
  __s32 sequence_number;
180
  __s32 data_size;
181
  __s32 next_data;
182
  __s32 checksum;
183
  __u8 data[488];       /* depends on block size */
184
};
185
 
186
/* Permission bits */
187
 
188
#define FIBF_OTR_READ           0x8000
189
#define FIBF_OTR_WRITE          0x4000
190
#define FIBF_OTR_EXECUTE        0x2000
191
#define FIBF_OTR_DELETE         0x1000
192
#define FIBF_GRP_READ           0x0800
193
#define FIBF_GRP_WRITE          0x0400
194
#define FIBF_GRP_EXECUTE        0x0200
195
#define FIBF_GRP_DELETE         0x0100
196
 
197
#define FIBF_SCRIPT             0x0040
198
#define FIBF_PURE               0x0020          /* no use under linux */
199
#define FIBF_ARCHIVE            0x0010          /* never set, always cleared on write */
200
#define FIBF_READ               0x0008          /* 0 means allowed */
201
#define FIBF_WRITE              0x0004          /* 0 means allowed */
202
#define FIBF_EXECUTE            0x0002          /* 0 means allowed, ignored under linux */
203
#define FIBF_DELETE             0x0001          /* 0 means allowed */
204
 
205
#define FIBF_OWNER              0x000F          /* Bits pertaining to owner */
206
 
207
#define AFFS_UMAYWRITE(prot)    (((prot) & (FIBF_WRITE|FIBF_DELETE)) == (FIBF_WRITE|FIBF_DELETE))
208
#define AFFS_UMAYREAD(prot)     ((prot) & FIBF_READ)
209
#define AFFS_UMAYEXECUTE(prot)  (((prot) & (FIBF_SCRIPT|FIBF_READ)) == (FIBF_SCRIPT|FIBF_READ))
210
#define AFFS_GMAYWRITE(prot)    (((prot)&(FIBF_GRP_WRITE|FIBF_GRP_DELETE))==\
211
                                                        (FIBF_GRP_WRITE|FIBF_GRP_DELETE))
212
#define AFFS_GMAYREAD(prot)     ((prot) & FIBF_GRP_READ)
213
#define AFFS_GMAYEXECUTE(prot)  (((prot)&(FIBF_SCRIPT|FIBF_GRP_READ))==(FIBF_SCRIPT|FIBF_GRP_READ))
214
#define AFFS_OMAYWRITE(prot)    (((prot)&(FIBF_OTR_WRITE|FIBF_OTR_DELETE))==\
215
                                                        (FIBF_OTR_WRITE|FIBF_OTR_DELETE))
216
#define AFFS_OMAYREAD(prot)     ((prot) & FIBF_OTR_READ)
217
#define AFFS_OMAYEXECUTE(prot)  (((prot)&(FIBF_SCRIPT|FIBF_OTR_READ))==(FIBF_SCRIPT|FIBF_OTR_READ))
218
 
219
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.