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