1archives.h(3HEAD)                   Headers                  archives.h(3HEAD)
2
3
4

NAME

6       archives.h, archives - device header
7

DESCRIPTION

9         /* Magic numbers */
10         #define CMN_ASC 0x070701    /* Cpio Magic Number for -c header */
11         #define CMN_BIN 070707      /* Cpio Magic Number for Binary header */
12         #define CMN_BBS 0143561     /* Cpio Magic Number for Byte-Swap header */
13         #define CMN_CRC 0x070702    /* Cpio Magic Number for CRC header */
14         #define CMS_ASC "070701"    /* Cpio Magic String for -c header */
15         #define CMS_CHR "070707"    /* Cpio Magic String for odc header */
16         #define CMS_CRC "070702"    /* Cpio Magic String for CRC header */
17         #define CMS_LEN 6           /* Cpio Magic String length */
18         /* Various header and field lengths */
19         #define CHRSZ   76         /* -H odc size minus filename field */
20         #define ASCSZ   110        /* -c and CRC hdr size minus filename field */
21         #define TARSZ   512        /* TAR hdr size */
22         #define HNAMLEN 256        /* maximum filename length for binary and
23                                   odc headers */
24         #define EXPNLEN 1024      /* maximum filename length for -c and
25                                  CRC headers */
26         #define HTIMLEN 2         /* length of modification time field */
27         #define HSIZLEN 2         /* length of file size field */
28         /* cpio binary header definition */
29         struct hdr_cpio {
30                short   h_magic,           /* magic number field */
31                        h_dev;             /* file system of file */
32                ushort_t  h_ino,           /* inode of file */
33                        h_mode,            /* modes of file */
34                        h_uid,             /* uid of file */
35                        h_gid;             /* gid of file */
36                short   h_nlink,           /* number of links to file */
37                        h_rdev,            /* maj/min numbers for special files */
38                        h_mtime[HTIMLEN],  /* modification time of file */
39                        h_namesize,        /* length of filename */
40                   h_filesize[HSIZLEN];     /* size of file */
41              char h_name[HNAMLEN];    /* filename */
42         } ;
43         /* cpio -H odc header format */
44         struct c_hdr {
45                char c_magic[CMS_LEN],
46                     c_dev[6],
47                     c_ino[6],
48                     c_mode[6],
49                     c_uid[6],
50                     c_gid[6],
51                     c_nlink[6],
52                     c_rdev[6],
53                     c_mtime[11],
54                     c_namesz[6],
55                     c_filesz[11],
56                     c_name[HNAMLEN];
57         } ;
58         /* -c and CRC header format */
59         struct Exp_cpio_hdr {
60              char E_magic[CMS_LEN],
61                   E_ino[8],
62                   E_mode[8],
63                   E_uid[8],
64                   E_gid[8],
65                   E_nlink[8],
66                   E_mtime[8],
67                   E_filesize[8],
68                   E_maj[8],
69                   E_min[8],
70                   E_rmaj[8],
71                   E_rmin[8],
72                   E_namesize[8],
73                   E_chksum[8],
74                   E_name[EXPNLEN];
75         } ;
76         /* Tar header structure and format */
77         #define TBLOCK 512  /* length of tar header and data blocks */
78         #define TNAMLEN     100  /* maximum length for tar file names */
79         #define TMODLEN     8    /* length of mode field */
80         #define TUIDLEN     8    /* length of uid field */
81         #define TGIDLEN     8    /* length of gid field */
82         #define TSIZLEN     12   /* length of size field */
83         #define TTIMLEN     12   /* length of modification time field */
84         #define TCRCLEN     8    /* length of header checksum field */
85         /* tar header definition */
86         union tblock {
87              char dummy[TBLOCK];
88              struct header {
89                  char  t_name[TNAMLEN];     /* name of file */
90                  char  t_mode[TMODLEN];     /* mode of file */
91                  char  t_uid[TUIDLEN];      /* uid of file */
92                  char  t_gid[TGIDLEN];      /* gid of file */
93                  char  t_size[TSIZLEN];     /* size of file in bytes */
94                  char  t_mtime[TTIMLEN];    /* modification time of file */
95                  char  t_chksum[TCRCLEN];   /* checksum of header */
96                  char  t_typeflag;          /* flag to indicate type of file */
97                  char  t_linkname[TNAMLEN]; /* file this file is linked with */
98                  char  t_magic[6];          /* magic string always "ustar" */
99                  char  t_version[2];        /* version strings always "00" */
100                  char  t_uname[32];         /* owner of file in ASCII */
101                  char  t_gname[32];         /* group of file in ASCII */
102                  char  t_devmajor[8];       /* major number for special files */
103                  char  t_devminor[8];       /* minor number for special files */
104                  char  t_prefix[155];       /* pathname prefix */
105              } tbuf;
106         }
107         /* volcopy tape label format and structure */
108         #define VMAGLEN 8
109         #define VVOLLEN     6
110         #define VFILLEN     464
111         struct volcopy_label {
112              char v_magic[VMAGLEN],
113                   v_volume[VVOLLEN],
114                   v_reels,
115                   v_reel;
116              long v_time,
117                   v_length,
118                   v_dens,
119                   v_reelblks,    /* u370 added field */
120                   v_blksize,     /* u370 added field */
121                   v_nblocks;     /* u370 added field */
122              char v_fill[VFILLEN];
123              long v_offset; /* used with -e and -reel options */
124              int  v_type;        /* does tape have nblocks field? */
125         } ;
126
127         /*
128          * Define archive formats for extended attributes.
129          *
130          * Extended attributes are stored in two pieces.
131          * 1. An attribute header which has information about
132          *    what file the attribute is for and what the attribute
133          *    is named.
134          * 2. The attribute record itself.  Stored as a normal file type
135          *    of entry.
136          * Both the header and attribute record have special modes/typeflags
137          * associated with them.
138          *
139          * The names of the header in the archive look like:
140          * /dev/null/attr.hdr
141          *
142          * The name of the attribute looks like:
143          * /dev/null/attr.
144          *
145          * This is done so that an archiver that doesn't understand these formats
146          * can just dispose of the attribute records unless the user chooses to
147          * rename them via cpio -r or pax -i
148          *
149          * The format is composed of a fixed size header followed
150          * by a variable sized xattr_buf. If the attribute is a hard link
151          * to another attribute, then another xattr_buf section is included
152          * for the link.
153          *
154          * The xattr_buf is used to define the necessary "pathing" steps
155          * to get to the extended attribute.  This is necessary to support
156          * a fully recursive attribute model where an attribute may itself
157          * have an attribute.
158          *
159          * The basic layout looks like this.
160          *
161         *     --------------------------------
162          *     |                              |
163          *     |         xattr_hdr            |
164          *     |                              |
165          *     --------------------------------
166          *     --------------------------------
167          *     |                              |
168          *     |        xattr_buf             |
169          *     |                              |
170          *     --------------------------------
171          *     --------------------------------
172          *     |                              |
173          *     |      (optional link info)    |
174          *     |                              |
175          *     --------------------------------
176          *     --------------------------------
177          *     |                              |
178          *     |      attribute itself        |
179          *     |      stored as normal tar    |
180          *     |      or cpio data with       |
181          *     |      special mode or         |
182          *     |      typeflag                |
183          *     |                              |
184          *     --------------------------------
185          *
186          */
187         #define XATTR_ARCH_VERS "1.0"
188
189         /*
190          * extended attribute fixed header
191          *
192          * h_version            format version.
193          * h_size               size of header + variable sized data sections.
194          * h_component_len      Length of entire pathing section.
195          * h_link_component_len Length of link component section.  Again same
196          *                      definition as h_component_len.
197          */
198         struct xattr_hdr {
199                 char    h_version[7];
200                 char    h_size[10];
201                 char    h_component_len[10]; /* total length of path component */
202                 char    h_link_component_len[10];
203         };
204
205         /*
206          * The name is encoded like this:
207          * filepathNULattrpathNUL[attrpathNULL]...
208          */
209         struct xattr_buf {
210                 char    h_namesz[7];  /* length of h_names */
211                 char    h_typeflag;   /* actual typeflag of file being archived */
212                 char    h_names[1];   /* filepathNULattrpathNUL... */
213         };
214
215         /*
216          * Special values for tar archives
217          */
218
219         /*
220          * typeflag for tar archives.
221          */
222
223         /*
224          * Attribute hdr and attribute files have the following typeflag
225          */
226         #define _XATTR_HDRTYPE          'E'
227
228         /*
229          * For cpio archives the header and attribute have
230          * _XATTR_CPIO_MODE ORED into the mode field in both
231          * character and binary versions of the archive format
232          */
233         #define _XATTR_CPIO_MODE        0xB000
234
235
236
237
238
239SunOS 5.11                        22 Oct 2007                archives.h(3HEAD)
Impressum