dir(4) — FILE FORMATS
NAME
dir (cdfs) − format of cdfs directories
SYNOPSIS
#include <sys/types.h>
#include <sys/fs/cdfsdir.h>
DESCRIPTION
An ISO-9660 standard cdrom disc directory file has multiple directory records, one for each extent in a file. The final directory record for a file is marked with an unset CDD_MULTIX flag. An ISO-9660 file is composed of several extents with the optional XAR record at the start of each extent. The ISO-9660 directory record is a variable length packed structure. Field names that include be are in the big-endian word format. ISO-9660 and High-Sierra standards use little-endian word formats as the default.
/∗ On-disk ISO-9660 directory record ∗/
struct cddir {
char cdd_dirlen; /∗ length (bytes) of dir record ∗/
char cdd_xarlen; /∗ length (lb’s?) of XAR ∗/
daddr_t cdd_extlbn; /∗ LBN of extent ∗/
daddr_t cdd_be_extlbn; /∗ ... big-endian ∗/
daddr_t cdd_datalen; /∗ length of data (not XAR) ∗/
daddr_t cdd_be_datalen;/∗ ... big-endian ∗/
char cdd_year; /∗ 1900 - year ∗/
char cdd_month; /∗ 1 thru 12 ∗/
char cdd_mday; /∗ 1 thru 31 ∗/
char cdd_hour; /∗ 0 thru 23 ∗/
char cdd_minute; /∗ 0 thru 59 ∗/
char cdd_second; /∗ 0 thru 59 ∗/
char cdd_gmoffset; /∗ gm offset ∗/
char cdd_flags; /∗ see below ∗/
char cdd_ilsz; /∗ interleave (file unit) size ∗/
char cdd_ilskip; /∗ ∗/
ushort cdd_volno; /∗ data volume sequence number ∗/
ushort cdd_be_volno; /∗ ... big-endian ∗/
char cdd_namelen; /∗ size of directory name ∗/
char cdd_dirname[1];/∗ sized by above ∗/
};
/∗ Directory flag values ∗/
#define CDD_EXISTS 0x01 /∗ Set if file exists ∗/
#define CDD_DIR 0x02 /∗ File is a directory ∗/
#define CDD_ASSOC 0x04 /∗ Is an associated file ∗/
#define CDD_REC 0x08 /∗ Has record structure ∗/
#define CDD_PROT 0x10 /∗ Owner + Group permissions specified∗/
#define CDD_MULTIX 0x40 /∗ If set, more extents follow ∗/
/∗ On-disk High-Sierra directory record ∗/
struct hsdir {
char hsd_dirlen; /∗ length (bytes) of dir record ∗/
char hsd_xarlen; /∗ length (lb’s?) of XAR ∗/
daddr_t hsd_extlbn; /∗ LBN of extent ∗/
daddr_t hsd_be_extlbn; /∗ ... big-endian ∗/
daddr_t hsd_datalen; /∗ length of data (not XAR) ∗/
daddr_t hsd_be_datalen; /∗ ... big-endian ∗/
char hsd_year; /∗ 1900 - year ∗/
char hsd_month; /∗ 1 thru 12 ∗/
char hsd_mday; /∗ 1 thru 31 ∗/
char hsd_hour; /∗ 0 thru 23 ∗/
char hsd_minute; /∗ 0 thru 59 ∗/
char hsd_second; /∗ 0 thru 59 ∗/
char hsd_flags; /∗ see below ∗/
char hsd_resvd1; /∗ ∗/
char hsd_ilsz; /∗ interleave (file unit) size ∗/
char hsd_ilskip; /∗ interleave skip factor ∗/
ushort hsd_volno; /∗ data volume sequence number ∗/
ushort hsd_be_volno; /∗ ... big-endian ∗/
char hsd_namelen; /∗ size of directory name ∗/
char hsd_dirname[1]; /∗ sized by above ∗/
}
By the ISO-9660 standard, the first two files in each directory are named on the disk as "0" and translated by the cdrom file system to "." for the entry itself and as "1" translated to ".." by the cdrom file system for the parent directory. The meaning of ".." is modified for the root directory of the master filesystem; there is no parent, so ".." has the same meaning as "." has.
The XAR or Extended Attribute Record is used to provide read, execute permissions and ownership information for a particular file on the cdrom disc. This record is also variable length.
/∗ Extended Attribute Record (XAR) ∗/
struct cdxar {
ushort cdx_owner; /∗ owner ID ∗/
ushort cdx_be_owner; /∗ ... big-endian ∗/
ushort cdx_group; /∗ group ID ∗/
ushort cdx_be_group; /∗ ... big-endian ∗/
char cdx_perms[2]; /∗ access perms (see below) ∗/
struct cddate cdx_ctime, /∗ creation time ∗/
cdx_mtime, /∗ last modification ∗/
cdx_exptime, /∗ when file expires ∗/
cdx_efftime; /∗ when info becomes effective ∗/
char cdx_recfmt; /∗ record structure ∗/
char cdx_recattr; /∗ record attribs ∗/
ushort cdx_reclen; /∗ record length ∗/
ushort cdx_be_reclen; /∗ ... big-endian ∗/
char cdx_sysid[32]; /∗ system identification ∗/
char cdx_resvd1[64]; /∗ ∗/
char cdx_xarver; /∗ XAR version ( == 1) ∗/
char cdx_escseqlen; /∗ escape sequence length ∗/
char cdx_rsvd1[64]; /∗ reserved ∗/
ushort cdx_applen; /∗ application area len ∗/
ushort cdx_be_applen; /∗ application area len ∗/
char cdx_pad[1];
};
SEE ALSO
— CDFS