1#include <linux/fs.h>
2#include <linux/buffer_head.h>
3#include <linux/exportfs.h>
4#include <linux/iso_fs.h>
5#include <asm/unaligned.h>
6
7enum isofs_file_format {
8 isofs_file_normal = 0,
9 isofs_file_sparse = 1,
10 isofs_file_compressed = 2,
11};
12
13
14
15
16struct iso_inode_info {
17 unsigned long i_iget5_block;
18 unsigned long i_iget5_offset;
19 unsigned int i_first_extent;
20 unsigned char i_file_format;
21 unsigned char i_format_parm[3];
22 unsigned long i_next_section_block;
23 unsigned long i_next_section_offset;
24 off_t i_section_size;
25 struct inode vfs_inode;
26};
27
28
29
30
31struct isofs_sb_info {
32 unsigned long s_ninodes;
33 unsigned long s_nzones;
34 unsigned long s_firstdatazone;
35 unsigned long s_log_zone_size;
36 unsigned long s_max_size;
37
38 unsigned char s_high_sierra;
39 unsigned char s_mapping;
40 int s_rock_offset;
41 unsigned char s_rock;
42 unsigned char s_joliet_level;
43 unsigned char s_utf8;
44 unsigned char s_cruft;
45
46
47 unsigned char s_unhide;
48 unsigned char s_nosuid;
49 unsigned char s_nodev;
50 unsigned char s_nocompress;
51 unsigned char s_hide;
52 unsigned char s_showassoc;
53
54 mode_t s_fmode;
55 mode_t s_dmode;
56 gid_t s_gid;
57 uid_t s_uid;
58 struct nls_table *s_nls_iocharset;
59};
60
61static inline struct isofs_sb_info *ISOFS_SB(struct super_block *sb)
62{
63 return sb->s_fs_info;
64}
65
66static inline struct iso_inode_info *ISOFS_I(struct inode *inode)
67{
68 return container_of(inode, struct iso_inode_info, vfs_inode);
69}
70
71static inline int isonum_711(char *p)
72{
73 return *(u8 *)p;
74}
75static inline int isonum_712(char *p)
76{
77 return *(s8 *)p;
78}
79static inline unsigned int isonum_721(char *p)
80{
81 return le16_to_cpu(get_unaligned((__le16 *)p));
82}
83static inline unsigned int isonum_722(char *p)
84{
85 return be16_to_cpu(get_unaligned((__le16 *)p));
86}
87static inline unsigned int isonum_723(char *p)
88{
89
90 return le16_to_cpu(get_unaligned((__le16 *)p));
91}
92static inline unsigned int isonum_731(char *p)
93{
94 return le32_to_cpu(get_unaligned((__le32 *)p));
95}
96static inline unsigned int isonum_732(char *p)
97{
98 return be32_to_cpu(get_unaligned((__le32 *)p));
99}
100static inline unsigned int isonum_733(char *p)
101{
102
103 return le32_to_cpu(get_unaligned((__le32 *)p));
104}
105extern int iso_date(char *, int);
106
107struct inode;
108
109extern int parse_rock_ridge_inode(struct iso_directory_record *, struct inode *);
110extern int get_rock_ridge_filename(struct iso_directory_record *, char *, struct inode *);
111extern int isofs_name_translate(struct iso_directory_record *, char *, struct inode *);
112
113int get_joliet_filename(struct iso_directory_record *, unsigned char *, struct inode *);
114int get_acorn_filename(struct iso_directory_record *, char *, struct inode *);
115
116extern struct dentry *isofs_lookup(struct inode *, struct dentry *, struct nameidata *);
117extern struct buffer_head *isofs_bread(struct inode *, sector_t);
118extern int isofs_get_blocks(struct inode *, sector_t, struct buffer_head **, unsigned long);
119
120extern struct inode *isofs_iget(struct super_block *sb,
121 unsigned long block,
122 unsigned long offset);
123
124
125
126
127
128static inline unsigned long isofs_get_ino(unsigned long block,
129 unsigned long offset,
130 unsigned long bufbits)
131{
132 return (block << (bufbits - 5)) | (offset >> 5);
133}
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166static inline void
167isofs_normalize_block_and_offset(struct iso_directory_record* de,
168 unsigned long *block,
169 unsigned long *offset)
170{
171
172 if (de->flags[0] & 2) {
173 *offset = 0;
174 *block = (unsigned long)isonum_733(de->extent)
175 + (unsigned long)isonum_711(de->ext_attr_length);
176 }
177}
178
179extern const struct inode_operations isofs_dir_inode_operations;
180extern const struct file_operations isofs_dir_operations;
181extern const struct address_space_operations isofs_symlink_aops;
182extern const struct export_operations isofs_export_ops;
183