PostgreSQL Source Code
git master
pgtar.h
Go to the documentation of this file.
1
/*-------------------------------------------------------------------------
2
*
3
* pgtar.h
4
* Functions for manipulating tarfile datastructures (src/port/tar.c)
5
*
6
*
7
* Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group
8
* Portions Copyright (c) 1994, Regents of the University of California
9
*
10
* src/include/pgtar.h
11
*
12
*-------------------------------------------------------------------------
13
*/
14
#ifndef PG_TAR_H
15
#define PG_TAR_H
16
17
#define TAR_BLOCK_SIZE 512
18
19
enum
tarError
20
{
21
TAR_OK
= 0,
22
TAR_NAME_TOO_LONG
,
23
TAR_SYMLINK_TOO_LONG
24
};
25
26
extern
enum
tarError
tarCreateHeader
(
char
*h,
const
char
*
filename
,
27
const
char
*linktarget,
pgoff_t
size,
28
mode_t
mode
,
uid_t
uid,
gid_t
gid,
29
time_t mtime);
30
extern
uint64
read_tar_number
(
const
char
*s,
int
len
);
31
extern
void
print_tar_number
(
char
*s,
int
len
, uint64
val
);
32
extern
int
tarChecksum
(
char
*header);
33
34
/*
35
* Compute the number of padding bytes required for an entry in a tar
36
* archive. We must pad out to a multiple of TAR_BLOCK_SIZE. Since that's
37
* a power of 2, we can use TYPEALIGN().
38
*/
39
static
inline
size_t
40
tarPaddingBytesRequired
(
size_t
len
)
41
{
42
return
TYPEALIGN
(
TAR_BLOCK_SIZE
,
len
) -
len
;
43
}
44
45
#endif
TYPEALIGN
#define TYPEALIGN(ALIGNVAL, LEN)
Definition:
c.h:788
val
long val
Definition:
informix.c:664
mode
static PgChecksumMode mode
Definition:
pg_checksums.c:65
len
const void size_t len
Definition:
pg_crc32c_sse42.c:24
filename
static char * filename
Definition:
pg_dumpall.c:119
read_tar_number
uint64 read_tar_number(const char *s, int len)
Definition:
tar.c:58
tarPaddingBytesRequired
static size_t tarPaddingBytesRequired(size_t len)
Definition:
pgtar.h:40
tarChecksum
int tarChecksum(char *header)
Definition:
tar.c:90
tarCreateHeader
enum tarError tarCreateHeader(char *h, const char *filename, const char *linktarget, pgoff_t size, mode_t mode, uid_t uid, gid_t gid, time_t mtime)
Definition:
tar.c:114
tarError
tarError
Definition:
pgtar.h:20
TAR_SYMLINK_TOO_LONG
@ TAR_SYMLINK_TOO_LONG
Definition:
pgtar.h:23
TAR_OK
@ TAR_OK
Definition:
pgtar.h:21
TAR_NAME_TOO_LONG
@ TAR_NAME_TOO_LONG
Definition:
pgtar.h:22
TAR_BLOCK_SIZE
#define TAR_BLOCK_SIZE
Definition:
pgtar.h:17
print_tar_number
void print_tar_number(char *s, int len, uint64 val)
Definition:
tar.c:22
gid_t
int gid_t
Definition:
win32_port.h:253
pgoff_t
#define pgoff_t
Definition:
win32_port.h:215
uid_t
int uid_t
Definition:
win32_port.h:252
src
include
pgtar.h
Generated on Sat Jun 3 2023 00:13:24 for PostgreSQL Source Code by
1.9.1