rpm
5.4.14
|
Handle ustar archives. More...
#include "system.h"
#include <rpmio.h>
#include <ugid.h>
#include <tar.h>
#include <iosm.h>
#include "debug.h"
Go to the source code of this file.
Macros | |
#define | _IOSM_INTERNAL |
#define | _IOSMRC(_rc) if ((_rc) <= 0) return ((_rc) ? (int) -rc : IOSMERR_HDR_TRAILER) |
Functions | |
static int | strntoul (const char *str, char **endptr, int base, size_t num) |
Convert string to unsigned integer (with buffer size check). More... | |
static ssize_t | tarRead (void *_iosm, void *buf, size_t count) |
static ssize_t | tarHeaderReadName (void *_iosm, size_t len, const char **fnp) |
Read long file/link name from tar archive. More... | |
int | tarHeaderRead (void *_iosm, struct stat *st) |
Read tar header from payload. More... | |
static ssize_t | tarWrite (void *_iosm, const void *buf, size_t count) |
static ssize_t | tarHeaderWriteName (void *_iosm, const char *path) |
Write long file/link name into tar archive. More... | |
static ssize_t | tarHeaderWriteBlock (void *_iosm, struct stat *st, tarHeader hdr) |
Write tar header block with checksum into tar archive. More... | |
int | tarHeaderWrite (void *_iosm, struct stat *st) |
Write tar header to payload. More... | |
int | tarTrailerWrite (void *_iosm) |
Write cpio trailer to payload. More... | |
Variables | |
int | _tar_debug = 0 |
static int | nochksum = 0 |
Handle ustar archives.
Definition in file tar.c.
#define _IOSMRC | ( | _rc | ) | if ((_rc) <= 0) return ((_rc) ? (int) -rc : IOSMERR_HDR_TRAILER) |
Definition at line 58 of file tar.c.
Referenced by tarHeaderRead(), tarHeaderWrite(), and tarTrailerWrite().
Convert string to unsigned integer (with buffer size check).
str | input string |
*endptr | 1st character not processed |
base | numerical conversion base |
num | max no. of bytes to read |
Definition at line 34 of file tar.c.
References alloca(), buf, NULL, ret, and strncpy().
Referenced by tarHeaderRead().
Read tar header from payload.
_iosm | file path and stat info |
st |
Definition at line 122 of file tar.c.
References _IOSMRC, _tar_debug, tarHeader_s::checksum, tarHeader_s::devMajor, tarHeader_s::devMinor, tarHeader_s::filesize, fprintf(), tarHeader_s::gid, i, if(), IOSMERR_BAD_HEADER, IOSMERR_BAD_MAGIC, IOSMERR_HDR_TRAILER, tarHeader_s::linkname, iosm_s::lpath, tarHeader_s::magic, major, Makedev, memset(), minor, tarHeader_s::mode, tarHeader_s::mtime, tarHeader_s::name, nb, nochksum, NULL, iosm_s::path, rc, sprintf(), strntoul(), t, TAR_BLOCK_SIZE, TAR_MAGIC, tarHeaderReadName(), tarRead(), tarHeader_s::typeflag, tarHeader_s::uid, iosm_s::wrbuf, and xmalloc.
Referenced by fsmSetup(), and iosmSetup().
|
static |
Read long file/link name from tar archive.
_iosm | file state machine |
len | no. bytes of name |
*fnp | long file/link name |
Definition at line 99 of file tar.c.
References _free(), _tar_debug, fprintf(), nb, NULL, rc, t, tarRead(), and xmalloc.
Referenced by tarHeaderRead().
Write tar header to payload.
_iosm | file path and stat info |
st |
Definition at line 387 of file tar.c.
References _iosmNext, _IOSMRC, _tar_debug, tarHeader_s::devMajor, tarHeader_s::devMinor, tarHeader_s::filesize, fprintf(), tarHeader_s::gid, gidToGname(), tarHeader_s::gname, IOSM_PAD, tarHeader_s::linkname, iosm_s::lpath, major, memset(), minor, tarHeader_s::mode, tarHeader_s::mtime, tarHeader_s::name, nb, NULL, iosm_s::path, path, rc, iosm_s::rdbuf, s, S_ISLNK, S_ISSOCK, sprintf(), strncpy(), tarHeaderWriteBlock(), tarHeaderWriteName(), tarHeader_s::typeflag, tarHeader_s::uid, uidToUname(), and tarHeader_s::uname.
Referenced by fsmSetup(), iosmSetup(), and writeLinkedFile().
Write tar header block with checksum into tar archive.
_iosm | file state machine |
st | file info |
hdr | tar header block |
Definition at line 350 of file tar.c.
References _tar_debug, tarHeader_s::checksum, fprintf(), i, tarHeader_s::magic, memset(), iosm_s::path, path, rc, sprintf(), stpcpy(), TAR_BLOCK_SIZE, TAR_MAGIC, TAR_VERSION, tarWrite(), tarHeader_s::typeflag, and void.
Referenced by tarHeaderWrite().
|
static |
Write long file/link name into tar archive.
_iosm | file state machine |
path | long file/link name |
Definition at line 323 of file tar.c.
References _iosmNext, _tar_debug, fprintf(), IOSM_PAD, rc, and tarWrite().
Referenced by tarHeaderWrite().
Definition at line 61 of file tar.c.
References _iosmNext, _tar_debug, count, fprintf(), IOSM_DREAD, IOSMERR_READ_FAILED, nb, rc, iosm_s::rdnb, t, iosm_s::wrbuf, and iosm_s::wrlen.
Referenced by tarHeaderRead(), and tarHeaderReadName().
Write cpio trailer to payload.
_fsm | file path and stat info |
Definition at line 499 of file tar.c.
References _iosmNext, _IOSMRC, _tar_debug, iosm_s::blksize, fprintf(), IOSM_PAD, NULL, rc, and tarWrite().
Referenced by fsmSetup(), and iosmSetup().
Definition at line 281 of file tar.c.
References _iosmNext, _tar_debug, count, fprintf(), IOSM_DWRITE, IOSM_PAD, IOSMERR_WRITE_FAILED, nb, rc, iosm_s::rdbuf, iosm_s::rdnb, s, and iosm_s::wrnb.
Referenced by tarHeaderWriteBlock(), tarHeaderWriteName(), and tarTrailerWrite().
int _tar_debug = 0 |
Definition at line 21 of file tar.c.
Referenced by tarHeaderRead(), tarHeaderReadName(), tarHeaderWrite(), tarHeaderWriteBlock(), tarHeaderWriteName(), tarRead(), tarTrailerWrite(), and tarWrite().
|
static |
Definition at line 24 of file tar.c.
Referenced by tarHeaderRead().