1 /* Extended cpio format from POSIX.1.
2    This file is part of the GNU C Library.
3    Copyright (C) 1992-2021 Free Software Foundation, Inc.
4    NOTE: The canonical source of this file is maintained with the GNU cpio.
5 
6    The GNU C Library is free software; you can redistribute it and/or
7    modify it under the terms of the GNU Lesser General Public
8    License as published by the Free Software Foundation; either
9    version 2.1 of the License, or (at your option) any later version.
10 
11    The GNU C Library is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14    Lesser General Public License for more details.
15 
16    You should have received a copy of the GNU Lesser General Public
17    License along with the GNU C Library; if not, see
18    <https://www.gnu.org/licenses/>.  */
19 
20 #ifndef _CPIO_H
21 #define _CPIO_H 1
22 
23 /* A cpio archive consists of a sequence of files.
24    Each file has a 76 byte header,
25    a variable length, NUL terminated filename,
26    and variable length file data.
27    A header for a filename "TRAILER!!!" indicates the end of the archive.  */
28 
29 /* All the fields in the header are ISO 646 (approximately ASCII) strings
30    of octal numbers, left padded, not NUL terminated.
31 
32    Field Name	Length in Bytes	Notes
33    c_magic	6		must be "070707"
34    c_dev	6
35    c_ino	6
36    c_mode	6		see below for value
37    c_uid	6
38    c_gid	6
39    c_nlink	6
40    c_rdev	6		only valid for chr and blk special files
41    c_mtime	11
42    c_namesize	6		count includes terminating NUL in pathname
43    c_filesize	11		must be 0 for FIFOs and directories  */
44 
45 /* Value for the field `c_magic'.  */
46 #define MAGIC	"070707"
47 
48 /* Values for c_mode, OR'd together: */
49 
50 #define C_IRUSR		000400
51 #define C_IWUSR		000200
52 #define C_IXUSR		000100
53 #define C_IRGRP		000040
54 #define C_IWGRP		000020
55 #define C_IXGRP		000010
56 #define C_IROTH		000004
57 #define C_IWOTH		000002
58 #define C_IXOTH		000001
59 
60 #define C_ISUID		004000
61 #define C_ISGID		002000
62 #define C_ISVTX		001000
63 
64 #define C_ISBLK		060000
65 #define C_ISCHR		020000
66 #define C_ISDIR		040000
67 #define C_ISFIFO	010000
68 #define C_ISSOCK	0140000
69 #define C_ISLNK		0120000
70 #define C_ISCTG		0110000
71 #define C_ISREG		0100000
72 
73 #endif /* cpio.h */
74