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 int s_rock_offset;
39 unsigned char s_joliet_level;
40 unsigned char s_mapping;
41 unsigned int s_high_sierra:1;
42 unsigned int s_rock:2;
43 unsigned int s_utf8:1;
44 unsigned int s_cruft:1;
45
46 unsigned int s_nocompress:1;
47 unsigned int s_hide:1;
48 unsigned int s_showassoc:1;
49 unsigned int s_overriderockperm:1;
50 unsigned int s_uid_set:1;
51 unsigned int s_gid_set:1;
52
53 mode_t s_fmode;
54 mode_t s_dmode;
55 gid_t s_gid;
56 uid_t s_uid;
57 struct nls_table *s_nls_iocharset;
58};
59
60#define ISOFS_INVALID_MODE ((mode_t) -1)
61
62static inline struct isofs_sb_info *ISOFS_SB(struct super_block *sb)
63{
64 return sb->s_fs_info;
65}
66
67static inline struct iso_inode_info *ISOFS_I(struct inode *inode)
68{
69 return container_of(inode, struct iso_inode_info, vfs_inode);
70}
71
72static inline int isonum_711(char *p)
73{
74 return *(u8 *)p;
75}
76static inline int isonum_712(char *p)
77{
78 return *(s8 *)p;
79}
80static inline unsigned int isonum_721(char *p)
81{
82 return get_unaligned_le16(p);
83}
84static inline unsigned int isonum_722(char *p)
85{
86 return get_unaligned_be16(p);
87}
88static inline unsigned int isonum_723(char *p)
89{
90
91 return get_unaligned_le16(p);
92}
93static inline unsigned int isonum_731(char *p)
94{
95 return get_unaligned_le32(p);
96}
97static inline unsigned int isonum_732(char *p)
98{
99 return get_unaligned_be32(p);
100}
101static inline unsigned int isonum_733(char *p)
102{
103
104 return get_unaligned_le32(p);
105}
106extern int iso_date(char *, int);
107
108struct inode;
109
110extern int parse_rock_ridge_inode(struct iso_directory_record *, struct inode *);
111extern int get_rock_ridge_filename(struct iso_directory_record *, char *, struct inode *);
112extern int isofs_name_translate(struct iso_directory_record *, char *, struct inode *);
113
114int get_joliet_filename(struct iso_directory_record *, unsigned char *, struct inode *);
115int get_acorn_filename(struct iso_directory_record *, char *, struct inode *);
116
117extern struct dentry *isofs_lookup(struct inode *, struct dentry *, struct nameidata *);
118extern struct buffer_head *isofs_bread(struct inode *, sector_t);
119extern int isofs_get_blocks(struct inode *, sector_t, struct buffer_head **, unsigned long);
120
121extern struct inode *isofs_iget(struct super_block *sb,
122 unsigned long block,
123 unsigned long offset);
124
125
126
127
128
129static inline unsigned long isofs_get_ino(unsigned long block,
130 unsigned long offset,
131 unsigned long bufbits)
132{
133 return (block << (bufbits - 5)) | (offset >> 5);
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
166
167static inline void
168isofs_normalize_block_and_offset(struct iso_directory_record* de,
169 unsigned long *block,
170 unsigned long *offset)
171{
172
173 if (de->flags[0] & 2) {
174 *offset = 0;
175 *block = (unsigned long)isonum_733(de->extent)
176 + (unsigned long)isonum_711(de->ext_attr_length);
177 }
178}
179
180extern const struct inode_operations isofs_dir_inode_operations;
181extern const struct file_operations isofs_dir_operations;
182extern const struct address_space_operations isofs_symlink_aops;
183extern const struct export_operations isofs_export_ops;
184