4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright (c) 1988,1997-1998,2001 by Sun Microsystems, Inc.
24 * All rights reserved.
27 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
28 /* All Rights Reserved */
34 #pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.7 */
44 #define CMN_ASC 0x070701 /* Cpio Magic Number for ASCii header */
45 #define CMN_BIN 070707 /* Cpio Magic Number for Binary header */
46 #define CMN_BBS 0143561 /* Cpio Magic Number for Byte-Swap header */
47 #define CMN_CRC 0x070702 /* Cpio Magic Number for CRC header */
48 #define CMS_ASC "070701" /* Cpio Magic String for ASCii header */
49 #define CMS_CHR "070707" /* Cpio Magic String for CHR (-c) header */
50 #define CMS_CRC "070702" /* Cpio Magic String for CRC header */
51 #define CMS_LEN 6 /* Cpio Magic String LENgth */
53 /* Various header and field lengths */
55 #define CHRSZ 76 /* -c hdr size minus filename field */
56 #define ASCSZ 110 /* ASC and CRC hdr size minus filename field */
57 #define TARSZ 512 /* TAR hdr size */
59 #define HNAMLEN 256 /* maximum filename length for binary and -c headers */
60 #define EXPNLEN 1024 /* maximum filename length for ASC and CRC headers */
61 #define HTIMLEN 2 /* length of modification time field */
62 #define HSIZLEN 2 /* length of file size field */
64 /* cpio binary header definition */
67 short h_magic
, /* magic number field */
68 h_dev
; /* file system of file */
69 ushort_t h_ino
, /* inode of file */
70 h_mode
, /* modes of file */
71 h_uid
, /* uid of file */
72 h_gid
; /* gid of file */
73 short h_nlink
, /* number of links to file */
74 h_rdev
, /* maj/min numbers for special files */
75 h_mtime
[HTIMLEN
], /* modification time of file */
76 h_namesize
, /* length of filename */
77 h_filesize
[HSIZLEN
]; /* size of file */
78 char h_name
[HNAMLEN
]; /* filename */
81 /* cpio ODC header format */
84 char c_magic
[CMS_LEN
],
98 /* -c and CRC header format */
100 struct Exp_cpio_hdr
{
101 char E_magic
[CMS_LEN
],
118 /* Tar header structure and format */
120 #define TBLOCK 512 /* length of tar header and data blocks */
121 #define TNAMLEN 100 /* maximum length for tar file names */
122 #define TMODLEN 8 /* length of mode field */
123 #define TUIDLEN 8 /* length of uid field */
124 #define TGIDLEN 8 /* length of gid field */
125 #define TSIZLEN 12 /* length of size field */
126 #define TTIMLEN 12 /* length of modification time field */
127 #define TCRCLEN 8 /* length of header checksum field */
129 /* tar header definition */
134 char t_name
[TNAMLEN
], /* name of file */
135 t_mode
[TMODLEN
], /* mode of file */
136 t_uid
[TUIDLEN
], /* uid of file */
137 t_gid
[TGIDLEN
], /* gid of file */
138 t_size
[TSIZLEN
], /* size of file in bytes */
139 t_mtime
[TTIMLEN
], /* modification time of file */
140 t_cksum
[TCRCLEN
], /* checksum of header */
142 t_linkname
[TNAMLEN
], /* file this file linked with */
153 /* volcopy tape label format and structure */
159 struct volcopy_label
{
160 char v_magic
[VMAGLEN
],
167 v_reelblks
, /* u370 added field */
168 v_blksize
, /* u370 added field */
169 v_nblocks
; /* u370 added field */
170 char v_fill
[VFILLEN
];
171 int v_offset
; /* used with -e and -reel options */
172 int v_type
; /* does tape have nblocks field? */
176 * Define archive formats for extended attributes.
178 * Extended attributes are stored in two pieces.
179 * 1. An attribute header which has information about
180 * what file the attribute is for and what the attribute
182 * 2. The attribute record itself. Stored as a normal file type
184 * Both the header and attribute record have special modes/typeflags
185 * associated with them.
187 * The names of the header in the archive look like:
190 * The name of the attribute looks like:
193 * This is done so that an archiver that doesn't understand these formats
194 * can just dispose of the attribute records unless the user chooses to
195 * rename them via cpio -r or pax -i
197 * The format is composed of a fixed size header followed
198 * by a variable sized xattr_buf. If the attribute is a hard link
199 * to another attribute, then another xattr_buf section is included
202 * The xattr_buf is used to define the necessary "pathing" steps
203 * to get to the extended attribute. This is necessary to support
204 * a fully recursive attribute model where an attribute may itself
207 * The basic layout looks like this.
209 * --------------------------------
213 * --------------------------------
214 * --------------------------------
218 * --------------------------------
219 * --------------------------------
221 * | (optional link info) |
223 * --------------------------------
224 * --------------------------------
226 * | attribute itself |
227 * | stored as normal tar |
228 * | or cpio data with |
229 * | special mode or |
232 * --------------------------------
235 #define XATTR_ARCH_VERS "1.0"
238 * extended attribute fixed header
240 * h_version format version.
241 * h_size size of header + variable sized data sections.
242 * h_component_len Length of entire pathing section.
243 * h_link_component_len Length of link component section. Again same definition
244 * as h_component_len.
249 char h_component_len
[10]; /* total length of path component */
250 char h_link_component_len
[10];
254 * The name is encoded like this:
255 * filepathNULattrpathNUL[attrpathNULL]...
258 char h_namesz
[7]; /* length of h_names */
259 char h_typeflag
; /* actual typeflag of file being archived */
260 char h_names
[1]; /* filepathNULattrpathNUL... */
264 * Special values for tar archives
268 * typeflag for tar archives.
272 * Attribute hdr and attribute files have the following typeflag
274 #define _XATTR_HDRTYPE 'E'
277 * For cpio archives the header and attribute have
278 * _XATTR_CPIO_MODE ORED into the mode field in both
279 * character and binary versions of the archive format
281 #define _XATTR_CPIO_MODE 0xB000
287 #endif /* _ARCHIVES_H */