Headers archives.h(3HEAD)
NAME
archives.h, archives - device header
DESCRIPTION
/* Magic numbers */
#define CMNASC 0x070701 /* Cpio Magic Number for -c header */
#define CMNBIN 070707 /* Cpio Magic Number for Binary header */
#define CMNBS 0143561 /* Cpio Magic Number for Byte-Swap header */
#define CMNCRC 0x070702 /* Cpio Magic Number for CRC header */
#define CMSASC "070701" /* Cpio Magic String for -c header */
#define CMSCHR "070707" /* Cpio Magic String for odc header */
#define CMSCRC "070702" /* Cpio Magic String for CRC header */
#define CMSLEN 6 /* Cpio Magic String length */
/* Various header and field lengths */
#define CHRSZ 76 /* -H odc size minus filename field */
#define ASCSZ 110 /* -c and CRC hdr size minus filename field */
#define TARSZ 512 /* TAR hdr size */
#define HNAMLEN 256 /* maximum filename length for binary and
odc headers */
#define EXPNLEN 1024 /* maximum filename length for -c and
CRC headers */
#define HTIMLEN 2 /* length of modification time field */
#define HSIZLEN 2 /* length of file size field */
/* cpio binary header definition */
struct hdrcpio {
short hmagic, /* magic number field */
hdev; /* file system of file */
ushortt hino, /* inode of file */
hmode, /* modes of file */
huid, /* uid of file */
hgid; /* gid of file */
short hnlink, /* number of links to file */
hrdev, /* maj/min numbers for special files */
hmtime[HTIMLEN], /* modification time of file */
hnamesize, /* length of filename */
hfilesize[HSIZLEN]; /* size of file */
char hname[HNAMLEN]; /* filename */
} ;
/* cpio -H odc header format */
struct chdr {
char cmagic[CMSLEN],
cdev[6],
cino[6],
cmode[6],
cuid[6],
cgid[6],
cnlink[6],
crdev[6],
cmtime[11],
cnamesz[6],
cfilesz[11],
cname[HNAMLEN];
SunOS 5.11 Last change: 22 Oct 2007 1
Headers archives.h(3HEAD)
} ;
/* -c and CRC header format */
struct Expcpiohdr {
char Emagic[CMSLEN],
Eino[8],
Emode[8],
Euid[8],
Egid[8],
Enlink[8],
Emtime[8],
Efilesize[8],
Emaj[8],
Emin[8],
Ermaj[8],
Ermin[8],
Enamesize[8],
Echksum[8],
Ename[EXPNLEN];
} ;
/* Tar header structure and format */
#define TBLOCK 512 /* length of tar header and data blocks */
#define TNAMLEN 100 /* maximum length for tar file names */
#define TMODLEN 8 /* length of mode field */
#define TUIDLEN 8 /* length of uid field */
#define TGIDLEN 8 /* length of gid field */
#define TSIZLEN 12 /* length of size field */
#define TIMLEN 12 /* length of modification time field */
#define TCRCLEN 8 /* length of header checksum field */
/* tar header definition */
union tblock {
char dummy[TBLOCK];
struct header {
char tname[TNAMLEN]; /* name of file */
char tmode[TMODLEN]; /* mode of file */
char tuid[TUIDLEN]; /* uid of file */
char tgid[TGIDLEN]; /* gid of file */
char tsize[TSIZLEN]; /* size of file in bytes */
char tmtime[TIMLEN]; /* modification time of file */
char tchksum[TCRCLEN]; /* checksum of header */
char ttypeflag; /* flag to indicate type of file */
char tlinkname[TNAMLEN]; /* file this file is linked with */
char tmagic[6]; /* magic string always "ustar" */
char tversion[2]; /* version strings always "00" */
char tuname[32]; /* owner of file in ASCI */
char tgname[32]; /* group of file in ASCI */
char tdevmajor[8]; /* major number for special files */
char tdevminor[8]; /* minor number for special files */
char tprefix[155]; /* pathname prefix */
} tbuf;
}
/* volcopy tape label format and structure */
#define VMAGLEN 8
SunOS 5.11 Last change: 22 Oct 2007 2
Headers archives.h(3HEAD)
#define VOLEN 6
#define VFILEN 464
struct volcopylabel {
char vmagic[VMAGLEN],
vvolume[VOLEN],
vreels,
vreel;
long vtime,
vlength,
vdens,
vreelblks, /* u370 added field */
vblksize, /* u370 added field */
vnblocks; /* u370 added field */
char vfill[VFILEN];
long voffset; /* used with -e and -reel options */
int vtype; /* does tape have nblocks field? */
} ;
/*
* Define archive formats for extended attributes.
*
* Extended attributes are stored in two pieces.
* 1. An attribute header which has information about
* what file the attribute is for and what the attribute
* is named.
* 2. The attribute record itself. Stored as a normal file type
* of entry.
* Both the header and attribute record have special modes/typeflags
* associated with them.
*
* The names of the header in the archive look like:
* /dev/null/attr.hdr
*
* The name of the attribute looks like:
* /dev/null/attr.
*
* This is done so that an archiver that doesn't understand these formats
* can just dispose of the attribute records unless the user chooses to
* rename them via cpio -r or pax -i
*
* The format is composed of a fixed size header followed
* by a variable sized xattrbuf. If the attribute is a hard link
* to another attribute, then another xattrbuf section is included
* for the link.
*
* The xattrbuf is used to define the necessary "pathing" steps
* to get to the extended attribute. This is necessary to support
* a fully recursive attribute model where an attribute may itself
* have an attribute.
*
* The basic layout looks like this.
*
SunOS 5.11 Last change: 22 Oct 2007 3
Headers archives.h(3HEAD)
* --------------------------------
*
* xattrhdr
*
* --------------------------------
* --------------------------------
*
* xattrbuf
*
* --------------------------------
* --------------------------------
*
* (optional link info)
*
* --------------------------------
* --------------------------------
*
* attribute itself
* stored as normal tar
* or cpio data with
* special mode or
* typeflag
*
* --------------------------------
*
*/
#define XATRARCHVERS "1.0"
/*
* extended attribute fixed header
*
* hversion format version.
* hsize size of header ] variable sized data sections.
* hcomponentlen Length of entire pathing section.
* hlinkcomponentlen Length of link component section. Again same
* definition as hcomponentlen.
*/
struct xattrhdr {
char hversion[7];
char hsize[10];
char hcomponentlen[10]; /* total length of path component */
char hlinkcomponentlen[10];
};
/*
* The name is encoded like this:
* filepathNULattrpathNUL[attrpathNUL]...
*/
struct xattrbuf {
char hnamesz[7]; /* length of hnames */
char htypeflag; /* actual typeflag of file being archived */
char hnames[1]; /* filepathNULattrpathNUL... */
SunOS 5.11 Last change: 22 Oct 2007 4
Headers archives.h(3HEAD)
};
/*
* Special values for tar archives
*/
/*
* typeflag for tar archives.
*/
/*
* Attribute hdr and attribute files have the following typeflag
*/
#define XATRHDRTYPE 'E'
/*
* For cpio archives the header and attribute have
* XATRCPIOMODE ORED into the mode field in both
* character and binary versions of the archive format
*/
#define XATRCPIOMODE 0xB000
SunOS 5.11 Last change: 22 Oct 2007 5
|