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