blob: 47967878bfef869ef2059c9e2ebda37dbecfbcd4 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef _ISOFS_FS_H
2#define _ISOFS_FS_H
3
4#include <linux/types.h>
5/*
6 * The isofs filesystem constants/structures
7 */
8
9/* This part borrowed from the bsd386 isofs */
10#define ISODCL(from, to) (to - from + 1)
11
12struct iso_volume_descriptor {
13 char type[ISODCL(1,1)]; /* 711 */
14 char id[ISODCL(2,6)];
15 char version[ISODCL(7,7)];
16 char data[ISODCL(8,2048)];
17};
18
19/* volume descriptor types */
20#define ISO_VD_PRIMARY 1
21#define ISO_VD_SUPPLEMENTARY 2
22#define ISO_VD_END 255
23
24#define ISO_STANDARD_ID "CD001"
25
26struct iso_primary_descriptor {
27 char type [ISODCL ( 1, 1)]; /* 711 */
28 char id [ISODCL ( 2, 6)];
29 char version [ISODCL ( 7, 7)]; /* 711 */
30 char unused1 [ISODCL ( 8, 8)];
31 char system_id [ISODCL ( 9, 40)]; /* achars */
32 char volume_id [ISODCL ( 41, 72)]; /* dchars */
33 char unused2 [ISODCL ( 73, 80)];
34 char volume_space_size [ISODCL ( 81, 88)]; /* 733 */
35 char unused3 [ISODCL ( 89, 120)];
36 char volume_set_size [ISODCL (121, 124)]; /* 723 */
37 char volume_sequence_number [ISODCL (125, 128)]; /* 723 */
38 char logical_block_size [ISODCL (129, 132)]; /* 723 */
39 char path_table_size [ISODCL (133, 140)]; /* 733 */
40 char type_l_path_table [ISODCL (141, 144)]; /* 731 */
41 char opt_type_l_path_table [ISODCL (145, 148)]; /* 731 */
42 char type_m_path_table [ISODCL (149, 152)]; /* 732 */
43 char opt_type_m_path_table [ISODCL (153, 156)]; /* 732 */
44 char root_directory_record [ISODCL (157, 190)]; /* 9.1 */
45 char volume_set_id [ISODCL (191, 318)]; /* dchars */
46 char publisher_id [ISODCL (319, 446)]; /* achars */
47 char preparer_id [ISODCL (447, 574)]; /* achars */
48 char application_id [ISODCL (575, 702)]; /* achars */
49 char copyright_file_id [ISODCL (703, 739)]; /* 7.5 dchars */
50 char abstract_file_id [ISODCL (740, 776)]; /* 7.5 dchars */
51 char bibliographic_file_id [ISODCL (777, 813)]; /* 7.5 dchars */
52 char creation_date [ISODCL (814, 830)]; /* 8.4.26.1 */
53 char modification_date [ISODCL (831, 847)]; /* 8.4.26.1 */
54 char expiration_date [ISODCL (848, 864)]; /* 8.4.26.1 */
55 char effective_date [ISODCL (865, 881)]; /* 8.4.26.1 */
56 char file_structure_version [ISODCL (882, 882)]; /* 711 */
57 char unused4 [ISODCL (883, 883)];
58 char application_data [ISODCL (884, 1395)];
59 char unused5 [ISODCL (1396, 2048)];
60};
61
62/* Almost the same as the primary descriptor but two fields are specified */
63struct iso_supplementary_descriptor {
64 char type [ISODCL ( 1, 1)]; /* 711 */
65 char id [ISODCL ( 2, 6)];
66 char version [ISODCL ( 7, 7)]; /* 711 */
67 char flags [ISODCL ( 8, 8)]; /* 853 */
68 char system_id [ISODCL ( 9, 40)]; /* achars */
69 char volume_id [ISODCL ( 41, 72)]; /* dchars */
70 char unused2 [ISODCL ( 73, 80)];
71 char volume_space_size [ISODCL ( 81, 88)]; /* 733 */
72 char escape [ISODCL ( 89, 120)]; /* 856 */
73 char volume_set_size [ISODCL (121, 124)]; /* 723 */
74 char volume_sequence_number [ISODCL (125, 128)]; /* 723 */
75 char logical_block_size [ISODCL (129, 132)]; /* 723 */
76 char path_table_size [ISODCL (133, 140)]; /* 733 */
77 char type_l_path_table [ISODCL (141, 144)]; /* 731 */
78 char opt_type_l_path_table [ISODCL (145, 148)]; /* 731 */
79 char type_m_path_table [ISODCL (149, 152)]; /* 732 */
80 char opt_type_m_path_table [ISODCL (153, 156)]; /* 732 */
81 char root_directory_record [ISODCL (157, 190)]; /* 9.1 */
82 char volume_set_id [ISODCL (191, 318)]; /* dchars */
83 char publisher_id [ISODCL (319, 446)]; /* achars */
84 char preparer_id [ISODCL (447, 574)]; /* achars */
85 char application_id [ISODCL (575, 702)]; /* achars */
86 char copyright_file_id [ISODCL (703, 739)]; /* 7.5 dchars */
87 char abstract_file_id [ISODCL (740, 776)]; /* 7.5 dchars */
88 char bibliographic_file_id [ISODCL (777, 813)]; /* 7.5 dchars */
89 char creation_date [ISODCL (814, 830)]; /* 8.4.26.1 */
90 char modification_date [ISODCL (831, 847)]; /* 8.4.26.1 */
91 char expiration_date [ISODCL (848, 864)]; /* 8.4.26.1 */
92 char effective_date [ISODCL (865, 881)]; /* 8.4.26.1 */
93 char file_structure_version [ISODCL (882, 882)]; /* 711 */
94 char unused4 [ISODCL (883, 883)];
95 char application_data [ISODCL (884, 1395)];
96 char unused5 [ISODCL (1396, 2048)];
97};
98
99
100#define HS_STANDARD_ID "CDROM"
101
102struct hs_volume_descriptor {
103 char foo [ISODCL ( 1, 8)]; /* 733 */
104 char type [ISODCL ( 9, 9)]; /* 711 */
105 char id [ISODCL ( 10, 14)];
106 char version [ISODCL ( 15, 15)]; /* 711 */
107 char data[ISODCL(16,2048)];
108};
109
110
111struct hs_primary_descriptor {
112 char foo [ISODCL ( 1, 8)]; /* 733 */
113 char type [ISODCL ( 9, 9)]; /* 711 */
114 char id [ISODCL ( 10, 14)];
115 char version [ISODCL ( 15, 15)]; /* 711 */
116 char unused1 [ISODCL ( 16, 16)]; /* 711 */
117 char system_id [ISODCL ( 17, 48)]; /* achars */
118 char volume_id [ISODCL ( 49, 80)]; /* dchars */
119 char unused2 [ISODCL ( 81, 88)]; /* 733 */
120 char volume_space_size [ISODCL ( 89, 96)]; /* 733 */
121 char unused3 [ISODCL ( 97, 128)]; /* 733 */
122 char volume_set_size [ISODCL (129, 132)]; /* 723 */
123 char volume_sequence_number [ISODCL (133, 136)]; /* 723 */
124 char logical_block_size [ISODCL (137, 140)]; /* 723 */
125 char path_table_size [ISODCL (141, 148)]; /* 733 */
126 char type_l_path_table [ISODCL (149, 152)]; /* 731 */
127 char unused4 [ISODCL (153, 180)]; /* 733 */
128 char root_directory_record [ISODCL (181, 214)]; /* 9.1 */
129};
130
131/* We use this to help us look up the parent inode numbers. */
132
133struct iso_path_table{
134 unsigned char name_len[2]; /* 721 */
135 char extent[4]; /* 731 */
136 char parent[2]; /* 721 */
137 char name[0];
138} __attribute__((packed));
139
140/* high sierra is identical to iso, except that the date is only 6 bytes, and
141 there is an extra reserved byte after the flags */
142
143struct iso_directory_record {
144 char length [ISODCL (1, 1)]; /* 711 */
145 char ext_attr_length [ISODCL (2, 2)]; /* 711 */
146 char extent [ISODCL (3, 10)]; /* 733 */
147 char size [ISODCL (11, 18)]; /* 733 */
148 char date [ISODCL (19, 25)]; /* 7 by 711 */
149 char flags [ISODCL (26, 26)];
150 char file_unit_size [ISODCL (27, 27)]; /* 711 */
151 char interleave [ISODCL (28, 28)]; /* 711 */
152 char volume_sequence_number [ISODCL (29, 32)]; /* 723 */
153 unsigned char name_len [ISODCL (33, 33)]; /* 711 */
154 char name [0];
155} __attribute__((packed));
156
157#define ISOFS_BLOCK_BITS 11
158#define ISOFS_BLOCK_SIZE 2048
159
160#define ISOFS_BUFFER_SIZE(INODE) ((INODE)->i_sb->s_blocksize)
161#define ISOFS_BUFFER_BITS(INODE) ((INODE)->i_sb->s_blocksize_bits)
162
163#define ISOFS_SUPER_MAGIC 0x9660
164
Linus Torvalds1da177e2005-04-16 15:20:36 -0700165#endif