Wireless: remove driver_data direct access of struct device
[linux/fpc-iii.git] / fs / adfs / adfs.h
blobe0a85dbeeb887138b2389d417b2da3354af0d271
1 /* Internal data structures for ADFS */
3 #define ADFS_FREE_FRAG 0
4 #define ADFS_BAD_FRAG 1
5 #define ADFS_ROOT_FRAG 2
7 #define ADFS_NDA_OWNER_READ (1 << 0)
8 #define ADFS_NDA_OWNER_WRITE (1 << 1)
9 #define ADFS_NDA_LOCKED (1 << 2)
10 #define ADFS_NDA_DIRECTORY (1 << 3)
11 #define ADFS_NDA_EXECUTE (1 << 4)
12 #define ADFS_NDA_PUBLIC_READ (1 << 5)
13 #define ADFS_NDA_PUBLIC_WRITE (1 << 6)
15 #include "dir_f.h"
17 struct buffer_head;
20 * Directory handling
22 struct adfs_dir {
23 struct super_block *sb;
25 int nr_buffers;
26 struct buffer_head *bh[4];
27 unsigned int pos;
28 unsigned int parent_id;
30 struct adfs_dirheader dirhead;
31 union adfs_dirtail dirtail;
35 * This is the overall maximum name length
37 #define ADFS_MAX_NAME_LEN 256
38 struct object_info {
39 __u32 parent_id; /* parent object id */
40 __u32 file_id; /* object id */
41 __u32 loadaddr; /* load address */
42 __u32 execaddr; /* execution address */
43 __u32 size; /* size */
44 __u8 attr; /* RISC OS attributes */
45 unsigned char name_len; /* name length */
46 char name[ADFS_MAX_NAME_LEN];/* file name */
49 struct adfs_dir_ops {
50 int (*read)(struct super_block *sb, unsigned int id, unsigned int sz, struct adfs_dir *dir);
51 int (*setpos)(struct adfs_dir *dir, unsigned int fpos);
52 int (*getnext)(struct adfs_dir *dir, struct object_info *obj);
53 int (*update)(struct adfs_dir *dir, struct object_info *obj);
54 int (*create)(struct adfs_dir *dir, struct object_info *obj);
55 int (*remove)(struct adfs_dir *dir, struct object_info *obj);
56 void (*free)(struct adfs_dir *dir);
59 struct adfs_discmap {
60 struct buffer_head *dm_bh;
61 __u32 dm_startblk;
62 unsigned int dm_startbit;
63 unsigned int dm_endbit;
66 /* Inode stuff */
67 struct inode *adfs_iget(struct super_block *sb, struct object_info *obj);
68 int adfs_write_inode(struct inode *inode,int unused);
69 int adfs_notify_change(struct dentry *dentry, struct iattr *attr);
71 /* map.c */
72 extern int adfs_map_lookup(struct super_block *sb, unsigned int frag_id, unsigned int offset);
73 extern unsigned int adfs_map_free(struct super_block *sb);
75 /* Misc */
76 void __adfs_error(struct super_block *sb, const char *function,
77 const char *fmt, ...);
78 #define adfs_error(sb, fmt...) __adfs_error(sb, __func__, fmt)
80 /* super.c */
83 * Inodes and file operations
86 /* dir_*.c */
87 extern const struct inode_operations adfs_dir_inode_operations;
88 extern const struct file_operations adfs_dir_operations;
89 extern const struct dentry_operations adfs_dentry_operations;
90 extern struct adfs_dir_ops adfs_f_dir_ops;
91 extern struct adfs_dir_ops adfs_fplus_dir_ops;
93 extern int adfs_dir_update(struct super_block *sb, struct object_info *obj);
95 /* file.c */
96 extern const struct inode_operations adfs_file_inode_operations;
97 extern const struct file_operations adfs_file_operations;
99 static inline __u32 signed_asl(__u32 val, signed int shift)
101 if (shift >= 0)
102 val <<= shift;
103 else
104 val >>= -shift;
105 return val;
109 * Calculate the address of a block in an object given the block offset
110 * and the object identity.
112 * The root directory ID should always be looked up in the map [3.4]
114 static inline int
115 __adfs_block_map(struct super_block *sb, unsigned int object_id,
116 unsigned int block)
118 if (object_id & 255) {
119 unsigned int off;
121 off = (object_id & 255) - 1;
122 block += off << ADFS_SB(sb)->s_log2sharesize;
125 return adfs_map_lookup(sb, object_id >> 8, block);