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 */
42 #define CMN_ASC 0x070701 /* Cpio Magic Number for ASCii header */
43 #define CMN_BIN 070707 /* Cpio Magic Number for Binary header */
44 #define CMN_BBS 0143561 /* Cpio Magic Number for Byte-Swap header */
45 #define CMN_CRC 0x070702 /* Cpio Magic Number for CRC header */
46 #define CMS_ASC "070701" /* Cpio Magic String for ASCii header */
47 #define CMS_CHR "070707" /* Cpio Magic String for CHR (-c) header */
48 #define CMS_CRC "070702" /* Cpio Magic String for CRC header */
49 #define CMS_LEN 6 /* Cpio Magic String LENgth */
51 /* Various header and field lengths */
53 #define CHRSZ 76 /* -c hdr size minus filename field */
54 #define ASCSZ 110 /* ASC and CRC hdr size minus filename field */
55 #define TARSZ 512 /* TAR hdr size */
57 #define HNAMLEN 256 /* maximum filename length for binary and -c headers */
58 #define EXPNLEN 1024 /* maximum filename length for ASC and CRC headers */
59 #define HTIMLEN 2 /* length of modification time field */
60 #define HSIZLEN 2 /* length of file size field */
62 /* cpio binary header definition */
65 short h_magic
, /* magic number field */
66 h_dev
; /* file system of file */
67 ushort_t h_ino
, /* inode of file */
68 h_mode
, /* modes of file */
69 h_uid
, /* uid of file */
70 h_gid
; /* gid of file */
71 short h_nlink
, /* number of links to file */
72 h_rdev
, /* maj/min numbers for special files */
73 h_mtime
[HTIMLEN
], /* modification time of file */
74 h_namesize
, /* length of filename */
75 h_filesize
[HSIZLEN
]; /* size of file */
76 char h_name
[HNAMLEN
]; /* filename */
79 /* cpio ODC header format */
82 char c_magic
[CMS_LEN
],
96 /* -c and CRC header format */
99 char E_magic
[CMS_LEN
],
116 /* Tar header structure and format */
118 #define TBLOCK 512 /* length of tar header and data blocks */
119 #define TNAMLEN 100 /* maximum length for tar file names */
120 #define TMODLEN 8 /* length of mode field */
121 #define TUIDLEN 8 /* length of uid field */
122 #define TGIDLEN 8 /* length of gid field */
123 #define TSIZLEN 12 /* length of size field */
124 #define TTIMLEN 12 /* length of modification time field */
125 #define TCRCLEN 8 /* length of header checksum field */
127 /* tar header definition */
132 char t_name
[TNAMLEN
], /* name of file */
133 t_mode
[TMODLEN
], /* mode of file */
134 t_uid
[TUIDLEN
], /* uid of file */
135 t_gid
[TGIDLEN
], /* gid of file */
136 t_size
[TSIZLEN
], /* size of file in bytes */
137 t_mtime
[TTIMLEN
], /* modification time of file */
138 t_cksum
[TCRCLEN
], /* checksum of header */
140 t_linkname
[TNAMLEN
], /* file this file linked with */
151 /* volcopy tape label format and structure */
157 struct volcopy_label
{
158 char v_magic
[VMAGLEN
],
165 v_reelblks
, /* u370 added field */
166 v_blksize
, /* u370 added field */
167 v_nblocks
; /* u370 added field */
168 char v_fill
[VFILLEN
];
169 int v_offset
; /* used with -e and -reel options */
170 int v_type
; /* does tape have nblocks field? */
174 * Define archive formats for extended attributes.
176 * Extended attributes are stored in two pieces.
177 * 1. An attribute header which has information about
178 * what file the attribute is for and what the attribute
180 * 2. The attribute record itself. Stored as a normal file type
182 * Both the header and attribute record have special modes/typeflags
183 * associated with them.
185 * The names of the header in the archive look like:
188 * The name of the attribute looks like:
191 * This is done so that an archiver that doesn't understand these formats
192 * can just dispose of the attribute records unless the user chooses to
193 * rename them via cpio -r or pax -i
195 * The format is composed of a fixed size header followed
196 * by a variable sized xattr_buf. If the attribute is a hard link
197 * to another attribute, then another xattr_buf section is included
200 * The xattr_buf is used to define the necessary "pathing" steps
201 * to get to the extended attribute. This is necessary to support
202 * a fully recursive attribute model where an attribute may itself
205 * The basic layout looks like this.
207 * --------------------------------
211 * --------------------------------
212 * --------------------------------
216 * --------------------------------
217 * --------------------------------
219 * | (optional link info) |
221 * --------------------------------
222 * --------------------------------
224 * | attribute itself |
225 * | stored as normal tar |
226 * | or cpio data with |
227 * | special mode or |
230 * --------------------------------
233 #define XATTR_ARCH_VERS "1.0"
236 * extended attribute fixed header
238 * h_version format version.
239 * h_size size of header + variable sized data sections.
240 * h_component_len Length of entire pathing section.
241 * h_link_component_len Length of link component section. Again same definition
242 * as h_component_len.
247 char h_component_len
[10]; /* total length of path component */
248 char h_link_component_len
[10];
252 * The name is encoded like this:
253 * filepathNULattrpathNUL[attrpathNULL]...
256 char h_namesz
[7]; /* length of h_names */
257 char h_typeflag
; /* actual typeflag of file being archived */
258 char h_names
[1]; /* filepathNULattrpathNUL... */
262 * Special values for tar archives
266 * typeflag for tar archives.
270 * Attribute hdr and attribute files have the following typeflag
272 #define _XATTR_HDRTYPE 'E'
275 * For cpio archives the header and attribute have
276 * _XATTR_CPIO_MODE ORED into the mode field in both
277 * character and binary versions of the archive format
279 #define _XATTR_CPIO_MODE 0xB000
285 #endif /* _ARCHIVES_H */