cdfs(4) cdfs(4) NAME cdfs - format of CDFS file system volume SYNOPSIS #include <sys/types.h> #include <sys/cdfs.h> #include <sys/cdfsdir.h> DESCRIPTION Each CD-ROM can contain one or more volumes. Each of these volumes can contain a CDFS file system (see cdrom(4) for a description of the overall format of a CD-ROM). The attributes of a CDFS volume are described by a volume descriptor. (Note that only the primary volume descriptor is recognized and used at the current level of CD-ROM support. Thus, ``volume descriptor'' in the following discussion refers to the primary volume descriptor.) A volume descriptor is 2048 bytes in length and is described by two data structures, one for HSG (High Sierra Group) format, and one for ISO-9660 (International Organization for Standardization) format. Only the pertinent portions of sys/cdfs.h are reproduced here: #define KMAXNAMLEN 30+2+5 #define VOL_SET_ID_SIZ 128 #define VOL_ID_SIZ 32 #define STD_ID_SIZ 5 #define SYS_ID_SIZ 32 #define PUBLISHER_ID_SIZ 128 #define PREPARER_ID_SIZ 128 #define APPLICATION_ID_SIZ 128 #define APPL_USE_SIZ 512 struct icdfs /*primary volume descriptor-ISO-9660*/ { char cdf_vold_type; /*volume descriptor type*/ char cdf_std_id[STD_ID_SIZ]; /*id "CD001" for ISO-9660*/ char cdf_vold_version; /*should be 1 for ISO-9660*/ char cdf_unused1; /*spare*/ char cdf_sys_id[SYS_ID_SIZ]; /*id of a system that knows contents of system area, logic sector 0-15*/ char cdf_vol_id[VOL_ID_SIZ]; /*id of this volume*/ char cdf_unused2[8]; /*spare*/ int cdf_vol_size_lsb; /*size (LSB) of volume in logic block*/ int cdf_vol_size_msb; /*size (MSB) of volume in logic block*/ char cdf_unused3[32]; /*spare*/ ushort cdf_volset_siz_lsb; /*size (LSB) of volume set*/ ushort cdf_volset_siz_msb; /*size (MSB) of volume set*/ ushort cdf_volset_seq_lsb; /*sequence no. (LSB) of vol in the set*/ ushort cdf_volset_seq_msb; /*sequence no. (MSB) of vol in the set*/ ushort cdf_logblk_siz_lsb; /*size (LSB) of logic block in bytes*/ ushort cdf_logblk_siz_msb; /*size (MSB) of logic block in bytes*/ Hewlett-Packard Company - 1 - HP-UX Release 9.0: August 1992 cdfs(4) cdfs(4) u_int cdf_pathtbl_siz_lsb; /*size (LSB) of path table in bytes */ u_int cdf_pathtbl_siz_msb; /*size (MSB) of path table in bytes */ u_int cdf_pathtbl_loc_lsb; /*logical block no. (LSB) of path table*/ u_int cdf_pathtblo_loc_lsb; /*logical block no. (LSB) of optional path table*/ u_int cdf_pathtbl_loc_msb; /*logical block no. (MSB) of path table*/ u_int cdf_pathtblo_loc_msb; /*logical block no. (MSB) of optional path table*/ struct min_cddir cdf_rootdp; /*directory record of root*/ char cdf_vol_set_id[VOL_SET_ID_SIZ]; /*id of the volume set*/ char cdf_pb_id[PUBLISHER_ID_SIZ]; /*publisher's id*/ char cdf_pp_id[PREPARER_ID_SIZ]; /*preparer's id*/ char cdf_ap_id[APPLICATION_ID_SIZ]; /*application id*/ char cdf_copyright[KMAXNAMLEN]; /*copyright in this file under root directory, the max. len. is 18, the rest unused*/ char cdf_abstract[KMAXNAMLEN]; /*abstract in this file under root directory, the max. len. is 18, the rest unused*/ char cdf_bibliographic[KMAXNAMLEN]; /*bibliographic in this file under root directory, the max. len. is 18, the rest unused*/ /*The next four chunks are creation time, modification time, expiration time and effective time. Since the date/time info is 17 bytes(odd), a structure can't be used (compiler rounds up to even bytes). If for any reason this info is changed, make sure to fix all four of them.*/ /*creation time*/ char cdf_c_year[4]; /*years since year 0000*/ char cdf_c_month[2]; /*month*/ char cdf_c_day[2]; /*day*/ char cdf_c_hour[2]; /*hour*/ char cdf_c_minute[2]; /*minute*/ char cdf_c_second[2]; /*second*/ char cdf_c_h_second[2]; /*hundredths of second*/ char cdf_c_timezone; /*timezone, offset from Greenwich Mean Time in number of 15 minutes intervals from -48(West) to +52(East)*/ /*modification time*/ char cdf_m_year[4]; /*years since year 0000*/ char cdf_m_month[2]; /*month*/ char cdf_m_day[2]; /*day*/ char cdf_m_hour[2]; /*hour*/ char cdf_m_minute[2]; /*minute*/ char cdf_m_second[2]; /*second*/ char cdf_m_h_second[2]; /*hundredths of second*/ char cdf_m_timezone; /*timezone, offset from Greenwich Mean Time in number of 15 minutes intervals from -48(West) to +52(East)*/ /*expiration time*/ char cdf_x_year[4]; /*years since year 0000*/ char cdf_x_month[2]; /*month*/ Hewlett-Packard Company - 2 - HP-UX Release 9.0: August 1992 cdfs(4) cdfs(4) char cdf_x_day[2]; /*day*/ char cdf_x_hour[2]; /*hour*/ char cdf_x_minute[2]; /*minute*/ char cdf_x_second[2]; /*second*/ char cdf_x_h_second[2]; /*hundredths of second*/ char cdf_x_timezone; /*timezone, offset from Greenwich Mean Time in number of 15 minutes intervals from -48(West) to +52(East)*/ /*effective time*/ char cdf_e_year[4]; /*years since year 0000*/ char cdf_e_month[2]; /*month*/ char cdf_e_day[2]; /*day*/ char cdf_e_hour[2]; /*hour*/ char cdf_e_minute[2]; /*minute*/ char cdf_e_second[2]; /*second*/ char cdf_e_h_second[2]; /*hundredths of second*/ char cdf_e_timezone; /*timezone, offset from Greenwich Mean Time in number of 15 minutes intervals from -48(West) to +52(East)*/ u_char cdfs_fs_version; /*file structure version:1 for ISO-9660*/ char cdf_unused4; char cdf_appl_use[APPL_USE_SIZ]; /*reserved for application*/ char cdf_future_use[653]; /*reserved for future. Note that if total size of field before this one is changed, this size should be changed so that the size of this structure is 2048*/ }; struct hcdfs /*primary volume descriptor-HSG*/ { u_int cdf_loc_lsb; /*logical block no. (LSB) of this descr.*/ u_int cdf_loc_msb; /*logical block no. (MSB) of this descr.*/ char cdf_vold_type; /*volume descriptor type*/ char cdf_std_id[STD_ID_SIZ]; /*id "CDROM" for HSG */ char cdf_vold_version; /*should be 1 for HSG */ char cdf_unused1; /*spare*/ char cdf_sys_id[SYS_ID_SIZ]; /*id of a system that knows contents of system area, logical sector 0-15*/ char cdf_vol_id[VOL_ID_SIZ]; /*id of this volume*/ char cdf_unused2[8]; /*spare*/ int cdf_vol_size_lsb; /*size (LSB) of volume in logical block*/ int cdf_vol_size_msb; /*size (MSB) of volume in logical block*/ char cdf_unused3[32]; /*spare*/ ushort cdf_volset_siz_lsb; /*size (LSB) of volume set*/ ushort cdf_volset_siz_msb; /*size (MSB) of volume set*/ ushort cdf_volset_seq_lsb; /*sequence no. (LSB) of volume in the set*/ ushort cdf_volset_seq_msb; /*sequence no. (MSB) of volume in the set*/ ushort cdf_logblk_siz_lsb; /*size (LSB) of logical block in bytes*/ ushort cdf_logblk_siz_msb; /*size (MSB) of logical block in bytes*/ Hewlett-Packard Company - 3 - HP-UX Release 9.0: August 1992 cdfs(4) cdfs(4) u_int cdf_pathtbl_siz_lsb; /*size (LSB) of path table in bytes */ u_int cdf_pathtbl_siz_msb; /*size (MSB) of path table in bytes */ u_int cdf_pathtbl_loc_lsb; /*logical block no. (LSB) of path table*/ u_int cdf_pathtblo1_loc_lsb; /*logical block number (LSB) of optional path table*/ u_int cdf_pathtblo2_loc_lsb; /*logical block number (LSB) of optional path table*/ u_int cdf_pathtblo3_loc_lsb; /*logical block number (LSB) of optional path table*/ u_int cdf_pathtbl_loc_msb; /*logic block num. (MSB) of path table*/ u_int cdf_pathtblo1_loc_msb; /*logic block num (MSB) of optional path table*/ u_int cdf_pathtblo2_loc_msb; /*logic block num (MSB) of optional path table*/ u_int cdf_pathtblo3_loc_msb; /*logic block num (MSB) of optional path table*/ struct min_cddir cdf_rootdp; /*directory record of root*/ char cdf_vol_set_id[VOL_SET_ID_SIZ]; /*id of the volume set*/ char cdf_pb_id[PUBLISHER_ID_SIZ]; /*publisher's id*/ char cdf_pp_id[PREPARER_ID_SIZ]; /*preparer's id*/ char cdf_ap_id[APPLICATION_ID_SIZ]; /*application id*/ char cdf_copyright[KMAXNAMLEN-5]; /*copyright in this file under root directory, the max. len. is 12, the rest unused*/ char cdf_abstract[KMAXNAMLEN-5]; /*abstract in this file under root directory, the max. len. is 12, the rest unused*/ /* the next four chunks are creation time, modification time, expiration time and effective time. Since the date/time info is 17 bytes(odd), a structure can't be used (compiler rounds up to even bytes). If for any reason this info is changed, be sure to fix all four of them. */ /*creation time*/ char cdf_c_year[4]; /*years since year 0000*/ char cdf_c_month[2]; /*month*/ char cdf_c_day[2]; /*day*/ char cdf_c_hour[2]; /*hour*/ char cdf_c_minute[2]; /*minute*/ char cdf_c_second[2]; /*second*/ char cdf_c_h_second[2]; /*hundredths of second*/ /*modification time*/ char cdf_m_year[4]; /*years since year 0000*/ char cdf_m_month[2]; /*month*/ char cdf_m_day[2]; /*day*/ char cdf_m_hour[2]; /*hour*/ char cdf_m_minute[2]; /*minute*/ char cdf_m_second[2]; /*second*/ char cdf_m_h_second[2]; /*hundredths of second*/ /*expiration time*/ char cdf_x_year[4]; /*years since year 0000*/ char cdf_x_month[2]; /*month*/ Hewlett-Packard Company - 4 - HP-UX Release 9.0: August 1992 cdfs(4) cdfs(4) char cdf_x_day[2]; /*day*/ char cdf_x_hour[2]; /*hour*/ char cdf_x_minute[2]; /*minute*/ char cdf_x_second[2]; /*second*/ char cdf_x_h_second[2]; /*hundredths of second*/ /*effective time*/ char cdf_e_year[4]; /*years since year 0000*/ char cdf_e_month[2]; /*month*/ char cdf_e_day[2]; /*day*/ char cdf_e_hour[2]; /*hour*/ char cdf_e_minute[2]; /*minute*/ char cdf_e_second[2]; /*second*/ char cdf_e_h_second[2]; /*hundredths of second*/ u_char cdfs_fs_version; /*file structure version:1 for HSG*/ char cdf_unused4; char cdf_appl_use[APPL_USE_SIZ]; /*reserved for application*/ char cdf_future_use[680]; /*reserved for future. Note that if total size of field before this one is changed, this size should be changed so that the size of this structure is 2048*/ }; Note the physical differences between the two formats' volume descriptors: 1. The HSG volume descriptor includes the logical block number at which the descriptor occurs; ISO does not. 2. The HSG volume descriptor provides for more optional path tables (three optional type-L path tables plus three optional type-M path tables) than does ISO (one optional path table of each type); 3. The HSG volume descriptor does not provide for a bibliographic file, while ISO does; 4. The HSG volume descriptor does not provide for GMT offsets in the creation, modification, expiration, and effective times, while ISO does; 5. The HSG volume descriptor's "reserved for future use" field is larger than that of the ISO descriptor's. Fields are defined as follows: cdf_loc_lsb Defined for HSG format only. Logical block number at which this particular volume descriptor is arranged in least-significant- byte-first order. Hewlett-Packard Company - 5 - HP-UX Release 9.0: August 1992 cdfs(4) cdfs(4) cdf_loc_msb Same as cdf_loc_lsb except that volume descriptor is arranged in most-significant- byte-first order. cdf_vold_type Volume descriptor type. Value should be one (1) for both formats. cdf_std_id A five-character standard ID which identifies the standard format in use. For ISO, this string is CD001; for HSG, it is CDROM. Note that this field is the one most often used to differentiate between the two formats. cdf_vold_version Volume descriptor version number for the volume. This value should be one (1) for both formats. cdf_sys_id Identifies what system or systems specify and understand the contents of the system area (logical blocks zero through 15). This field can contain a string of up to 32 characters. The ID is left-justified in the field and padded on the right with spaces. cdf_vol_id Identifies the volume. This field can contain a string of up to 32 characters. The ID is left-justified in the field and padded on the right with spaces. cdf_vol_size_lsb Size of this particular volume in logical blocks. Value is given in least- significant-byte-first order. cdf_vol_size_msb Same as cdf_vol_size_lsb except that value is given in most-significant-byte-first order, cdf_volset_siz_lsb Volume-set size of the volume set of which this volume is a member. This value is given in least-significant-byte-first order. cdf_volset_siz_msb Same as cdf_volset_siz_lsb except value is in most-significant-byte-first order. cdf_volset_seq_lsb Gives the volume-sequence number of this volume in least-significant-byte-first order. The volume-sequence number determines the order in which volumes occur in the volume set. cdf_volset_seq_msb Same as cdf_volset_seq_lsb except value is in most-significant-byte-first order. Hewlett-Packard Company - 6 - HP-UX Release 9.0: August 1992 cdfs(4) cdfs(4) cdf_logblk_siz_lsb Logical block size for this volume in least- significant-byte-first order. The logical block size cannot be less than 512 bytes, and cannot exceed the logical sector size of the device (currently does not exceed 2048 bytes). cdf_logblk_siz_msb Same as cdf_logblk_siz_lsb except value is in most-significant-byte-first order. cdf_pathtbl_siz_lsb Size of the path table for this volume in bytes. This value is given in least- significant-byte-first order. A path table defines the directory hierarchy of the file system on the volume. The first entry in the table describes the root directory. cdf_pathtbl_siz_msb Same as cdf_pathtbl_siz_lsb except that value is in most-significant-byte-first order. cdf_pathtbl_loc_lsb Logical block number of the block where the mandatory type-L path table begins. This value is given in least-significant-byte- first order. A type-L path table is a path table whose numerical values are all specified in least-significant-byte-first order. cdf_pathtblo_loc_lsb (in ISO format) cdf_pathtblo1_loc_lsb, cdf_pathtblo2_loc_lsb, cdf_pathtblo3_loc_lsb (in HSG format) These fields specify the logical block numbers of the blocks where optional type-L path tables begin. If an optional type-L path table does not exist, the corresponding field is given a zero value. All values are specified in least-significant-byte-first order. cdf_pathtbl_loc_msb Logical block number of the block where the mandatory type-M path table begins. This value is given in most-significant-byte-first order. A type-M path table is a path table whose numerical values are all specified in most-significant-byte-first order. cdf_pathtblo_loc_msb (in ISO format) cdf_pathtblo1_loc_msb, cdf_pathtblo2_loc_msb, Hewlett-Packard Company - 7 - HP-UX Release 9.0: August 1992 cdfs(4) cdfs(4) cdf_pathtblo3_loc_msb (in HSG format) These fields specify the logical block numbers of the blocks where optional type-M path tables begin. If an optional type-M path table does not exist, the corresponding field is given a zero value. All values are specified in most-significant-byte-first order. cdf_rootdp Structure containing a duplicate of the root directory record. This structure is defined in <sys/cdfsdir.h> as follows: struct min_cddir { u_char mincdd_reclen; /*length of directory record in bytes*/ u_char mincdd_xar_len; /*length of XAR in logic blocks*/ u_int mincdd_loc_lsb; /*logic block number of the extent in LSB*/ u_int mincdd_loc_msb; /*logic block number of the extent in MSB*/ u_int mincdd_size_lsb; /*size (in bytes) of the file section in LSB*/ u_int mincdd_size_msb; /*size (in bytes) of the file section in MSB*/ u_char mincdd_year; /*years since 1900*/ u_char mincdd_month; /*month*/ u_char mincdd_day; /*day*/ u_char mincdd_hour; /*hour*/ u_char mincdd_minute; /*minute*/ u_char mincdd_second; /*second*/ char mincdd_timezone; /*timezone, offset from Greenwich Mean Time in number of 15 minutes intervals from -48(West) to +52(East)*/ u_char mincdd_flag; /*file flags*/ u_char mincdd_unit_size; /*size (in logic blocks) of file unit*/ u_char mincdd_lg_size; /*size (in logic blocks) of interleave gap*/ u_short mincdd_vol_seq_lsb; /*sequence num. of disc has the extent(LSB)*/ u_short mincdd_vol_seq_msb; /*sequence num. of disc has the extent(MSB)*/ u_char mincdd_idlen; /*file id length in bytes*/ char mincdd_file_id[KMINNAMLEN]; }; Fields in this structure are defined as follows: mincdd_reclen Length of this directory record, in bytes. Always 34. mincdd_xar_len Length of the extended attribute record (XAR) for the root directory, if any, in logical blocks. If there is no XAR, this value is zero. mincdd_loc_lsb Logical block number of the block in which the data for the root directory begins, in least-significant-byte-first Hewlett-Packard Company - 8 - HP-UX Release 9.0: August 1992 cdfs(4) cdfs(4) order. If mincdd_xar_len is non-zero, this block number is the block where the XAR begins; otherwise, it is the block where the root directory begins. mincdd_loc_msb Same as mincdd_loc_lsb above, only written in most-significant-byte-first order. mincdd_size_lsb Length of the root directory data (excluding any XAR) in bytes, written in least-significant-byte-first order. mincdd_size_msb Same as mincdd_size_lsb above, except written in most-significant-byte-first order. mincdd_year Numerical value giving the number of years since 1900, specifying the year in which this directory record was recorded. mincdd_month Numerical value giving the month (1 = January) in which this directory record was recorded. mincdd_day Numerical value giving the day of the month in which this directory record was recorded. mincdd_hour Numerical value giving the hour of the day (in 24-hour clock time) in which this directory record was recorded. mincdd_minute Numerical value giving the minute of the hour in which this directory record was recorded. mincdd_second Numerical value giving the second of the minute in which this directory record was recorded. mincdd_timezone Numerical value giving the offset from Greenwich Mean Time in 15-minute intervals (-48 to 52) of the timezone in which this directory record was recorded. mincdd_flag File flags for the root directory. Hewlett-Packard Company - 9 - HP-UX Release 9.0: August 1992 cdfs(4) cdfs(4) mincdd_unit_size Size of the file unit if the file is interleaved (directories cannot be interleaved, so this value is always zero for the root directory). mincdd_lg_size Size of the interleave gap if the file is interleaved (this field is always zero for the root directory). mincdd_vol_seq_lsb Volume sequence number of the volume in the volume set containing the record for the root directory. This value is written in least-significant-byte-first order. mincdd_vol_seq_msb Same as mincdd_vol_seq_lsb except written in most-significant-byte-first order. mincdd_idlen Length of the name of this file. Since the ``name'' of the root directory is a constant byte value of zero, this value is always one (1). mincdd_file_id A character string giving the name of the file. The root directory's ``name'' is always a constant byte value of zero. Other fields are defined as follows: cdf_vol_set_id Character string giving the identification of the volume set of which this volume is a member. Up to 128 characters can be specified. ID is left-justified in the field, and padded on the right with spaces. cdf_pb_id Identification of the entity which specified what would be recorded on the volume set or volume group of which this volume is a member. Up to 128 characters can be specified. In ISO format only, if the first character in the field is an underscore, the remaining characters specify a file whose contents provide the identification. In both formats, the ID is left-justified in the field and padded on the right with spaces. Hewlett-Packard Company - 10 - HP-UX Release 9.0: August 1992 cdfs(4) cdfs(4) cdf_pp_id Identification of the entity which controls the preparation of the data recorded on the volume. Up to 128 characters can be specified. In ISO format only, if the first character in the field is an underscore, the remaining characters specify a file whose contents provide the identification. In both formats, the ID is left-justified in the field and padded on the right with spaces. cdf_ap_id Identification of the specification for how the data is recorded on the volume. Up to 128 characters can be specified. In ISO format only, if the first character in the field is an underscore, the remaining characters specify a file whose contents provide the identification. In both formats, the ID is left-justified in the field and padded on the right with spaces. cdf_copyright Specifies the name of a file in the root directory that contains the copyright statement applicable to this volume and all preceding volumes in the volume set. In ISO format, up to 37 characters can be specified; in HSG, up to 32 are possible. The filename is left- justified in the field and padded on the right with spaces. cdf_abstract Specifies the name of a file in the root directory containing the abstract statement applicable to this volume. In ISO format, up to 37 characters can be specified; in HSG, up to 32 are possible. The filename is left- justified in the field, and padded on the right with spaces. cdf_bibliographic Defined in ISO format only. Specifies the name of a file in the root directory which contains bibliographic records interpreted according to standards agreed upon by the originator and the recipient of the volume. Up to 37 characters can be specified. The filename is left-justified in the field and padded on the right with spaces. Hewlett-Packard Company - 11 - HP-UX Release 9.0: August 1992 cdfs(4) cdfs(4) Date/Time fields The next 28 fields (in HSG) or 32 fields (in ISO) specify various dates and times. Note that all fields in these dates and times contain ASCII digits (except for the timezone fields in ISO, which contain an eight-bit two's complement value). The creation time gives the date and time at which the volume was created (recorded). The modification time gives the date and time when the contents of the volume were last modified. The expiration time gives the date and time after which the data on the volume is no longer valid. The effective time gives the date and time after which the data becomes valid. cdfs_fs_version Specifies the version number of the specification of the directory and path table records. For both formats, this value is one (1). cdf_appl_use A 512-byte space whose contents are not specified by the standards, but which can be used by an application for purposes agreed upon prior to disc mastering. cdf_future_use Reserved for future use; initialized to contain zeros. This field contains 653 bytes in ISO format, and 680 bytes in HSG. NOTES At the present time, only the statfs() system call (see statfs(2)) returns information from the volume descriptor. Information returned is limited to the logical block size and the size of the volume. The rest of the volume descriptor can only be read by means of a raw read of the CD-ROM itself. Fields in the volume descriptor that contain character strings are not null-terminated. SEE ALSO cdrom(4), cdfsdir(4), cdnode(4). Information Processing - Volume and File Structure of CD-ROM for Information Interchange, Ref. No. ISO 9660: 1988 (E). The Working Paper for Information Processing - Volume and File Structure of" Compact Read Only Optical Discs for Information Hewlett-Packard Company - 12 - HP-UX Release 9.0: August 1992 cdfs(4) cdfs(4) Interchange, National Information Standards Organization [Z39]. Hewlett-Packard Company - 13 - HP-UX Release 9.0: August 1992