CS318 - Pintos
Pintos source browser for JHU CS318 course
src
lib
ustar.h
Go to the documentation of this file.
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 */
ustar_header::size
char size[12]
File size in bytes as octal string.
Definition:
ustar.c:16
USTAR_REGULAR
Ordinary file.
Definition:
ustar.h:15
USTAR_DIRECTORY
Directory.
Definition:
ustar.h:16
ustar_make_header
bool ustar_make_header(const char *file_name, enum ustar_type, int size, char header[USTAR_HEADER_SIZE])
Composes HEADER as a USTAR_HEADER_SIZE (512)-byte archive header in ustar format for a SIZE-byte file...
Definition:
ustar.c:83
stdbool.h
ustar_type
ustar_type
Support for the standard Posix "ustar" format.
Definition:
ustar.h:13
ustar_parse_header
const char * ustar_parse_header(const char header[USTAR_HEADER_SIZE], const char **file_name, enum ustar_type *, int *size)
lib/ustar.h
Definition:
ustar.c:182
USTAR_HEADER_SIZE
#define USTAR_HEADER_SIZE
Size of a ustar archive header, in bytes.
Definition:
ustar.h:21
file_name
static const char file_name[]
tests/filesys/base/syn-read.h
Definition:
syn-read.h:5
USTAR_EOF
End of archive (not an official value).
Definition:
ustar.h:17
Generated on Thu Aug 22 2019 10:19:15 for CS318 - Pintos by
1.8.16