Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
0002 #ifndef _ISOFS_FS_H
0003 #define _ISOFS_FS_H
0004 
0005 #include <linux/types.h>
0006 #include <linux/magic.h>
0007 
0008 /*
0009  * The isofs filesystem constants/structures
0010  */
0011 
0012 /* This part borrowed from the bsd386 isofs */
0013 #define ISODCL(from, to) (to - from + 1)
0014 
0015 struct iso_volume_descriptor {
0016     __u8 type[ISODCL(1,1)]; /* 711 */
0017     char id[ISODCL(2,6)];
0018     __u8 version[ISODCL(7,7)];
0019     __u8 data[ISODCL(8,2048)];
0020 };
0021 
0022 /* volume descriptor types */
0023 #define ISO_VD_PRIMARY 1
0024 #define ISO_VD_SUPPLEMENTARY 2
0025 #define ISO_VD_END 255
0026 
0027 #define ISO_STANDARD_ID "CD001"
0028 
0029 struct iso_primary_descriptor {
0030     __u8 type           [ISODCL (  1,   1)]; /* 711 */
0031     char id             [ISODCL (  2,   6)];
0032     __u8 version            [ISODCL (  7,   7)]; /* 711 */
0033     __u8 unused1            [ISODCL (  8,   8)];
0034     char system_id          [ISODCL (  9,  40)]; /* achars */
0035     char volume_id          [ISODCL ( 41,  72)]; /* dchars */
0036     __u8 unused2            [ISODCL ( 73,  80)];
0037     __u8 volume_space_size      [ISODCL ( 81,  88)]; /* 733 */
0038     __u8 unused3            [ISODCL ( 89, 120)];
0039     __u8 volume_set_size        [ISODCL (121, 124)]; /* 723 */
0040     __u8 volume_sequence_number [ISODCL (125, 128)]; /* 723 */
0041     __u8 logical_block_size     [ISODCL (129, 132)]; /* 723 */
0042     __u8 path_table_size        [ISODCL (133, 140)]; /* 733 */
0043     __u8 type_l_path_table      [ISODCL (141, 144)]; /* 731 */
0044     __u8 opt_type_l_path_table  [ISODCL (145, 148)]; /* 731 */
0045     __u8 type_m_path_table      [ISODCL (149, 152)]; /* 732 */
0046     __u8 opt_type_m_path_table  [ISODCL (153, 156)]; /* 732 */
0047     __u8 root_directory_record  [ISODCL (157, 190)]; /* 9.1 */
0048     char volume_set_id      [ISODCL (191, 318)]; /* dchars */
0049     char publisher_id       [ISODCL (319, 446)]; /* achars */
0050     char preparer_id        [ISODCL (447, 574)]; /* achars */
0051     char application_id     [ISODCL (575, 702)]; /* achars */
0052     char copyright_file_id      [ISODCL (703, 739)]; /* 7.5 dchars */
0053     char abstract_file_id       [ISODCL (740, 776)]; /* 7.5 dchars */
0054     char bibliographic_file_id  [ISODCL (777, 813)]; /* 7.5 dchars */
0055     __u8 creation_date      [ISODCL (814, 830)]; /* 8.4.26.1 */
0056     __u8 modification_date      [ISODCL (831, 847)]; /* 8.4.26.1 */
0057     __u8 expiration_date        [ISODCL (848, 864)]; /* 8.4.26.1 */
0058     __u8 effective_date     [ISODCL (865, 881)]; /* 8.4.26.1 */
0059     __u8 file_structure_version [ISODCL (882, 882)]; /* 711 */
0060     __u8 unused4            [ISODCL (883, 883)];
0061     __u8 application_data       [ISODCL (884, 1395)];
0062     __u8 unused5            [ISODCL (1396, 2048)];
0063 };
0064 
0065 /* Almost the same as the primary descriptor but two fields are specified */
0066 struct iso_supplementary_descriptor {
0067     __u8 type           [ISODCL (  1,   1)]; /* 711 */
0068     char id             [ISODCL (  2,   6)];
0069     __u8 version            [ISODCL (  7,   7)]; /* 711 */
0070     __u8 flags          [ISODCL (  8,   8)]; /* 853 */
0071     char system_id          [ISODCL (  9,  40)]; /* achars */
0072     char volume_id          [ISODCL ( 41,  72)]; /* dchars */
0073     __u8 unused2            [ISODCL ( 73,  80)];
0074     __u8 volume_space_size      [ISODCL ( 81,  88)]; /* 733 */
0075     __u8 escape         [ISODCL ( 89, 120)]; /* 856 */
0076     __u8 volume_set_size        [ISODCL (121, 124)]; /* 723 */
0077     __u8 volume_sequence_number [ISODCL (125, 128)]; /* 723 */
0078     __u8 logical_block_size     [ISODCL (129, 132)]; /* 723 */
0079     __u8 path_table_size        [ISODCL (133, 140)]; /* 733 */
0080     __u8 type_l_path_table      [ISODCL (141, 144)]; /* 731 */
0081     __u8 opt_type_l_path_table  [ISODCL (145, 148)]; /* 731 */
0082     __u8 type_m_path_table      [ISODCL (149, 152)]; /* 732 */
0083     __u8 opt_type_m_path_table  [ISODCL (153, 156)]; /* 732 */
0084     __u8 root_directory_record  [ISODCL (157, 190)]; /* 9.1 */
0085     char volume_set_id      [ISODCL (191, 318)]; /* dchars */
0086     char publisher_id       [ISODCL (319, 446)]; /* achars */
0087     char preparer_id        [ISODCL (447, 574)]; /* achars */
0088     char application_id     [ISODCL (575, 702)]; /* achars */
0089     char copyright_file_id      [ISODCL (703, 739)]; /* 7.5 dchars */
0090     char abstract_file_id       [ISODCL (740, 776)]; /* 7.5 dchars */
0091     char bibliographic_file_id  [ISODCL (777, 813)]; /* 7.5 dchars */
0092     __u8 creation_date      [ISODCL (814, 830)]; /* 8.4.26.1 */
0093     __u8 modification_date      [ISODCL (831, 847)]; /* 8.4.26.1 */
0094     __u8 expiration_date        [ISODCL (848, 864)]; /* 8.4.26.1 */
0095     __u8 effective_date     [ISODCL (865, 881)]; /* 8.4.26.1 */
0096     __u8 file_structure_version [ISODCL (882, 882)]; /* 711 */
0097     __u8 unused4            [ISODCL (883, 883)];
0098     __u8 application_data       [ISODCL (884, 1395)];
0099     __u8 unused5            [ISODCL (1396, 2048)];
0100 };
0101 
0102 
0103 #define HS_STANDARD_ID "CDROM"
0104 
0105 struct  hs_volume_descriptor {
0106     __u8 foo            [ISODCL (  1,   8)]; /* 733 */
0107     __u8 type           [ISODCL (  9,   9)]; /* 711 */
0108     char id             [ISODCL ( 10,  14)];
0109     __u8 version            [ISODCL ( 15,  15)]; /* 711 */
0110     __u8 data[ISODCL(16,2048)];
0111 };
0112 
0113 
0114 struct hs_primary_descriptor {
0115     __u8 foo            [ISODCL (  1,   8)]; /* 733 */
0116     __u8 type           [ISODCL (  9,   9)]; /* 711 */
0117     __u8 id             [ISODCL ( 10,  14)];
0118     __u8 version            [ISODCL ( 15,  15)]; /* 711 */
0119     __u8 unused1            [ISODCL ( 16,  16)]; /* 711 */
0120     char system_id          [ISODCL ( 17,  48)]; /* achars */
0121     char volume_id          [ISODCL ( 49,  80)]; /* dchars */
0122     __u8 unused2            [ISODCL ( 81,  88)]; /* 733 */
0123     __u8 volume_space_size      [ISODCL ( 89,  96)]; /* 733 */
0124     __u8 unused3            [ISODCL ( 97, 128)]; /* 733 */
0125     __u8 volume_set_size        [ISODCL (129, 132)]; /* 723 */
0126     __u8 volume_sequence_number [ISODCL (133, 136)]; /* 723 */
0127     __u8 logical_block_size     [ISODCL (137, 140)]; /* 723 */
0128     __u8 path_table_size        [ISODCL (141, 148)]; /* 733 */
0129     __u8 type_l_path_table      [ISODCL (149, 152)]; /* 731 */
0130     __u8 unused4            [ISODCL (153, 180)]; /* 733 */
0131     __u8 root_directory_record  [ISODCL (181, 214)]; /* 9.1 */
0132 };
0133 
0134 /* We use this to help us look up the parent inode numbers. */
0135 
0136 struct iso_path_table{
0137     __u8  name_len[2];  /* 721 */
0138     __u8  extent[4];    /* 731 */
0139     __u8  parent[2];    /* 721 */
0140     char name[];
0141 } __attribute__((packed));
0142 
0143 /* high sierra is identical to iso, except that the date is only 6 bytes, and
0144    there is an extra reserved byte after the flags */
0145 
0146 struct iso_directory_record {
0147     __u8 length         [ISODCL (1, 1)]; /* 711 */
0148     __u8 ext_attr_length        [ISODCL (2, 2)]; /* 711 */
0149     __u8 extent         [ISODCL (3, 10)]; /* 733 */
0150     __u8 size           [ISODCL (11, 18)]; /* 733 */
0151     __u8 date           [ISODCL (19, 25)]; /* 7 by 711 */
0152     __u8 flags          [ISODCL (26, 26)];
0153     __u8 file_unit_size     [ISODCL (27, 27)]; /* 711 */
0154     __u8 interleave         [ISODCL (28, 28)]; /* 711 */
0155     __u8 volume_sequence_number [ISODCL (29, 32)]; /* 723 */
0156     __u8 name_len           [ISODCL (33, 33)]; /* 711 */
0157     char name           [];
0158 } __attribute__((packed));
0159 
0160 #define ISOFS_BLOCK_BITS 11
0161 #define ISOFS_BLOCK_SIZE 2048
0162 
0163 #define ISOFS_BUFFER_SIZE(INODE) ((INODE)->i_sb->s_blocksize)
0164 #define ISOFS_BUFFER_BITS(INODE) ((INODE)->i_sb->s_blocksize_bits)
0165 
0166 #endif /* _ISOFS_FS_H */