00001 #ifndef __LIB_USTAR_H 00002 //107240412289 00003 #define __LIB_USTAR_H 00004 00005 /* Support for the standard Posix "ustar" format. See the 00006 documentation of the "pax" utility in [SUSv3] for the the 00007 "ustar" format specification. */ 00008 00009 #include <stdbool.h> 00010 00011 /* Type of a file entry in an archive. 00012 The values here are the bytes that appear in the file format. 00013 Only types of interest to Pintos are listed here. */ 00014 enum ustar_type 00015 { 00016 USTAR_REGULAR = '0', /* Ordinary file. */ 00017 USTAR_DIRECTORY = '5', /* Directory. */ 00018 USTAR_EOF = -1 /* End of archive (not an official value). */ 00019 }; 00020 00021 /* Size of a ustar archive header, in bytes. */ 00022 #define USTAR_HEADER_SIZE 512 00023 00024 bool ustar_make_header (const char *file_name, enum ustar_type, 00025 int size, char header[USTAR_HEADER_SIZE]); 00026 const char *ustar_parse_header (const char header[USTAR_HEADER_SIZE], 00027 const char **file_name, 00028 enum ustar_type *, int *size); 00029 00030 #endif /* lib/ustar.h */