rpm
5.2.1
|
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().
|
static |
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().
Referenced by tarHeaderRead().
int tarHeaderRead | ( | void * | _iosm, |
struct stat * | st | ||
) |
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, tarHeader_s::gid, tarHeader_s::linkname, tarHeader_s::magic, major, Makedev, minor, tarHeader_s::mode, tarHeader_s::mtime, tarHeader_s::name, nochksum, strntoul(), TAR_BLOCK_SIZE, TAR_MAGIC, tarHeaderReadName(), tarRead(), tarHeader_s::typeflag, tarHeader_s::uid, 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, tarRead(), and xmalloc().
Referenced by tarHeaderRead().
int tarHeaderWrite | ( | void * | _iosm, |
struct stat * | st | ||
) |
Write tar header to payload.
_iosm | file path and stat info |
st |
Definition at line 385 of file tar.c.
References _iosmNext, _IOSMRC, _tar_debug, tarHeader_s::devMajor, tarHeader_s::devMinor, tarHeader_s::filesize, tarHeader_s::gid, gidToGname(), tarHeader_s::gname, IOSM_PAD, tarHeader_s::linkname, major, minor, tarHeader_s::mode, tarHeader_s::mtime, tarHeader_s::name, S_ISLNK, S_ISSOCK, tarHeaderWriteBlock(), tarHeaderWriteName(), tarHeader_s::typeflag, tarHeader_s::uid, uidToUname(), and tarHeader_s::uname.
Referenced by fsmSetup(), iosmSetup(), and writeLinkedFile().
|
static |
Write tar header block with checksum into tar archive.
_iosm | file state machine |
st | file info |
hdr | tar header block |
Definition at line 349 of file tar.c.
References _tar_debug, tarHeader_s::checksum, tarHeader_s::magic, stpcpy(), TAR_BLOCK_SIZE, TAR_MAGIC, TAR_VERSION, tarWrite(), and tarHeader_s::typeflag.
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, IOSM_PAD, and tarWrite().
Referenced by tarHeaderWrite().
|
static |
Definition at line 61 of file tar.c.
References _iosmNext, _tar_debug, and IOSM_DREAD.
Referenced by tarHeaderRead(), and tarHeaderReadName().
int tarTrailerWrite | ( | void * | _iosm | ) |
Write cpio trailer to payload.
_fsm | file path and stat info |
Definition at line 495 of file tar.c.
References _iosmNext, _IOSMRC, _tar_debug, IOSM_PAD, and tarWrite().
Referenced by fsmSetup(), and iosmSetup().
|
static |
Definition at line 281 of file tar.c.
References _iosmNext, _tar_debug, IOSM_DWRITE, and IOSM_PAD.
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().