diff options
| author | manuel <manuel@mausz.at> | 2012-03-26 12:54:45 +0200 |
|---|---|---|
| committer | manuel <manuel@mausz.at> | 2012-03-26 12:54:45 +0200 |
| commit | b5f0874cd96ee2a62aabc645b9626c2749cb6a01 (patch) | |
| tree | 1262e4bbe0634de6650be130c36e0538240f4cbf /pintos-progos/lib/ustar.h | |
| download | progos-b5f0874cd96ee2a62aabc645b9626c2749cb6a01.tar.gz progos-b5f0874cd96ee2a62aabc645b9626c2749cb6a01.tar.bz2 progos-b5f0874cd96ee2a62aabc645b9626c2749cb6a01.zip | |
initial pintos checkin
Diffstat (limited to 'pintos-progos/lib/ustar.h')
| -rw-r--r-- | pintos-progos/lib/ustar.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/pintos-progos/lib/ustar.h b/pintos-progos/lib/ustar.h new file mode 100644 index 0000000..43a5513 --- /dev/null +++ b/pintos-progos/lib/ustar.h | |||
| @@ -0,0 +1,29 @@ | |||
| 1 | #ifndef __LIB_USTAR_H | ||
| 2 | #define __LIB_USTAR_H | ||
| 3 | |||
| 4 | /* Support for the standard Posix "ustar" format. See the | ||
| 5 | documentation of the "pax" utility in [SUSv3] for the the | ||
| 6 | "ustar" format specification. */ | ||
| 7 | |||
| 8 | #include <stdbool.h> | ||
| 9 | |||
| 10 | /* Type of a file entry in an archive. | ||
| 11 | The values here are the bytes that appear in the file format. | ||
| 12 | Only types of interest to Pintos are listed here. */ | ||
| 13 | enum ustar_type | ||
| 14 | { | ||
| 15 | USTAR_REGULAR = '0', /* Ordinary file. */ | ||
| 16 | USTAR_DIRECTORY = '5', /* Directory. */ | ||
| 17 | USTAR_EOF = -1 /* End of archive (not an official value). */ | ||
| 18 | }; | ||
| 19 | |||
| 20 | /* Size of a ustar archive header, in bytes. */ | ||
| 21 | #define USTAR_HEADER_SIZE 512 | ||
| 22 | |||
| 23 | bool ustar_make_header (const char *file_name, enum ustar_type, | ||
| 24 | int size, char header[USTAR_HEADER_SIZE]); | ||
| 25 | const char *ustar_parse_header (const char header[USTAR_HEADER_SIZE], | ||
| 26 | const char **file_name, | ||
| 27 | enum ustar_type *, int *size); | ||
| 28 | |||
| 29 | #endif /* lib/ustar.h */ | ||
