iso_fs.h

Go to the documentation of this file.
00001 
00002 #ifndef _ISOFS_FS_H
00003 #define _ISOFS_FS_H
00004 
00005 #include <linux/types.h>
00006 /**
00007 *
00008 
00009  * The isofs filesystem constants/structures
00010 
00011 
00012 */
00013 
00014 /// This part borrowed from the bsd386 isofs 
00015 #define ISODCL(from, to) (to - from + 1)
00016 
00017 struct iso_volume_descriptor {
00018         char type[ISODCL(1,1)]; ///< 711 
00019         char id[ISODCL(2,6)];
00020         char version[ISODCL(7,7)];
00021         char data[ISODCL(8,2048)];
00022 };
00023 
00024 /// volume descriptor types 
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)]; ///< 711 
00032         char id                         [ISODCL (  2,   6)];
00033         char version                    [ISODCL (  7,   7)]; ///< 711 
00034         char unused1                    [ISODCL (  8,   8)];
00035         char system_id                  [ISODCL (  9,  40)]; ///< achars 
00036         char volume_id                  [ISODCL ( 41,  72)]; ///< dchars 
00037         char unused2                    [ISODCL ( 73,  80)];
00038         char volume_space_size          [ISODCL ( 81,  88)]; ///< 733 
00039         char unused3                    [ISODCL ( 89, 120)];
00040         char volume_set_size            [ISODCL (121, 124)]; ///< 723 
00041         char volume_sequence_number     [ISODCL (125, 128)]; ///< 723 
00042         char logical_block_size         [ISODCL (129, 132)]; ///< 723 
00043         char path_table_size            [ISODCL (133, 140)]; ///< 733 
00044         char type_l_path_table          [ISODCL (141, 144)]; ///< 731 
00045         char opt_type_l_path_table      [ISODCL (145, 148)]; ///< 731 
00046         char type_m_path_table          [ISODCL (149, 152)]; ///< 732 
00047         char opt_type_m_path_table      [ISODCL (153, 156)]; ///< 732 
00048         char root_directory_record      [ISODCL (157, 190)]; ///< 9.1 
00049         char volume_set_id              [ISODCL (191, 318)]; ///< dchars 
00050         char publisher_id               [ISODCL (319, 446)]; ///< achars 
00051         char preparer_id                [ISODCL (447, 574)]; ///< achars 
00052         char application_id             [ISODCL (575, 702)]; ///< achars 
00053         char copyright_file_id          [ISODCL (703, 739)]; ///< 7.5 dchars 
00054         char abstract_file_id           [ISODCL (740, 776)]; ///< 7.5 dchars 
00055         char bibliographic_file_id      [ISODCL (777, 813)]; ///< 7.5 dchars 
00056         char creation_date              [ISODCL (814, 830)]; ///< 8.4.26.1 
00057         char modification_date          [ISODCL (831, 847)]; ///< 8.4.26.1 
00058         char expiration_date            [ISODCL (848, 864)]; ///< 8.4.26.1 
00059         char effective_date             [ISODCL (865, 881)]; ///< 8.4.26.1 
00060         char file_structure_version     [ISODCL (882, 882)]; ///< 711 
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)]; ///< 733 
00071         char type                       [ISODCL (  9,   9)]; ///< 711 
00072         char id                         [ISODCL ( 10,  14)];
00073         char version                    [ISODCL ( 15,  15)]; ///< 711 
00074         char data[ISODCL(16,2048)];
00075 };
00076 
00077 
00078 struct hs_primary_descriptor {
00079         char foo                        [ISODCL (  1,   8)]; ///< 733 
00080         char type                       [ISODCL (  9,   9)]; ///< 711 
00081         char id                         [ISODCL ( 10,  14)];
00082         char version                    [ISODCL ( 15,  15)]; ///< 711 
00083         char unused1                    [ISODCL ( 16,  16)]; ///< 711 
00084         char system_id                  [ISODCL ( 17,  48)]; ///< achars 
00085         char volume_id                  [ISODCL ( 49,  80)]; ///< dchars 
00086         char unused2                    [ISODCL ( 81,  88)]; ///< 733 
00087         char volume_space_size          [ISODCL ( 89,  96)]; ///< 733 
00088         char unused3                    [ISODCL ( 97, 128)]; ///< 733 
00089         char volume_set_size            [ISODCL (129, 132)]; ///< 723 
00090         char volume_sequence_number     [ISODCL (133, 136)]; ///< 723 
00091         char logical_block_size         [ISODCL (137, 140)]; ///< 723 
00092         char path_table_size            [ISODCL (141, 148)]; ///< 733 
00093         char type_l_path_table          [ISODCL (149, 152)]; ///< 731 
00094         char unused4                    [ISODCL (153, 180)]; ///< 733 
00095         char root_directory_record      [ISODCL (181, 214)]; ///< 9.1 
00096 };
00097 
00098 /// We use this to help us look up the parent inode numbers. 
00099 
00100 struct iso_path_table{
00101         unsigned char  name_len[2];     ///< 721 
00102         char extent[4];         ///< 731 
00103         char  parent[2];        ///< 721 
00104         char name[0];
00105 };
00106 
00107 /**
00108 *
00109  high sierra is identical to iso, except that the date is only 6 bytes, and
00110 
00111 
00112 */
00113 
00114 struct iso_directory_record {
00115         char length                     [ISODCL (1, 1)]; ///< 711 
00116         char ext_attr_length            [ISODCL (2, 2)]; ///< 711 
00117         char extent                     [ISODCL (3, 10)]; ///< 733 
00118         char size                       [ISODCL (11, 18)]; ///< 733 
00119         char date                       [ISODCL (19, 25)]; ///< 7 by 711 
00120         char flags                      [ISODCL (26, 26)];
00121         char file_unit_size             [ISODCL (27, 27)]; ///< 711 
00122         char interleave                 [ISODCL (28, 28)]; ///< 711 
00123         char volume_sequence_number     [ISODCL (29, 32)]; ///< 723 
00124         unsigned char name_len          [ISODCL (33, 33)]; ///< 711 
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 /// We use these until the buffer cache supports 2048 
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  The stuff that follows may be totally unneeded. I have not checked to see 
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; ///< If this matches... 
00207   dev_t dev;  ///< And this matches 
00208   unsigned short dlen; ///< and this matches... 
00209   char filename[256]; ///< and this matches... 
00210   unsigned long ino; ///< Then this is the file we are looking for 
00211 };
00212 
00213 extern struct lookup_cache cache;
00214 
00215 /// The following macros are used to check for memory leaks. 
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 

Generated on Mon May 1 21:47:00 2006 for KernelAPI by  doxygen 1.4.6-5