mv643xx_eth: fix PPC DMA breakage
[linux-2.6/verdex.git] / fs / isofs / isofs.h
blobccbf72faf27ada523b4abf8d1fa2dc1f42283e1e
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>
7 enum isofs_file_format {
8 isofs_file_normal = 0,
9 isofs_file_sparse = 1,
10 isofs_file_compressed = 2,
14 * iso fs inode data in memory
16 struct 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;
29 * iso9660 super-block data in memory
31 struct 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;
38 unsigned char s_high_sierra; /* A simple flag */
39 unsigned char s_mapping;
40 int s_rock_offset; /* offset of SUSP fields within SU area */
41 unsigned char s_rock;
42 unsigned char s_joliet_level;
43 unsigned char s_utf8;
44 unsigned char s_cruft; /* Broken disks with high
45 byte of length containing
46 junk */
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;
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; /* Native language support table */
61 static inline struct isofs_sb_info *ISOFS_SB(struct super_block *sb)
63 return sb->s_fs_info;
66 static inline struct iso_inode_info *ISOFS_I(struct inode *inode)
68 return container_of(inode, struct iso_inode_info, vfs_inode);
71 static inline int isonum_711(char *p)
73 return *(u8 *)p;
75 static inline int isonum_712(char *p)
77 return *(s8 *)p;
79 static inline unsigned int isonum_721(char *p)
81 return get_unaligned_le16(p);
83 static inline unsigned int isonum_722(char *p)
85 return get_unaligned_be16(p);
87 static inline unsigned int isonum_723(char *p)
89 /* Ignore bigendian datum due to broken mastering programs */
90 return get_unaligned_le16(p);
92 static inline unsigned int isonum_731(char *p)
94 return get_unaligned_le32(p);
96 static inline unsigned int isonum_732(char *p)
98 return get_unaligned_be32(p);
100 static inline unsigned int isonum_733(char *p)
102 /* Ignore bigendian datum due to broken mastering programs */
103 return get_unaligned_le32(p);
105 extern int iso_date(char *, int);
107 struct inode; /* To make gcc happy */
109 extern int parse_rock_ridge_inode(struct iso_directory_record *, struct inode *);
110 extern int get_rock_ridge_filename(struct iso_directory_record *, char *, struct inode *);
111 extern int isofs_name_translate(struct iso_directory_record *, char *, struct inode *);
113 int get_joliet_filename(struct iso_directory_record *, unsigned char *, struct inode *);
114 int get_acorn_filename(struct iso_directory_record *, char *, struct inode *);
116 extern struct dentry *isofs_lookup(struct inode *, struct dentry *, struct nameidata *);
117 extern struct buffer_head *isofs_bread(struct inode *, sector_t);
118 extern int isofs_get_blocks(struct inode *, sector_t, struct buffer_head **, unsigned long);
120 extern struct inode *isofs_iget(struct super_block *sb,
121 unsigned long block,
122 unsigned long offset);
124 /* Because the inode number is no longer relevant to finding the
125 * underlying meta-data for an inode, we are free to choose a more
126 * convenient 32-bit number as the inode number. The inode numbering
127 * scheme was recommended by Sergey Vlasov and Eric Lammerts. */
128 static inline unsigned long isofs_get_ino(unsigned long block,
129 unsigned long offset,
130 unsigned long bufbits)
132 return (block << (bufbits - 5)) | (offset >> 5);
135 /* Every directory can have many redundant directory entries scattered
136 * throughout the directory tree. First there is the directory entry
137 * with the name of the directory stored in the parent directory.
138 * Then, there is the "." directory entry stored in the directory
139 * itself. Finally, there are possibly many ".." directory entries
140 * stored in all the subdirectories.
142 * In order for the NFS get_parent() method to work and for the
143 * general consistency of the dcache, we need to make sure the
144 * "i_iget5_block" and "i_iget5_offset" all point to exactly one of
145 * the many redundant entries for each directory. We normalize the
146 * block and offset by always making them point to the "." directory.
148 * Notice that we do not use the entry for the directory with the name
149 * that is located in the parent directory. Even though choosing this
150 * first directory is more natural, it is much easier to find the "."
151 * entry in the NFS get_parent() method because it is implicitly
152 * encoded in the "extent + ext_attr_length" fields of _all_ the
153 * redundant entries for the directory. Thus, it can always be
154 * reached regardless of which directory entry you have in hand.
156 * This works because the "." entry is simply the first directory
157 * record when you start reading the file that holds all the directory
158 * records, and this file starts at "extent + ext_attr_length" blocks.
159 * Because the "." entry is always the first entry listed in the
160 * directories file, the normalized "offset" value is always 0.
162 * You should pass the directory entry in "de". On return, "block"
163 * and "offset" will hold normalized values. Only directories are
164 * affected making it safe to call even for non-directory file
165 * types. */
166 static inline void
167 isofs_normalize_block_and_offset(struct iso_directory_record* de,
168 unsigned long *block,
169 unsigned long *offset)
171 /* Only directories are normalized. */
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);
179 extern const struct inode_operations isofs_dir_inode_operations;
180 extern const struct file_operations isofs_dir_operations;
181 extern const struct address_space_operations isofs_symlink_aops;
182 extern const struct export_operations isofs_export_ops;