fs(4) —
NAME
fs (cdfs) − format of cdfs file system volume
SYNOPSIS
#include <sys/param.h>
#include <sys/types.h>
#include <sys/fs/cdfsfilsys.h>
#include <sys/fs/cdfsvoldesc.h>
DESCRIPTION
Every file system storage volume has a common format for certain vital information. Every such volume is divided into a certain number of 2048-byte long blocks. The cdfs volume descriptor record that represents the cdrom disc super block can be found at block 16. Field names that include be are the in big-endian word format. ISO-9660 and High-Sierra standards use little-endian word formats as the default.
The format of a cdrom volume descriptor is:
struct cdvoldesc {
char cdv_type; /∗ see below ∗/
char cdv_std_id[5]; /∗ "CD001" ∗/
char cdv_std_ver; /∗ 1 == this standard ∗/
char cdv_resvd1; /∗ ∗/
char cdv_sysid[32]; /∗ ∗/
char cdv_volid[32]; /∗ ∗/
char cdv_resvd2[8]; /∗ ∗/
daddr_t cdv_volsize; /∗ logical blocks in volume ∗/
daddr_t cdv_be_volsize; /∗ ... big-endian ∗/
char cdv_resvd3[32]; /∗ ∗/
ushort cdv_nvols; /∗ volumes in set ∗/
ushort cdv_be_nvols; /∗ ... big-endian ∗/
ushort cdv_volseq; /∗ number of this vol in set ∗/
ushort cdv_be_volseq; /∗ ... big-endian ∗/
ushort cdv_lbsize; /∗ logical blocksize ∗/
ushort cdv_be_lbsize; /∗ ... big-endian ∗/
unsigned cdv_ptsize; /∗ path table size (bytes) ∗/
unsigned cdv_be_ptsize; /∗ ... big-endian ∗/
daddr_t cdv_ptloc; /∗ LBN of path table ∗/
daddr_t cdv_optpt1; /∗ LBN of optional dup table ∗/
daddr_t cdv_be_ptloc; /∗ LBN of path table(swapped)∗/
daddr_t cdv_be_optpt1; /∗ LBN of optional dup table ∗/
struct cddir cdv_rootdirent; /∗ root dir entry ∗/
char cdv_vsid[128]; /∗ volume set id ∗/
char cdv_pubid[128]; /∗ publsher id ∗/
char cdv_prpid[128]; /∗ preparer id ∗/
char cdv_aplid[128]; /∗ application id ∗/
char cdv_cpyrt[37]; /∗ name of copyright file ∗/
char cdv_abstr[37]; /∗ name of abstract file ∗/
char cdv_biblo[37]; /∗ name of bibl ofile ∗/
struct cddate cdv_ctime, /∗ creation time ∗/
cdv_mtime, /∗ last modification ∗/
cdv_exptime, /∗ when volume expires ∗/
cdv_efftime; /∗when info becomes effective∗/
char cdv_fsstd; /∗ structure standard ( == 1)∗/
char cdv_resvd4;
char cdv_aplresvd[512];
char cdv_resvd5[653];
}
cdv_std_id indicates the file system type. Currently, High-Sierra format marked in the field as CDROM and ISO-9660 format marked in the field as CD001 are the types of CDROM discs are supported.
cdv_volid is the name of the CDROM disc volume.
cdv_volsize is the CDROM volume size in logical blocks.
cdv_nvols is the number of CDROM discs in the volume set.
cdv_volseq is the number of the CDROM disc volume in the volume set.
NOTE: The Motorola 88K Unix SVR4 system cdfs file system does not allow multi-volume ISO-9660 CDROM volume sets to be mounted as a single file system. Each CDROM disc must be separately mounted.
cdv_lbsize is the logical block size used on the disc in bytes. Most ISO-9660 CDROM discs support a logical block size of 2048.
The ISO-9660 and High-Sierra disc standards support a means of quickly accessing a directory, called a "path table" that avoids walking the directory tree. A path table is a sorted structure containing directory names and the logical block offsets to the directory file.
cdv_ptsize is the path table size in bytes.
cdv_ptloc is the logical block number of the start of the path table on the CDROM disc.
cdv_rootdirent is the root directory structure used to locate the root directory file.
cdv_vsid (volume set id), cdv_pubid (publsher id), cdv_prpid (preparer id), BR cdv_aplid (application id), cdv_cpyrt (name of copyright file), cdv_abstr (name of abstract file), and cdv_biblo (name of bibliography file) are optional descriptive fileds and files that the cdfs file system does not use.
cdv_ctime (creation time), cdv_mtime (last modification), cdv_exptime (when volume expires), and cdv_efftime (when info becomes effective) are the time stamp structures used on the CDROM d isc. The following structure is how a date time stamp is stored on an ISO-9600 CDROM disc.
struct cddate{
char cdd_year[4]; /∗ 1 - 9999 ∗/
char cdd_month[2]; /∗ 1 - 12 ∗/
char cdd_mday[2]; /∗ 1 - 31 ∗/
char cdd_hour[2]; /∗ 0 - 23 ∗/
char cdd_min[2]; /∗ 0 - 59 ∗/
char cdd_sec[2]; /∗ 0 - 59 ∗/
char cdd_cdec[2]; /∗ 0 - 99 (hundredeth of a sec) ∗/
char cdd_gmoffset; /∗ GM offset ∗/
};
A volume descriptor is translated by the cdfs file system into a cdfilsys in-memory structure. One of these structures is created for every mounted cdfs file system. The format of the cdfilsys structure is described below.
struct cdfilsys {
ushort cdf_uid; /∗ uid of mounter ∗/
ushort cdf_gid; /∗ gid of mounter ∗/
char cdf_fname[8];
char cdf_pack[8];
ushort cdf_lbsize; /∗ Logical block size ∗/
ushort cdf_currvol; /∗ current volume ∗/
ushort cdf_rootvol; /∗ vol in drive at mount ∗/
int cdf_rootino; /∗ inumber of root directory ∗/
int cdf_imapix; /∗ next imap slot to use ∗/
struct cdimap ∗cdf_imap; /∗ inode # mapping table ∗/
struct cdpathtab
∗cdf_pathtab, /∗ incore path table ∗/
∗∗cdf_ptabix; /∗ index for above ∗/
int cdf_ptsize; /∗ path table byte size ∗/
int cdf_nptrec; /∗ # of path table records ∗/
char ∗cdf_dynmspace; /∗ pointer to base of above ∗/
int cdf_dynmsize; /∗ pages of dynamic data ∗/
int cdf_flag;
struct cddir cdf_rootdir; /∗ root directory entry ∗/
struct hsdir cdf_hsrootdir; /∗ HS root directory entry ∗/
dev_t cdf_dev; /∗ device mounted upon ∗/
int cdf_volsize; /∗ volsize ∗/
}
#define CDF_FREE 0
#define CDF_ALLOC 1
#define CDF_ISO9660 2
cdf_uid and cdf_gid are user and group id of the user that mounted the file system.
cdf_fname, cdf_pack, cdf_currvol and cdf_rootvol are used to identify the the disk and mount point names and volume numbers of the mounted cdrom file file system. cdf_rootino is the inode number of the root directory of the cdfs file system. cdf_lbsize is the logical block size of the cdrom file system in bytes.
cdf_imapix and cdf_imap are the index and pointer to the "inode to cdrom file" mapping table. Due to the lack of a true inode for a cdrom file, a number is created and mapped to the file on the CDROM disc.
cdf_pathtab, cdf_ptabix, cdf_ptsize and cdf_nptrec are the pointer to the in-memory path table for the mounted CDROM disc, the index for the path table, the path table size in btyes and the number of path table records respectively.
cdf_dynmspace and cdf_dynmsize are the pointer and size of the dynamic memory allocated to support and instance of a mounted cdfs file system.
cdf_flag is used to indicate whether the cdfilsys structure is available and whether the mounted disc is ISO-9660 or High-Sierra format.
cdf_rootdir is the root directory record copied from the CDROM disc. cdfs_dev is the device number of the device the file system is mounted on. cdf_volsize is the size of the cdfs file system in logical blocks.
SEE ALSO
— CDFS