blob: fae32752adbd2dd04e8e05981ff120f09f2e7cfc [file] [log] [blame]
yuezonghe824eb0c2024-06-27 02:32:26 -07001/* Extended cpio format from POSIX.1.
2 This file is part of the GNU C Library.
3 Copyright (C) 1992, 1998 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, write to the Free
18 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19 02111-1307 USA. */
20
21#ifndef _CPIO_H
22#define _CPIO_H 1
23
24/* A cpio archive consists of a sequence of files.
25 Each file has a 76 byte header,
26 a variable length, NUL terminated filename,
27 and variable length file data.
28 A header for a filename "TRAILER!!!" indicates the end of the archive. */
29
30/* All the fields in the header are ISO 646 (approximately ASCII) strings
31 of octal numbers, left padded, not NUL terminated.
32
33 Field Name Length in Bytes Notes
34 c_magic 6 must be "070707"
35 c_dev 6
36 c_ino 6
37 c_mode 6 see below for value
38 c_uid 6
39 c_gid 6
40 c_nlink 6
41 c_rdev 6 only valid for chr and blk special files
42 c_mtime 11
43 c_namesize 6 count includes terminating NUL in pathname
44 c_filesize 11 must be 0 for FIFOs and directories */
45
46/* Value for the field `c_magic'. */
47#define MAGIC "070707"
48
49/* Values for c_mode, OR'd together: */
50
51#define C_IRUSR 000400
52#define C_IWUSR 000200
53#define C_IXUSR 000100
54#define C_IRGRP 000040
55#define C_IWGRP 000020
56#define C_IXGRP 000010
57#define C_IROTH 000004
58#define C_IWOTH 000002
59#define C_IXOTH 000001
60
61#define C_ISUID 004000
62#define C_ISGID 002000
63#define C_ISVTX 001000
64
65#define C_ISBLK 060000
66#define C_ISCHR 020000
67#define C_ISDIR 040000
68#define C_ISFIFO 010000
69#define C_ISSOCK 0140000
70#define C_ISLNK 0120000
71#define C_ISCTG 0110000
72#define C_ISREG 0100000
73
74#endif /* cpio.h */