Fix: rseq: arm branch to failure
[deliverable/linux.git] / fs / isofs / isofs.h
CommitLineData
94f2f715
AV
1#include <linux/fs.h>
2#include <linux/buffer_head.h>
a5694255 3#include <linux/exportfs.h>
94f2f715
AV
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 * iso fs inode data in memory
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 * iso9660 super-block data in memory
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
94f2f715 38 int s_rock_offset; /* offset of SUSP fields within SU area */
94f2f715 39 unsigned char s_joliet_level;
5404ac8e
JK
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; /* Broken disks with high byte of length
45 * containing junk */
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;
94f2f715 52
7328bdd6
AV
53 umode_t s_fmode;
54 umode_t s_dmode;
ba64e2b9
EB
55 kgid_t s_gid;
56 kuid_t s_uid;
94f2f715
AV
57 struct nls_table *s_nls_iocharset; /* Native language support table */
58};
59
7328bdd6 60#define ISOFS_INVALID_MODE ((umode_t) -1)
52b680c8 61
94f2f715
AV
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{
58d485d4 82 return get_unaligned_le16(p);
94f2f715
AV
83}
84static inline unsigned int isonum_722(char *p)
85{
58d485d4 86 return get_unaligned_be16(p);
94f2f715
AV
87}
88static inline unsigned int isonum_723(char *p)
89{
90 /* Ignore bigendian datum due to broken mastering programs */
58d485d4 91 return get_unaligned_le16(p);
94f2f715
AV
92}
93static inline unsigned int isonum_731(char *p)
94{
58d485d4 95 return get_unaligned_le32(p);
94f2f715
AV
96}
97static inline unsigned int isonum_732(char *p)
98{
58d485d4 99 return get_unaligned_be32(p);
94f2f715
AV
100}
101static inline unsigned int isonum_733(char *p)
102{
103 /* Ignore bigendian datum due to broken mastering programs */
58d485d4 104 return get_unaligned_le32(p);
94f2f715
AV
105}
106extern int iso_date(char *, int);
107
108struct inode; /* To make gcc happy */
109
410dd3cf 110extern int parse_rock_ridge_inode(struct iso_directory_record *, struct inode *, int relocated);
94f2f715
AV
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
00cd8dd3 117extern struct dentry *isofs_lookup(struct inode *, struct dentry *, unsigned int flags);
94f2f715
AV
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
410dd3cf
JK
121struct inode *__isofs_iget(struct super_block *sb,
122 unsigned long block,
123 unsigned long offset,
124 int relocated);
125
126static inline struct inode *isofs_iget(struct super_block *sb,
127 unsigned long block,
128 unsigned long offset)
129{
130 return __isofs_iget(sb, block, offset, 0);
131}
132
133static inline struct inode *isofs_iget_reloc(struct super_block *sb,
134 unsigned long block,
135 unsigned long offset)
136{
137 return __isofs_iget(sb, block, offset, 1);
138}
94f2f715
AV
139
140/* Because the inode number is no longer relevant to finding the
141 * underlying meta-data for an inode, we are free to choose a more
142 * convenient 32-bit number as the inode number. The inode numbering
143 * scheme was recommended by Sergey Vlasov and Eric Lammerts. */
144static inline unsigned long isofs_get_ino(unsigned long block,
145 unsigned long offset,
146 unsigned long bufbits)
147{
148 return (block << (bufbits - 5)) | (offset >> 5);
149}
150
151/* Every directory can have many redundant directory entries scattered
152 * throughout the directory tree. First there is the directory entry
153 * with the name of the directory stored in the parent directory.
154 * Then, there is the "." directory entry stored in the directory
155 * itself. Finally, there are possibly many ".." directory entries
156 * stored in all the subdirectories.
157 *
158 * In order for the NFS get_parent() method to work and for the
159 * general consistency of the dcache, we need to make sure the
160 * "i_iget5_block" and "i_iget5_offset" all point to exactly one of
161 * the many redundant entries for each directory. We normalize the
162 * block and offset by always making them point to the "." directory.
163 *
164 * Notice that we do not use the entry for the directory with the name
165 * that is located in the parent directory. Even though choosing this
166 * first directory is more natural, it is much easier to find the "."
167 * entry in the NFS get_parent() method because it is implicitly
168 * encoded in the "extent + ext_attr_length" fields of _all_ the
169 * redundant entries for the directory. Thus, it can always be
170 * reached regardless of which directory entry you have in hand.
171 *
172 * This works because the "." entry is simply the first directory
173 * record when you start reading the file that holds all the directory
174 * records, and this file starts at "extent + ext_attr_length" blocks.
175 * Because the "." entry is always the first entry listed in the
176 * directories file, the normalized "offset" value is always 0.
177 *
178 * You should pass the directory entry in "de". On return, "block"
179 * and "offset" will hold normalized values. Only directories are
180 * affected making it safe to call even for non-directory file
181 * types. */
182static inline void
183isofs_normalize_block_and_offset(struct iso_directory_record* de,
184 unsigned long *block,
185 unsigned long *offset)
186{
187 /* Only directories are normalized. */
188 if (de->flags[0] & 2) {
189 *offset = 0;
190 *block = (unsigned long)isonum_733(de->extent)
191 + (unsigned long)isonum_711(de->ext_attr_length);
192 }
193}
194
92e1d5be 195extern const struct inode_operations isofs_dir_inode_operations;
4b6f5d20 196extern const struct file_operations isofs_dir_operations;
f5e54d6e 197extern const struct address_space_operations isofs_symlink_aops;
39655164 198extern const struct export_operations isofs_export_ops;
This page took 0.794935 seconds and 5 git commands to generate.