| 1 |
1633 |
jcastillo |
|
| 2 |
|
|
#ifndef _ISOFS_FS_H
|
| 3 |
|
|
#define _ISOFS_FS_H
|
| 4 |
|
|
|
| 5 |
|
|
#include <linux/types.h>
|
| 6 |
|
|
/*
|
| 7 |
|
|
* The isofs filesystem constants/structures
|
| 8 |
|
|
*/
|
| 9 |
|
|
|
| 10 |
|
|
/* This part borrowed from the bsd386 isofs */
|
| 11 |
|
|
#define ISODCL(from, to) (to - from + 1)
|
| 12 |
|
|
|
| 13 |
|
|
struct iso_volume_descriptor {
|
| 14 |
|
|
char type[ISODCL(1,1)]; /* 711 */
|
| 15 |
|
|
char id[ISODCL(2,6)];
|
| 16 |
|
|
char version[ISODCL(7,7)];
|
| 17 |
|
|
char data[ISODCL(8,2048)];
|
| 18 |
|
|
};
|
| 19 |
|
|
|
| 20 |
|
|
/* volume descriptor types */
|
| 21 |
|
|
#define ISO_VD_PRIMARY 1
|
| 22 |
|
|
#define ISO_VD_SUPPLEMENTARY 2
|
| 23 |
|
|
#define ISO_VD_END 255
|
| 24 |
|
|
|
| 25 |
|
|
#define ISO_STANDARD_ID "CD001"
|
| 26 |
|
|
|
| 27 |
|
|
struct iso_primary_descriptor {
|
| 28 |
|
|
char type [ISODCL ( 1, 1)]; /* 711 */
|
| 29 |
|
|
char id [ISODCL ( 2, 6)];
|
| 30 |
|
|
char version [ISODCL ( 7, 7)]; /* 711 */
|
| 31 |
|
|
char unused1 [ISODCL ( 8, 8)];
|
| 32 |
|
|
char system_id [ISODCL ( 9, 40)]; /* achars */
|
| 33 |
|
|
char volume_id [ISODCL ( 41, 72)]; /* dchars */
|
| 34 |
|
|
char unused2 [ISODCL ( 73, 80)];
|
| 35 |
|
|
char volume_space_size [ISODCL ( 81, 88)]; /* 733 */
|
| 36 |
|
|
char unused3 [ISODCL ( 89, 120)];
|
| 37 |
|
|
char volume_set_size [ISODCL (121, 124)]; /* 723 */
|
| 38 |
|
|
char volume_sequence_number [ISODCL (125, 128)]; /* 723 */
|
| 39 |
|
|
char logical_block_size [ISODCL (129, 132)]; /* 723 */
|
| 40 |
|
|
char path_table_size [ISODCL (133, 140)]; /* 733 */
|
| 41 |
|
|
char type_l_path_table [ISODCL (141, 144)]; /* 731 */
|
| 42 |
|
|
char opt_type_l_path_table [ISODCL (145, 148)]; /* 731 */
|
| 43 |
|
|
char type_m_path_table [ISODCL (149, 152)]; /* 732 */
|
| 44 |
|
|
char opt_type_m_path_table [ISODCL (153, 156)]; /* 732 */
|
| 45 |
|
|
char root_directory_record [ISODCL (157, 190)]; /* 9.1 */
|
| 46 |
|
|
char volume_set_id [ISODCL (191, 318)]; /* dchars */
|
| 47 |
|
|
char publisher_id [ISODCL (319, 446)]; /* achars */
|
| 48 |
|
|
char preparer_id [ISODCL (447, 574)]; /* achars */
|
| 49 |
|
|
char application_id [ISODCL (575, 702)]; /* achars */
|
| 50 |
|
|
char copyright_file_id [ISODCL (703, 739)]; /* 7.5 dchars */
|
| 51 |
|
|
char abstract_file_id [ISODCL (740, 776)]; /* 7.5 dchars */
|
| 52 |
|
|
char bibliographic_file_id [ISODCL (777, 813)]; /* 7.5 dchars */
|
| 53 |
|
|
char creation_date [ISODCL (814, 830)]; /* 8.4.26.1 */
|
| 54 |
|
|
char modification_date [ISODCL (831, 847)]; /* 8.4.26.1 */
|
| 55 |
|
|
char expiration_date [ISODCL (848, 864)]; /* 8.4.26.1 */
|
| 56 |
|
|
char effective_date [ISODCL (865, 881)]; /* 8.4.26.1 */
|
| 57 |
|
|
char file_structure_version [ISODCL (882, 882)]; /* 711 */
|
| 58 |
|
|
char unused4 [ISODCL (883, 883)];
|
| 59 |
|
|
char application_data [ISODCL (884, 1395)];
|
| 60 |
|
|
char unused5 [ISODCL (1396, 2048)];
|
| 61 |
|
|
};
|
| 62 |
|
|
|
| 63 |
|
|
/* Almost the same as the primary descriptor but two fields are specified */
|
| 64 |
|
|
struct iso_supplementary_descriptor {
|
| 65 |
|
|
char type [ISODCL ( 1, 1)]; /* 711 */
|
| 66 |
|
|
char id [ISODCL ( 2, 6)];
|
| 67 |
|
|
char version [ISODCL ( 7, 7)]; /* 711 */
|
| 68 |
|
|
char flags [ISODCL ( 8, 8)]; /* 853 */
|
| 69 |
|
|
char system_id [ISODCL ( 9, 40)]; /* achars */
|
| 70 |
|
|
char volume_id [ISODCL ( 41, 72)]; /* dchars */
|
| 71 |
|
|
char unused2 [ISODCL ( 73, 80)];
|
| 72 |
|
|
char volume_space_size [ISODCL ( 81, 88)]; /* 733 */
|
| 73 |
|
|
char escape [ISODCL ( 89, 120)]; /* 856 */
|
| 74 |
|
|
char volume_set_size [ISODCL (121, 124)]; /* 723 */
|
| 75 |
|
|
char volume_sequence_number [ISODCL (125, 128)]; /* 723 */
|
| 76 |
|
|
char logical_block_size [ISODCL (129, 132)]; /* 723 */
|
| 77 |
|
|
char path_table_size [ISODCL (133, 140)]; /* 733 */
|
| 78 |
|
|
char type_l_path_table [ISODCL (141, 144)]; /* 731 */
|
| 79 |
|
|
char opt_type_l_path_table [ISODCL (145, 148)]; /* 731 */
|
| 80 |
|
|
char type_m_path_table [ISODCL (149, 152)]; /* 732 */
|
| 81 |
|
|
char opt_type_m_path_table [ISODCL (153, 156)]; /* 732 */
|
| 82 |
|
|
char root_directory_record [ISODCL (157, 190)]; /* 9.1 */
|
| 83 |
|
|
char volume_set_id [ISODCL (191, 318)]; /* dchars */
|
| 84 |
|
|
char publisher_id [ISODCL (319, 446)]; /* achars */
|
| 85 |
|
|
char preparer_id [ISODCL (447, 574)]; /* achars */
|
| 86 |
|
|
char application_id [ISODCL (575, 702)]; /* achars */
|
| 87 |
|
|
char copyright_file_id [ISODCL (703, 739)]; /* 7.5 dchars */
|
| 88 |
|
|
char abstract_file_id [ISODCL (740, 776)]; /* 7.5 dchars */
|
| 89 |
|
|
char bibliographic_file_id [ISODCL (777, 813)]; /* 7.5 dchars */
|
| 90 |
|
|
char creation_date [ISODCL (814, 830)]; /* 8.4.26.1 */
|
| 91 |
|
|
char modification_date [ISODCL (831, 847)]; /* 8.4.26.1 */
|
| 92 |
|
|
char expiration_date [ISODCL (848, 864)]; /* 8.4.26.1 */
|
| 93 |
|
|
char effective_date [ISODCL (865, 881)]; /* 8.4.26.1 */
|
| 94 |
|
|
char file_structure_version [ISODCL (882, 882)]; /* 711 */
|
| 95 |
|
|
char unused4 [ISODCL (883, 883)];
|
| 96 |
|
|
char application_data [ISODCL (884, 1395)];
|
| 97 |
|
|
char unused5 [ISODCL (1396, 2048)];
|
| 98 |
|
|
};
|
| 99 |
|
|
|
| 100 |
|
|
|
| 101 |
|
|
#define HS_STANDARD_ID "CDROM"
|
| 102 |
|
|
|
| 103 |
|
|
struct hs_volume_descriptor {
|
| 104 |
|
|
char foo [ISODCL ( 1, 8)]; /* 733 */
|
| 105 |
|
|
char type [ISODCL ( 9, 9)]; /* 711 */
|
| 106 |
|
|
char id [ISODCL ( 10, 14)];
|
| 107 |
|
|
char version [ISODCL ( 15, 15)]; /* 711 */
|
| 108 |
|
|
char data[ISODCL(16,2048)];
|
| 109 |
|
|
};
|
| 110 |
|
|
|
| 111 |
|
|
|
| 112 |
|
|
struct hs_primary_descriptor {
|
| 113 |
|
|
char foo [ISODCL ( 1, 8)]; /* 733 */
|
| 114 |
|
|
char type [ISODCL ( 9, 9)]; /* 711 */
|
| 115 |
|
|
char id [ISODCL ( 10, 14)];
|
| 116 |
|
|
char version [ISODCL ( 15, 15)]; /* 711 */
|
| 117 |
|
|
char unused1 [ISODCL ( 16, 16)]; /* 711 */
|
| 118 |
|
|
char system_id [ISODCL ( 17, 48)]; /* achars */
|
| 119 |
|
|
char volume_id [ISODCL ( 49, 80)]; /* dchars */
|
| 120 |
|
|
char unused2 [ISODCL ( 81, 88)]; /* 733 */
|
| 121 |
|
|
char volume_space_size [ISODCL ( 89, 96)]; /* 733 */
|
| 122 |
|
|
char unused3 [ISODCL ( 97, 128)]; /* 733 */
|
| 123 |
|
|
char volume_set_size [ISODCL (129, 132)]; /* 723 */
|
| 124 |
|
|
char volume_sequence_number [ISODCL (133, 136)]; /* 723 */
|
| 125 |
|
|
char logical_block_size [ISODCL (137, 140)]; /* 723 */
|
| 126 |
|
|
char path_table_size [ISODCL (141, 148)]; /* 733 */
|
| 127 |
|
|
char type_l_path_table [ISODCL (149, 152)]; /* 731 */
|
| 128 |
|
|
char unused4 [ISODCL (153, 180)]; /* 733 */
|
| 129 |
|
|
char root_directory_record [ISODCL (181, 214)]; /* 9.1 */
|
| 130 |
|
|
};
|
| 131 |
|
|
|
| 132 |
|
|
/* We use this to help us look up the parent inode numbers. */
|
| 133 |
|
|
|
| 134 |
|
|
struct iso_path_table{
|
| 135 |
|
|
unsigned char name_len[2]; /* 721 */
|
| 136 |
|
|
char extent[4]; /* 731 */
|
| 137 |
|
|
char parent[2]; /* 721 */
|
| 138 |
|
|
char name[0];
|
| 139 |
|
|
};
|
| 140 |
|
|
|
| 141 |
|
|
/* high sierra is identical to iso, except that the date is only 6 bytes, and
|
| 142 |
|
|
there is an extra reserved byte after the flags */
|
| 143 |
|
|
|
| 144 |
|
|
struct iso_directory_record {
|
| 145 |
|
|
char length [ISODCL (1, 1)]; /* 711 */
|
| 146 |
|
|
char ext_attr_length [ISODCL (2, 2)]; /* 711 */
|
| 147 |
|
|
char extent [ISODCL (3, 10)]; /* 733 */
|
| 148 |
|
|
char size [ISODCL (11, 18)]; /* 733 */
|
| 149 |
|
|
char date [ISODCL (19, 25)]; /* 7 by 711 */
|
| 150 |
|
|
char flags [ISODCL (26, 26)];
|
| 151 |
|
|
char file_unit_size [ISODCL (27, 27)]; /* 711 */
|
| 152 |
|
|
char interleave [ISODCL (28, 28)]; /* 711 */
|
| 153 |
|
|
char volume_sequence_number [ISODCL (29, 32)]; /* 723 */
|
| 154 |
|
|
unsigned char name_len [ISODCL (33, 33)]; /* 711 */
|
| 155 |
|
|
char name [0];
|
| 156 |
|
|
};
|
| 157 |
|
|
|
| 158 |
|
|
#define ISOFS_BLOCK_BITS 11
|
| 159 |
|
|
#define ISOFS_BLOCK_SIZE 2048
|
| 160 |
|
|
|
| 161 |
|
|
#define ISOFS_BUFFER_SIZE(INODE) ((INODE)->i_sb->s_blocksize)
|
| 162 |
|
|
#define ISOFS_BUFFER_BITS(INODE) ((INODE)->i_sb->s_blocksize_bits)
|
| 163 |
|
|
#define ISOFS_ZONE_BITS(INODE) ((INODE)->i_sb->u.isofs_sb.s_log_zone_size)
|
| 164 |
|
|
|
| 165 |
|
|
#define ISOFS_SUPER_MAGIC 0x9660
|
| 166 |
|
|
#define ISOFS_FILE_UNKNOWN 0
|
| 167 |
|
|
#define ISOFS_FILE_TEXT 1
|
| 168 |
|
|
#define ISOFS_FILE_BINARY 2
|
| 169 |
|
|
#define ISOFS_FILE_TEXT_M 3
|
| 170 |
|
|
|
| 171 |
|
|
#ifdef __KERNEL__
|
| 172 |
|
|
extern int isonum_711(char *);
|
| 173 |
|
|
extern int isonum_712(char *);
|
| 174 |
|
|
extern int isonum_721(char *);
|
| 175 |
|
|
extern int isonum_722(char *);
|
| 176 |
|
|
extern int isonum_723(char *);
|
| 177 |
|
|
extern int isonum_731(char *);
|
| 178 |
|
|
extern int isonum_732(char *);
|
| 179 |
|
|
extern int isonum_733(char *);
|
| 180 |
|
|
extern int iso_date(char *, int);
|
| 181 |
|
|
|
| 182 |
|
|
extern int parse_rock_ridge_inode(struct iso_directory_record *, struct inode *);
|
| 183 |
|
|
extern int get_rock_ridge_filename(struct iso_directory_record *, char *, struct inode *);
|
| 184 |
|
|
|
| 185 |
|
|
extern char * get_rock_ridge_symlink(struct inode *);
|
| 186 |
|
|
extern int find_rock_ridge_relocation(struct iso_directory_record *, struct inode *);
|
| 187 |
|
|
|
| 188 |
|
|
int get_joliet_filename(struct iso_directory_record *, struct inode *, unsigned char *);
|
| 189 |
|
|
|
| 190 |
|
|
/* The stuff that follows may be totally unneeded. I have not checked to see
|
| 191 |
|
|
which prototypes we are still using. */
|
| 192 |
|
|
|
| 193 |
|
|
extern int isofs_open(struct inode * inode, struct file * filp);
|
| 194 |
|
|
extern void isofs_release(struct inode * inode, struct file * filp);
|
| 195 |
|
|
extern int isofs_lookup(struct inode * dir,const char * name, int len,
|
| 196 |
|
|
struct inode ** result);
|
| 197 |
|
|
extern unsigned long isofs_count_free_inodes(struct super_block *sb);
|
| 198 |
|
|
extern int isofs_new_block(int dev);
|
| 199 |
|
|
extern int isofs_free_block(int dev, int block);
|
| 200 |
|
|
extern int isofs_bmap(struct inode *,int);
|
| 201 |
|
|
|
| 202 |
|
|
extern void isofs_put_super(struct super_block *);
|
| 203 |
|
|
extern struct super_block *isofs_read_super(struct super_block *,void *,int);
|
| 204 |
|
|
extern int init_iso9660_fs(void);
|
| 205 |
|
|
extern void isofs_read_inode(struct inode *);
|
| 206 |
|
|
extern void isofs_put_inode(struct inode *);
|
| 207 |
|
|
extern void isofs_statfs(struct super_block *, struct statfs *, int);
|
| 208 |
|
|
|
| 209 |
|
|
extern int isofs_lseek(struct inode *, struct file *, off_t, int);
|
| 210 |
|
|
extern int isofs_read(struct inode *, struct file *, char *, int);
|
| 211 |
|
|
extern int isofs_lookup_grandparent(struct inode *, int);
|
| 212 |
|
|
|
| 213 |
|
|
extern struct inode_operations isofs_file_inode_operations;
|
| 214 |
|
|
extern struct inode_operations isofs_dir_inode_operations;
|
| 215 |
|
|
extern struct inode_operations isofs_symlink_inode_operations;
|
| 216 |
|
|
extern struct inode_operations isofs_chrdev_inode_operations;
|
| 217 |
|
|
extern struct inode_operations isofs_blkdev_inode_operations;
|
| 218 |
|
|
extern struct inode_operations isofs_fifo_inode_operations;
|
| 219 |
|
|
|
| 220 |
|
|
/* The following macros are used to check for memory leaks. */
|
| 221 |
|
|
#ifdef LEAK_CHECK
|
| 222 |
|
|
#define free_s leak_check_free_s
|
| 223 |
|
|
#define malloc leak_check_malloc
|
| 224 |
|
|
#define bread leak_check_bread
|
| 225 |
|
|
#define brelse leak_check_brelse
|
| 226 |
|
|
extern void * leak_check_malloc(unsigned int size);
|
| 227 |
|
|
extern void leak_check_free_s(void * obj, int size);
|
| 228 |
|
|
extern struct buffer_head * leak_check_bread(int dev, int block, int size);
|
| 229 |
|
|
extern void leak_check_brelse(struct buffer_head * bh);
|
| 230 |
|
|
#endif /* LEAK_CHECK */
|
| 231 |
|
|
|
| 232 |
|
|
#endif /* __KERNEL__ */
|
| 233 |
|
|
|
| 234 |
|
|
#endif
|
| 235 |
|
|
|
| 236 |
|
|
|
| 237 |
|
|
|