This source file includes following definitions.
- adfs_filetype
- ADFS_I
- adfs_inode_is_stamped
- ADFS_SB
- signed_asl
- __adfs_block_map
- adfs_map_discrecord
- adfs_disc_size
1
2 #include <linux/buffer_head.h>
3 #include <linux/fs.h>
4 #include <linux/adfs_fs.h>
5
6
7
8 #define ADFS_FREE_FRAG 0
9 #define ADFS_BAD_FRAG 1
10 #define ADFS_ROOT_FRAG 2
11
12 #define ADFS_FILETYPE_NONE ((u16)~0)
13
14
15 static inline u16 adfs_filetype(u32 loadaddr)
16 {
17 return (loadaddr & 0xfff00000) == 0xfff00000 ?
18 (loadaddr >> 8) & 0xfff : ADFS_FILETYPE_NONE;
19 }
20
21 #define ADFS_NDA_OWNER_READ (1 << 0)
22 #define ADFS_NDA_OWNER_WRITE (1 << 1)
23 #define ADFS_NDA_LOCKED (1 << 2)
24 #define ADFS_NDA_DIRECTORY (1 << 3)
25 #define ADFS_NDA_EXECUTE (1 << 4)
26 #define ADFS_NDA_PUBLIC_READ (1 << 5)
27 #define ADFS_NDA_PUBLIC_WRITE (1 << 6)
28
29 #include "dir_f.h"
30
31
32
33
34 struct adfs_inode_info {
35 loff_t mmu_private;
36 __u32 parent_id;
37 __u32 loadaddr;
38 __u32 execaddr;
39 unsigned int attr;
40 struct inode vfs_inode;
41 };
42
43 static inline struct adfs_inode_info *ADFS_I(struct inode *inode)
44 {
45 return container_of(inode, struct adfs_inode_info, vfs_inode);
46 }
47
48 static inline bool adfs_inode_is_stamped(struct inode *inode)
49 {
50 return (ADFS_I(inode)->loadaddr & 0xfff00000) == 0xfff00000;
51 }
52
53
54
55
56 struct adfs_discmap;
57 struct adfs_dir_ops;
58
59
60
61
62 struct adfs_sb_info {
63 union { struct {
64 struct adfs_discmap *s_map;
65 const struct adfs_dir_ops *s_dir;
66 };
67 struct rcu_head rcu;
68 };
69 kuid_t s_uid;
70 kgid_t s_gid;
71 umode_t s_owner_mask;
72 umode_t s_other_mask;
73 int s_ftsuffix;
74
75 __u32 s_ids_per_zone;
76 __u32 s_idlen;
77 __u32 s_map_size;
78 signed int s_map2blk;
79 unsigned int s_log2sharesize;
80 unsigned int s_namelen;
81 };
82
83 static inline struct adfs_sb_info *ADFS_SB(struct super_block *sb)
84 {
85 return sb->s_fs_info;
86 }
87
88
89
90
91 struct adfs_dir {
92 struct super_block *sb;
93
94 int nr_buffers;
95 struct buffer_head *bh[4];
96
97
98 struct buffer_head **bh_fplus;
99
100 unsigned int pos;
101 __u32 parent_id;
102
103 struct adfs_dirheader dirhead;
104 union adfs_dirtail dirtail;
105 };
106
107
108
109
110 #define ADFS_MAX_NAME_LEN (256 + 4)
111 struct object_info {
112 __u32 parent_id;
113 __u32 indaddr;
114 __u32 loadaddr;
115 __u32 execaddr;
116 __u32 size;
117 __u8 attr;
118 unsigned int name_len;
119 char name[ADFS_MAX_NAME_LEN];
120 };
121
122 struct adfs_dir_ops {
123 int (*read)(struct super_block *sb, unsigned int indaddr,
124 unsigned int size, struct adfs_dir *dir);
125 int (*setpos)(struct adfs_dir *dir, unsigned int fpos);
126 int (*getnext)(struct adfs_dir *dir, struct object_info *obj);
127 int (*update)(struct adfs_dir *dir, struct object_info *obj);
128 int (*create)(struct adfs_dir *dir, struct object_info *obj);
129 int (*remove)(struct adfs_dir *dir, struct object_info *obj);
130 int (*sync)(struct adfs_dir *dir);
131 void (*free)(struct adfs_dir *dir);
132 };
133
134 struct adfs_discmap {
135 struct buffer_head *dm_bh;
136 __u32 dm_startblk;
137 unsigned int dm_startbit;
138 unsigned int dm_endbit;
139 };
140
141
142 struct inode *adfs_iget(struct super_block *sb, struct object_info *obj);
143 int adfs_write_inode(struct inode *inode, struct writeback_control *wbc);
144 int adfs_notify_change(struct dentry *dentry, struct iattr *attr);
145
146
147 int adfs_map_lookup(struct super_block *sb, u32 frag_id, unsigned int offset);
148 extern unsigned int adfs_map_free(struct super_block *sb);
149
150
151 __printf(3, 4)
152 void __adfs_error(struct super_block *sb, const char *function,
153 const char *fmt, ...);
154 #define adfs_error(sb, fmt...) __adfs_error(sb, __func__, fmt)
155 void adfs_msg(struct super_block *sb, const char *pfx, const char *fmt, ...);
156
157
158
159
160
161
162
163
164 extern const struct inode_operations adfs_dir_inode_operations;
165 extern const struct file_operations adfs_dir_operations;
166 extern const struct dentry_operations adfs_dentry_operations;
167 extern const struct adfs_dir_ops adfs_f_dir_ops;
168 extern const struct adfs_dir_ops adfs_fplus_dir_ops;
169
170 void adfs_object_fixup(struct adfs_dir *dir, struct object_info *obj);
171 extern int adfs_dir_update(struct super_block *sb, struct object_info *obj,
172 int wait);
173
174
175 extern const struct inode_operations adfs_file_inode_operations;
176 extern const struct file_operations adfs_file_operations;
177
178 static inline __u32 signed_asl(__u32 val, signed int shift)
179 {
180 if (shift >= 0)
181 val <<= shift;
182 else
183 val >>= -shift;
184 return val;
185 }
186
187
188
189
190
191
192
193 static inline int __adfs_block_map(struct super_block *sb, u32 indaddr,
194 unsigned int block)
195 {
196 if (indaddr & 255) {
197 unsigned int off;
198
199 off = (indaddr & 255) - 1;
200 block += off << ADFS_SB(sb)->s_log2sharesize;
201 }
202
203 return adfs_map_lookup(sb, indaddr >> 8, block);
204 }
205
206
207 static inline
208 struct adfs_discrecord *adfs_map_discrecord(struct adfs_discmap *dm)
209 {
210 return (void *)(dm[0].dm_bh->b_data + 4);
211 }
212
213 static inline u64 adfs_disc_size(const struct adfs_discrecord *dr)
214 {
215 return (u64)le32_to_cpu(dr->disc_size_high) << 32 |
216 le32_to_cpu(dr->disc_size);
217 }