blob: 43a5513535e39a282ee53f38207c3a1f9c5221c5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
#ifndef __LIB_USTAR_H
#define __LIB_USTAR_H
/* Support for the standard Posix "ustar" format. See the
documentation of the "pax" utility in [SUSv3] for the the
"ustar" format specification. */
#include <stdbool.h>
/* Type of a file entry in an archive.
The values here are the bytes that appear in the file format.
Only types of interest to Pintos are listed here. */
enum ustar_type
{
USTAR_REGULAR = '0', /* Ordinary file. */
USTAR_DIRECTORY = '5', /* Directory. */
USTAR_EOF = -1 /* End of archive (not an official value). */
};
/* Size of a ustar archive header, in bytes. */
#define USTAR_HEADER_SIZE 512
bool ustar_make_header (const char *file_name, enum ustar_type,
int size, char header[USTAR_HEADER_SIZE]);
const char *ustar_parse_header (const char header[USTAR_HEADER_SIZE],
const char **file_name,
enum ustar_type *, int *size);
#endif /* lib/ustar.h */
|