Greg Kroah-Hartman | 6f52b16 | 2017-11-01 15:08:43 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 | #ifndef _ISOFS_FS_H |
| 3 | #define _ISOFS_FS_H |
| 4 | |
| 5 | #include <linux/types.h> |
Jeff Garzik | e18fa70 | 2006-09-24 11:13:19 -0400 | [diff] [blame] | 6 | #include <linux/magic.h> |
| 7 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | |
| 15 | struct iso_volume_descriptor { |
Arnd Bergmann | cb91775 | 2017-10-19 16:47:49 +0200 | [diff] [blame] | 16 | __u8 type[ISODCL(1,1)]; /* 711 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17 | char id[ISODCL(2,6)]; |
Arnd Bergmann | cb91775 | 2017-10-19 16:47:49 +0200 | [diff] [blame] | 18 | __u8 version[ISODCL(7,7)]; |
| 19 | __u8 data[ISODCL(8,2048)]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | |
| 29 | struct iso_primary_descriptor { |
Arnd Bergmann | cb91775 | 2017-10-19 16:47:49 +0200 | [diff] [blame] | 30 | __u8 type [ISODCL ( 1, 1)]; /* 711 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 31 | char id [ISODCL ( 2, 6)]; |
Arnd Bergmann | cb91775 | 2017-10-19 16:47:49 +0200 | [diff] [blame] | 32 | __u8 version [ISODCL ( 7, 7)]; /* 711 */ |
| 33 | __u8 unused1 [ISODCL ( 8, 8)]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | char system_id [ISODCL ( 9, 40)]; /* achars */ |
| 35 | char volume_id [ISODCL ( 41, 72)]; /* dchars */ |
Arnd Bergmann | cb91775 | 2017-10-19 16:47:49 +0200 | [diff] [blame] | 36 | __u8 unused2 [ISODCL ( 73, 80)]; |
| 37 | __u8 volume_space_size [ISODCL ( 81, 88)]; /* 733 */ |
| 38 | __u8 unused3 [ISODCL ( 89, 120)]; |
| 39 | __u8 volume_set_size [ISODCL (121, 124)]; /* 723 */ |
| 40 | __u8 volume_sequence_number [ISODCL (125, 128)]; /* 723 */ |
| 41 | __u8 logical_block_size [ISODCL (129, 132)]; /* 723 */ |
| 42 | __u8 path_table_size [ISODCL (133, 140)]; /* 733 */ |
| 43 | __u8 type_l_path_table [ISODCL (141, 144)]; /* 731 */ |
| 44 | __u8 opt_type_l_path_table [ISODCL (145, 148)]; /* 731 */ |
| 45 | __u8 type_m_path_table [ISODCL (149, 152)]; /* 732 */ |
| 46 | __u8 opt_type_m_path_table [ISODCL (153, 156)]; /* 732 */ |
| 47 | __u8 root_directory_record [ISODCL (157, 190)]; /* 9.1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 */ |
Arnd Bergmann | cb91775 | 2017-10-19 16:47:49 +0200 | [diff] [blame] | 55 | __u8 creation_date [ISODCL (814, 830)]; /* 8.4.26.1 */ |
| 56 | __u8 modification_date [ISODCL (831, 847)]; /* 8.4.26.1 */ |
| 57 | __u8 expiration_date [ISODCL (848, 864)]; /* 8.4.26.1 */ |
| 58 | __u8 effective_date [ISODCL (865, 881)]; /* 8.4.26.1 */ |
| 59 | __u8 file_structure_version [ISODCL (882, 882)]; /* 711 */ |
| 60 | __u8 unused4 [ISODCL (883, 883)]; |
| 61 | __u8 application_data [ISODCL (884, 1395)]; |
| 62 | __u8 unused5 [ISODCL (1396, 2048)]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 63 | }; |
| 64 | |
| 65 | /* Almost the same as the primary descriptor but two fields are specified */ |
| 66 | struct iso_supplementary_descriptor { |
Arnd Bergmann | cb91775 | 2017-10-19 16:47:49 +0200 | [diff] [blame] | 67 | __u8 type [ISODCL ( 1, 1)]; /* 711 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 68 | char id [ISODCL ( 2, 6)]; |
Arnd Bergmann | cb91775 | 2017-10-19 16:47:49 +0200 | [diff] [blame] | 69 | __u8 version [ISODCL ( 7, 7)]; /* 711 */ |
| 70 | __u8 flags [ISODCL ( 8, 8)]; /* 853 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 71 | char system_id [ISODCL ( 9, 40)]; /* achars */ |
| 72 | char volume_id [ISODCL ( 41, 72)]; /* dchars */ |
Arnd Bergmann | cb91775 | 2017-10-19 16:47:49 +0200 | [diff] [blame] | 73 | __u8 unused2 [ISODCL ( 73, 80)]; |
| 74 | __u8 volume_space_size [ISODCL ( 81, 88)]; /* 733 */ |
| 75 | __u8 escape [ISODCL ( 89, 120)]; /* 856 */ |
| 76 | __u8 volume_set_size [ISODCL (121, 124)]; /* 723 */ |
| 77 | __u8 volume_sequence_number [ISODCL (125, 128)]; /* 723 */ |
| 78 | __u8 logical_block_size [ISODCL (129, 132)]; /* 723 */ |
| 79 | __u8 path_table_size [ISODCL (133, 140)]; /* 733 */ |
| 80 | __u8 type_l_path_table [ISODCL (141, 144)]; /* 731 */ |
| 81 | __u8 opt_type_l_path_table [ISODCL (145, 148)]; /* 731 */ |
| 82 | __u8 type_m_path_table [ISODCL (149, 152)]; /* 732 */ |
| 83 | __u8 opt_type_m_path_table [ISODCL (153, 156)]; /* 732 */ |
| 84 | __u8 root_directory_record [ISODCL (157, 190)]; /* 9.1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 */ |
Arnd Bergmann | cb91775 | 2017-10-19 16:47:49 +0200 | [diff] [blame] | 92 | __u8 creation_date [ISODCL (814, 830)]; /* 8.4.26.1 */ |
| 93 | __u8 modification_date [ISODCL (831, 847)]; /* 8.4.26.1 */ |
| 94 | __u8 expiration_date [ISODCL (848, 864)]; /* 8.4.26.1 */ |
| 95 | __u8 effective_date [ISODCL (865, 881)]; /* 8.4.26.1 */ |
| 96 | __u8 file_structure_version [ISODCL (882, 882)]; /* 711 */ |
| 97 | __u8 unused4 [ISODCL (883, 883)]; |
| 98 | __u8 application_data [ISODCL (884, 1395)]; |
| 99 | __u8 unused5 [ISODCL (1396, 2048)]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 100 | }; |
| 101 | |
| 102 | |
| 103 | #define HS_STANDARD_ID "CDROM" |
| 104 | |
| 105 | struct hs_volume_descriptor { |
Arnd Bergmann | cb91775 | 2017-10-19 16:47:49 +0200 | [diff] [blame] | 106 | __u8 foo [ISODCL ( 1, 8)]; /* 733 */ |
| 107 | __u8 type [ISODCL ( 9, 9)]; /* 711 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 108 | char id [ISODCL ( 10, 14)]; |
Arnd Bergmann | cb91775 | 2017-10-19 16:47:49 +0200 | [diff] [blame] | 109 | __u8 version [ISODCL ( 15, 15)]; /* 711 */ |
| 110 | __u8 data[ISODCL(16,2048)]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 111 | }; |
| 112 | |
| 113 | |
| 114 | struct hs_primary_descriptor { |
Arnd Bergmann | cb91775 | 2017-10-19 16:47:49 +0200 | [diff] [blame] | 115 | __u8 foo [ISODCL ( 1, 8)]; /* 733 */ |
| 116 | __u8 type [ISODCL ( 9, 9)]; /* 711 */ |
| 117 | __u8 id [ISODCL ( 10, 14)]; |
| 118 | __u8 version [ISODCL ( 15, 15)]; /* 711 */ |
| 119 | __u8 unused1 [ISODCL ( 16, 16)]; /* 711 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 120 | char system_id [ISODCL ( 17, 48)]; /* achars */ |
| 121 | char volume_id [ISODCL ( 49, 80)]; /* dchars */ |
Arnd Bergmann | cb91775 | 2017-10-19 16:47:49 +0200 | [diff] [blame] | 122 | __u8 unused2 [ISODCL ( 81, 88)]; /* 733 */ |
| 123 | __u8 volume_space_size [ISODCL ( 89, 96)]; /* 733 */ |
| 124 | __u8 unused3 [ISODCL ( 97, 128)]; /* 733 */ |
| 125 | __u8 volume_set_size [ISODCL (129, 132)]; /* 723 */ |
| 126 | __u8 volume_sequence_number [ISODCL (133, 136)]; /* 723 */ |
| 127 | __u8 logical_block_size [ISODCL (137, 140)]; /* 723 */ |
| 128 | __u8 path_table_size [ISODCL (141, 148)]; /* 733 */ |
| 129 | __u8 type_l_path_table [ISODCL (149, 152)]; /* 731 */ |
| 130 | __u8 unused4 [ISODCL (153, 180)]; /* 733 */ |
| 131 | __u8 root_directory_record [ISODCL (181, 214)]; /* 9.1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 132 | }; |
| 133 | |
| 134 | /* We use this to help us look up the parent inode numbers. */ |
| 135 | |
| 136 | struct iso_path_table{ |
Arnd Bergmann | cb91775 | 2017-10-19 16:47:49 +0200 | [diff] [blame] | 137 | __u8 name_len[2]; /* 721 */ |
| 138 | __u8 extent[4]; /* 731 */ |
| 139 | __u8 parent[2]; /* 721 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | |
| 146 | struct iso_directory_record { |
Arnd Bergmann | cb91775 | 2017-10-19 16:47:49 +0200 | [diff] [blame] | 147 | __u8 length [ISODCL (1, 1)]; /* 711 */ |
| 148 | __u8 ext_attr_length [ISODCL (2, 2)]; /* 711 */ |
| 149 | __u8 extent [ISODCL (3, 10)]; /* 733 */ |
| 150 | __u8 size [ISODCL (11, 18)]; /* 733 */ |
| 151 | __u8 date [ISODCL (19, 25)]; /* 7 by 711 */ |
| 152 | __u8 flags [ISODCL (26, 26)]; |
| 153 | __u8 file_unit_size [ISODCL (27, 27)]; /* 711 */ |
| 154 | __u8 interleave [ISODCL (28, 28)]; /* 711 */ |
| 155 | __u8 volume_sequence_number [ISODCL (29, 32)]; /* 723 */ |
| 156 | __u8 name_len [ISODCL (33, 33)]; /* 711 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | |
Jeff Garzik | e18fa70 | 2006-09-24 11:13:19 -0400 | [diff] [blame] | 166 | #endif /* _ISOFS_FS_H */ |