00001
00002 #ifndef _ISOFS_FS_H
00003 #define _ISOFS_FS_H
00004
00005 #include <linux/types.h>
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #define ISODCL(from, to) (to - from + 1)
00016
00017 struct iso_volume_descriptor {
00018 char type[ISODCL(1,1)];
00019 char id[ISODCL(2,6)];
00020 char version[ISODCL(7,7)];
00021 char data[ISODCL(8,2048)];
00022 };
00023
00024
00025 #define ISO_VD_PRIMARY 1
00026 #define ISO_VD_END 255
00027
00028 #define ISO_STANDARD_ID "CD001"
00029
00030 struct iso_primary_descriptor {
00031 char type [ISODCL ( 1, 1)];
00032 char id [ISODCL ( 2, 6)];
00033 char version [ISODCL ( 7, 7)];
00034 char unused1 [ISODCL ( 8, 8)];
00035 char system_id [ISODCL ( 9, 40)];
00036 char volume_id [ISODCL ( 41, 72)];
00037 char unused2 [ISODCL ( 73, 80)];
00038 char volume_space_size [ISODCL ( 81, 88)];
00039 char unused3 [ISODCL ( 89, 120)];
00040 char volume_set_size [ISODCL (121, 124)];
00041 char volume_sequence_number [ISODCL (125, 128)];
00042 char logical_block_size [ISODCL (129, 132)];
00043 char path_table_size [ISODCL (133, 140)];
00044 char type_l_path_table [ISODCL (141, 144)];
00045 char opt_type_l_path_table [ISODCL (145, 148)];
00046 char type_m_path_table [ISODCL (149, 152)];
00047 char opt_type_m_path_table [ISODCL (153, 156)];
00048 char root_directory_record [ISODCL (157, 190)];
00049 char volume_set_id [ISODCL (191, 318)];
00050 char publisher_id [ISODCL (319, 446)];
00051 char preparer_id [ISODCL (447, 574)];
00052 char application_id [ISODCL (575, 702)];
00053 char copyright_file_id [ISODCL (703, 739)];
00054 char abstract_file_id [ISODCL (740, 776)];
00055 char bibliographic_file_id [ISODCL (777, 813)];
00056 char creation_date [ISODCL (814, 830)];
00057 char modification_date [ISODCL (831, 847)];
00058 char expiration_date [ISODCL (848, 864)];
00059 char effective_date [ISODCL (865, 881)];
00060 char file_structure_version [ISODCL (882, 882)];
00061 char unused4 [ISODCL (883, 883)];
00062 char application_data [ISODCL (884, 1395)];
00063 char unused5 [ISODCL (1396, 2048)];
00064 };
00065
00066
00067 #define HS_STANDARD_ID "CDROM"
00068
00069 struct hs_volume_descriptor {
00070 char foo [ISODCL ( 1, 8)];
00071 char type [ISODCL ( 9, 9)];
00072 char id [ISODCL ( 10, 14)];
00073 char version [ISODCL ( 15, 15)];
00074 char data[ISODCL(16,2048)];
00075 };
00076
00077
00078 struct hs_primary_descriptor {
00079 char foo [ISODCL ( 1, 8)];
00080 char type [ISODCL ( 9, 9)];
00081 char id [ISODCL ( 10, 14)];
00082 char version [ISODCL ( 15, 15)];
00083 char unused1 [ISODCL ( 16, 16)];
00084 char system_id [ISODCL ( 17, 48)];
00085 char volume_id [ISODCL ( 49, 80)];
00086 char unused2 [ISODCL ( 81, 88)];
00087 char volume_space_size [ISODCL ( 89, 96)];
00088 char unused3 [ISODCL ( 97, 128)];
00089 char volume_set_size [ISODCL (129, 132)];
00090 char volume_sequence_number [ISODCL (133, 136)];
00091 char logical_block_size [ISODCL (137, 140)];
00092 char path_table_size [ISODCL (141, 148)];
00093 char type_l_path_table [ISODCL (149, 152)];
00094 char unused4 [ISODCL (153, 180)];
00095 char root_directory_record [ISODCL (181, 214)];
00096 };
00097
00098
00099
00100 struct iso_path_table{
00101 unsigned char name_len[2];
00102 char extent[4];
00103 char parent[2];
00104 char name[0];
00105 };
00106
00107
00108
00109
00110
00111
00112
00113
00114 struct iso_directory_record {
00115 char length [ISODCL (1, 1)];
00116 char ext_attr_length [ISODCL (2, 2)];
00117 char extent [ISODCL (3, 10)];
00118 char size [ISODCL (11, 18)];
00119 char date [ISODCL (19, 25)];
00120 char flags [ISODCL (26, 26)];
00121 char file_unit_size [ISODCL (27, 27)];
00122 char interleave [ISODCL (28, 28)];
00123 char volume_sequence_number [ISODCL (29, 32)];
00124 unsigned char name_len [ISODCL (33, 33)];
00125 char name [0];
00126 };
00127
00128 extern int isonum_711(char *);
00129 extern int isonum_712(char *);
00130 extern int isonum_721(char *);
00131 extern int isonum_722(char *);
00132 extern int isonum_723(char *);
00133 extern int isonum_731(char *);
00134 extern int isonum_732(char *);
00135 extern int isonum_733(char *);
00136 extern int iso_date(char *, int);
00137
00138 extern int parse_rock_ridge_inode(struct iso_directory_record *, struct inode *);
00139 extern int get_rock_ridge_filename(struct iso_directory_record *, char ** name, int * len, struct inode *);
00140
00141 extern char * get_rock_ridge_symlink(struct inode *);
00142 extern int find_rock_ridge_relocation(struct iso_directory_record *, struct inode *);
00143
00144 #define ISOFS_BLOCK_BITS 11
00145 #define ISOFS_BLOCK_SIZE 2048
00146
00147 #define ISOFS_BUFFER_SIZE(INODE) ((INODE)->i_sb->s_blocksize)
00148 #define ISOFS_BUFFER_BITS(INODE) ((INODE)->i_sb->s_blocksize_bits)
00149
00150 #if 0
00151 #ifdef ISOFS_FIXED_BLOCKSIZE
00152
00153 #define ISOFS_BUFFER_BITS 10
00154 #define ISOFS_BUFFER_SIZE 1024
00155
00156 #define ISOFS_BLOCK_NUMBER(X) (X<<1)
00157 #else
00158 #define ISOFS_BUFFER_BITS 11
00159 #define ISOFS_BUFFER_SIZE 2048
00160
00161 #define ISOFS_BLOCK_NUMBER(X) (X)
00162 #endif
00163 #endif
00164
00165 #define ISOFS_SUPER_MAGIC 0x9660
00166 #define ISOFS_FILE_UNKNOWN 0
00167 #define ISOFS_FILE_TEXT 1
00168 #define ISOFS_FILE_BINARY 2
00169 #define ISOFS_FILE_TEXT_M 3
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179 extern int isofs_open(struct inode * inode, struct file * filp);
00180 extern void isofs_release(struct inode * inode, struct file * filp);
00181 extern int isofs_lookup(struct inode * dir,const char * name, int len,
00182 struct inode ** result);
00183 extern unsigned long isofs_count_free_inodes(struct super_block *sb);
00184 extern int isofs_new_block(int dev);
00185 extern int isofs_free_block(int dev, int block);
00186 extern int isofs_bmap(struct inode *,int);
00187
00188 extern void isofs_put_super(struct super_block *);
00189 extern struct super_block *isofs_read_super(struct super_block *,void *,int);
00190 extern void isofs_read_inode(struct inode *);
00191 extern void isofs_put_inode(struct inode *);
00192 extern void isofs_statfs(struct super_block *, struct statfs *);
00193
00194 extern int isofs_lseek(struct inode *, struct file *, off_t, int);
00195 extern int isofs_read(struct inode *, struct file *, char *, int);
00196 extern int isofs_lookup_grandparent(struct inode *, int);
00197
00198 extern struct inode_operations isofs_file_inode_operations;
00199 extern struct inode_operations isofs_dir_inode_operations;
00200 extern struct inode_operations isofs_symlink_inode_operations;
00201 extern struct inode_operations isofs_chrdev_inode_operations;
00202 extern struct inode_operations isofs_blkdev_inode_operations;
00203 extern struct inode_operations isofs_fifo_inode_operations;
00204
00205 struct lookup_cache{
00206 unsigned long dir;
00207 dev_t dev;
00208 unsigned short dlen;
00209 char filename[256];
00210 unsigned long ino;
00211 };
00212
00213 extern struct lookup_cache cache;
00214
00215
00216 #ifdef LEAK_CHECK
00217 #define free_s leak_check_free_s
00218 #define malloc leak_check_malloc
00219 #define bread leak_check_bread
00220 #define brelse leak_check_brelse
00221 extern void * leak_check_malloc(unsigned int size);
00222 extern void leak_check_free_s(void * obj, int size);
00223 extern struct buffer_head * leak_check_bread(int dev, int block, int size);
00224 extern void leak_check_brelse(struct buffer_head * bh);
00225 #endif // LEAK_CHECK
00226
00227 #endif
00228
00229
00230