source: trunk/essentials/app-arch/cpio/src/cpiohdr.h

Last change on this file was 3332, checked in by bird, 18 years ago

cpio 2.7

File size: 2.8 KB
Line 
1/* Extended cpio header from POSIX.1.
2 Copyright (C) 1992, 2006 Free Software Foundation, Inc.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
7 any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public
15 License along with this program; if not, write to the Free
16 Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301 USA. */
18
19#ifndef _CPIOHDR_H
20
21#define _CPIOHDR_H 1
22
23#include <cpio.h>
24
25struct old_cpio_header
26{
27 unsigned short c_magic;
28 short c_dev;
29 unsigned short c_ino;
30 unsigned short c_mode;
31 unsigned short c_uid;
32 unsigned short c_gid;
33 unsigned short c_nlink;
34 short c_rdev;
35 unsigned short c_mtimes[2];
36 unsigned short c_namesize;
37 unsigned short c_filesizes[2];
38};
39
40struct old_ascii_header
41{
42 char c_magic[6];
43 char c_dev[6];
44 char c_ino[6];
45 char c_mode[6];
46 char c_uid[6];
47 char c_gid[6];
48 char c_nlink[6];
49 char c_rdev[6];
50 char c_mtime[11];
51 char c_namesize[6];
52 char c_filesize[11];
53};
54
55/* "New" portable format and CRC format:
56
57 Each file has a 110 byte header,
58 a variable length, NUL terminated filename,
59 and variable length file data.
60 A header for a filename "TRAILER!!!" indicates the end of the archive. */
61
62/* All the fields in the header are ISO 646 (approximately ASCII) strings
63 of hexadecimal numbers, left padded, not NUL terminated: */
64
65struct new_ascii_header
66{
67 char c_magic[6]; /* "070701" for "new" portable format
68 "070702" for CRC format */
69 char c_ino[8];
70 char c_mode[8];
71 char c_uid[8];
72 char c_gid[8];
73 char c_nlink[8];
74 char c_mtime[8];
75 char c_filesize[8]; /* must be 0 for FIFOs and directories */
76 char c_dev_maj[8];
77 char c_dev_min[8];
78 char c_rdev_maj[8]; /* only valid for chr and blk special files */
79 char c_rdev_min[8]; /* only valid for chr and blk special files */
80 char c_namesize[8]; /* count includes terminating NUL in pathname */
81 char c_chksum[8]; /* 0 for "new" portable format; for CRC format
82 the sum of all the bytes in the file */
83};
84
85struct cpio_file_stat /* Internal representation of a CPIO header */
86{
87 unsigned short c_magic;
88 ino_t c_ino;
89 mode_t c_mode;
90 uid_t c_uid;
91 gid_t c_gid;
92 size_t c_nlink;
93 time_t c_mtime;
94 off_t c_filesize;
95 long c_dev_maj;
96 long c_dev_min;
97 long c_rdev_maj;
98 long c_rdev_min;
99 size_t c_namesize;
100 unsigned long c_chksum;
101 char *c_name;
102 char *c_tar_linkname;
103};
104
105
106#endif /* cpiohdr.h */
Note: See TracBrowser for help on using the repository browser.