rpm  5.4.15
Data Structures | Macros | Typedefs | Functions | Variables
iosm.c File Reference

File state machine to handle a payload from a package. More...

#include "system.h"
#include <rpmio_internal.h>
#include <rpmcb.h>
#include <ugid.h>
#include <rpmsq.h>
#include <rpmsw.h>
#include <rpmsx.h>
#include "../rpmdb/rpmtag.h"
#include <iosm.h>
#include "cpio.h"
#include "tar.h"
#include "ar.h"
#include "../lib/rpmfi.h"
#include "debug.h"
Include dependency graph for iosm.c:

Go to the source code of this file.

Data Structures

struct  dnli_s
 Directory name iterator. More...
 

Macros

#define _IOSM_INTERNAL
 
#define iosmUNSAFE   iosmStage
 
#define _RPMFI_INTERNAL
 
#define _RPMFI_NOMETHODS
 
#define alloca_strdup(_s)   strcpy((char *)alloca(strlen(_s)+1), (_s))
 
#define _IOSM_DEBUG   0
 
#define SUFFIX_RPMORIG   ".rpmorig"
 
#define SUFFIX_RPMSAVE   ".rpmsave"
 
#define SUFFIX_RPMNEW   ".rpmnew"
 
#define IS_DEV_LOG(_x)
 
#define _fafilter(_a)
 
#define IOSM_SKIPPING(_a)   ((_a) == FA_SKIP || (_a) == FA_SKIPNSTATE || (_a) == FA_SKIPNETSHARED || (_a) == FA_SKIPCOLOR)
 

Typedefs

typedef struct rpmts_s * rpmts
 
typedef struct rpmte_s * rpmte
 
typedef iosmMapFlags cpioMapFlags
 
typedef struct rpmds_s * rpmds
 
typedef struct rpmRelocation_srpmRelocation
 
typedef struct rpmdb_s * rpmdb
 
typedef struct rpmmi_srpmmi
 
typedef struct rpmPRCO_s * rpmPRCO
 
typedef struct Spec_sSpec
 
typedef struct dnli_sDNLI_t
 Directory name iterator. More...
 

Functions

void * iosmGetFi (const IOSM_t iosm)
 Retrieve transaction element file info from I/O state machine iterator. More...
 
static const char * iosmFsPath (const IOSM_t iosm, const struct stat *st, const char *subdir, const char *suffix)
 Build path to file from file info, ornamented with subdir and suffix. More...
 
static void * mapFreeIterator (void *_iter)
 Destroy file info iterator. More...
 
static void * mapInitIterator (rpmfi fi, int reverse)
 Create file info iterator. More...
 
static int mapNextIterator (void *_iter)
 Return next index into file info. More...
 
static int iosmStrCmp (const void *a, const void *b)
 
static int mapFind (IOSMI_t iter, const char *iosmPath)
 Locate archive path in file info. More...
 
static void * dnlFreeIterator (const void *_dnli)
 Destroy directory name iterator. More...
 
static int dnlCount (const DNLI_t dnli)
 
static int dnlIndex (const DNLI_t dnli)
 
static void * dnlInitIterator (const IOSM_t iosm, int reverse)
 Create directory name iterator. More...
 
static const char * dnlNextIterator (DNLI_t dnli)
 Return next directory name (from file info). More...
 
int iosmNext (IOSM_t iosm, iosmFileStage nstage)
 File state machine driver. More...
 
static int saveHardLink (IOSM_t iosm)
 Save hard link in chain. More...
 
static void * freeHardLink (struct hardLink_s *li)
 Destroy set of hard links. More...
 
IOSM_t newIOSM (void)
 Create I/O state machine instance. More...
 
IOSM_t freeIOSM (IOSM_t iosm)
 Destroy I/O state machine instance. More...
 
static int arSetup (IOSM_t iosm, rpmfi fi)
 
int iosmSetup (IOSM_t iosm, iosmFileStage goal, const char *afmt, const void *_ts, const void *_fi, FD_t cfd, unsigned int *archiveSize, const char **failedFile)
 Load external data into I/O state machine. More...
 
int iosmTeardown (IOSM_t iosm)
 Clean I/O state machine. More...
 
static int iosmMapFContext (IOSM_t iosm)
 
int iosmMapPath (IOSM_t iosm)
 Map next file path and action. More...
 
int iosmMapAttrs (IOSM_t iosm)
 Map file stat(2) info. More...
 
static int extractRegular (IOSM_t iosm)
 Create file from payload stream. More...
 
static int writeFile (IOSM_t iosm, int writeData)
 Write next item to payload stream. More...
 
static int writeLinkedFile (IOSM_t iosm)
 Write set of linked files to payload stream. More...
 
static int iosmMakeLinks (IOSM_t iosm)
 Create pending hard links to existing file. More...
 
static int iosmCommitLinks (IOSM_t iosm)
 Commit hard linked file set atomically. More...
 
static int iosmRmdirs (IOSM_t iosm)
 Remove (if created) directories not explicitly included in package. More...
 
static int iosmMkdirs (IOSM_t iosm)
 Create (if necessary) directories not explicitly included in package. More...
 
int iosmStage (IOSM_t iosm, iosmFileStage stage)
 File state machine driver. More...
 
int iosmFileActionSkipped (iosmFileAction action)
 Is the file going to be skipped? More...
 
const char * iosmFileActionString (iosmFileAction a)
 Return formatted string representation of file disposition. More...
 
const char * iosmFileStageString (iosmFileStage a)
 Return formatted string representation of file stages. More...
 
char * iosmStrerror (int rc)
 Return formatted error message on payload handling failure. More...
 

Variables

int _iosm_debug = 0
 
int _iosm_threads = 0
 
int(* _iosmNext )(IOSM_t iosm, iosmFileStage nstage) = &iosmNext
 Vector to iosmNext. More...
 

Detailed Description

File state machine to handle a payload from a package.

Definition in file iosm.c.

Macro Definition Documentation

#define _fafilter (   _a)
Value:
(!((_a) == FA_CREATE || (_a) == FA_ERASE || (_a) == FA_COPYIN || (_a) == FA_COPYOUT) \
Definition: iosm.h:30
Definition: iosm.h:29
Definition: iosm.h:36
const char * iosmFileActionString(iosmFileAction a)
Return formatted string representation of file disposition.
Definition: iosm.c:2683

Referenced by iosmStage().

#define _IOSM_DEBUG   0

Definition at line 73 of file iosm.c.

#define _IOSM_INTERNAL

Definition at line 21 of file iosm.c.

#define _RPMFI_INTERNAL

Definition at line 30 of file iosm.c.

#define _RPMFI_NOMETHODS

Definition at line 31 of file iosm.c.

Referenced by mapFind().

#define alloca_strdup (   _s)    strcpy((char *)alloca(strlen(_s)+1), (_s))

Definition at line 71 of file iosm.c.

#define IOSM_SKIPPING (   _a)    ((_a) == FA_SKIP || (_a) == FA_SKIPNSTATE || (_a) == FA_SKIPNETSHARED || (_a) == FA_SKIPCOLOR)

Definition at line 2675 of file iosm.c.

Referenced by iosmFileActionSkipped().

#define iosmUNSAFE   iosmStage

Definition at line 23 of file iosm.c.

Referenced by iosmMakeLinks(), iosmMkdirs(), iosmSetup(), iosmStage(), iosmTeardown(), and writeFile().

#define IS_DEV_LOG (   _x)
Value:
((_x) != NULL && strlen(_x) >= (sizeof("/dev/log")-1) && \
!strncmp((_x), "/dev/log", sizeof("/dev/log")-1) && \
((_x)[sizeof("/dev/log")-1] == '\0' || \
(_x)[sizeof("/dev/log")-1] == ';'))

Definition at line 1631 of file iosm.c.

Referenced by iosmStage().

#define SUFFIX_RPMNEW   ".rpmnew"

Definition at line 107 of file iosm.c.

Referenced by iosmMapPath().

#define SUFFIX_RPMORIG   ".rpmorig"

Definition at line 105 of file iosm.c.

Referenced by iosmMapPath().

#define SUFFIX_RPMSAVE   ".rpmsave"

Definition at line 106 of file iosm.c.

Referenced by iosmMapPath().

Typedef Documentation

Definition at line 29 of file iosm.c.

typedef struct dnli_s * DNLI_t

Directory name iterator.

typedef struct rpmdb_s* rpmdb

Definition at line 47 of file iosm.c.

typedef struct rpmds_s* rpmds

Definition at line 34 of file iosm.c.

typedef struct rpmmi_s* rpmmi

Definition at line 48 of file iosm.c.

typedef struct rpmPRCO_s* rpmPRCO

Definition at line 49 of file iosm.c.

typedef struct rpmRelocation_s* rpmRelocation

Definition at line 35 of file iosm.c.

typedef struct rpmte_s* rpmte

Definition at line 19 of file iosm.c.

typedef struct rpmts_s* rpmts

Definition at line 18 of file iosm.c.

typedef struct Spec_s* Spec

Definition at line 50 of file iosm.c.

Function Documentation

static int arSetup ( IOSM_t  iosm,
rpmfi  fi 
)
static

Definition at line 596 of file iosm.c.

References i, iosm_s::lmtab, iosm_s::lmtablen, iosm_s::lmtaboff, rpmfiBN(), rpmfiInit(), rpmfiNext(), stpcpy(), urlPath(), and xmalloc.

Referenced by fsmSetup(), and iosmSetup().

static int dnlCount ( const DNLI_t  dnli)
inlinestatic

Definition at line 306 of file iosm.c.

References dnli_s::fi.

Referenced by iosmMkdirs(), and iosmRmdirs().

static void* dnlFreeIterator ( const void *  _dnli)
static

Destroy directory name iterator.

Parameters
_dnlidirectory name iterator
Return values
NULLalways

Definition at line 294 of file iosm.c.

References _free(), and dnli_s::active.

Referenced by iosmMkdirs(), and iosmRmdirs().

static int dnlIndex ( const DNLI_t  dnli)
inlinestatic

Definition at line 314 of file iosm.c.

References dnli_s::isave.

Referenced by iosmMkdirs(), and iosmRmdirs().

static void* dnlInitIterator ( const IOSM_t  iosm,
int  reverse 
)
static

Create directory name iterator.

Parameters
iosmfile state machine data
reversetraverse directory names in reverse order?
Returns
directory name iterator

Definition at line 328 of file iosm.c.

References dnli_s::active, D_, fi, dnli_s::fi, dnli_s::i, i, iosmFileActionSkipped(), iosmGetFi(), j, reverse, dnli_s::reverse, rpmfiInit(), rpmfiNext(), rpmlog(), RPMLOG_DEBUG, urlPath(), and xcalloc().

Referenced by iosmMkdirs(), and iosmRmdirs().

static const char* dnlNextIterator ( DNLI_t  dnli)
static

Return next directory name (from file info).

Parameters
dnlidirectory name iterator
Returns
next directory name

Definition at line 426 of file iosm.c.

References dnli_s::active, fi, dnli_s::fi, dnli_s::i, i, dnli_s::isave, and dnli_s::reverse.

Referenced by iosmMkdirs(), and iosmRmdirs().

static int extractRegular ( IOSM_t  iosm)
static

Create file from payload stream.

Parameters
iosmfile state machine data
Returns
0 on success

Definition at line 1030 of file iosm.c.

References _free(), iosm_s::digest, iosm_s::digestlen, fdFiniDigest(), iosm_s::fdigest, iosm_s::fdigestalgo, fdInitDigest(), Fflush(), Fileno(), fsync, IOSM_DREAD, IOSM_NOTIFY, IOSM_WCLOSE, IOSM_WOPEN, IOSM_WRITE, IOSMERR_DIGEST_MISMATCH, iosmNext(), iosm_s::sb, iosm_s::wfd, iosm_s::wrlen, iosm_s::wrnb, and iosm_s::wrsize.

Referenced by iosmStage().

static void* freeHardLink ( struct hardLink_s li)
static

Destroy set of hard links.

Parameters
liset of hard links
Returns
NULL always

Definition at line 564 of file iosm.c.

References _free(), hardLink_s::filex, and hardLink_s::nsuffix.

Referenced by freeIOSM(), and iosmStage().

IOSM_t freeIOSM ( IOSM_t  iosm)

Destroy I/O state machine instance.

Parameters
iosmI/O state machine
Returns
always NULL

Definition at line 580 of file iosm.c.

References _free(), iosm_s::dnlx, freeHardLink(), iosm_s::iter, iosm_s::ldn, iosm_s::li, iosm_s::links, mapFreeIterator(), hardLink_s::next, and iosm_s::path.

static int iosmCommitLinks ( IOSM_t  iosm)
static

Commit hard linked file set atomically.

Parameters
iosmfile state machine data
Returns
0 on success

Definition at line 1375 of file iosm.c.

References _free(), iosm_s::action, hardLink_s::filex, i, IOSM_COMMIT, IOSM_MAP, iosmFileActionSkipped(), iosmNext(), iosm_s::ix, iosm_s::li, iosm_s::links, hardLink_s::next, hardLink_s::nlink, iosm_s::nsuffix, iosm_s::path, hardLink_s::sb, and iosm_s::sb.

Referenced by iosmStage().

int iosmFileActionSkipped ( iosmFileAction  action)

Is the file going to be skipped?

Parameters
actionfile action
Returns
Is file to be skipped?

Definition at line 2678 of file iosm.c.

References IOSM_SKIPPING.

Referenced by dnlInitIterator(), fsmCommitLinks(), fsmMakeLinks(), fsmStage(), handleInstInstalledFile(), handleOverlappedFiles(), iosmCommitLinks(), iosmMakeLinks(), iosmStage(), rpmtsAddFingerprints(), rpmtsSkipFiles(), and saveHardLink().

const char* iosmFileActionString ( iosmFileAction  a)

Return formatted string representation of file disposition.

Parameters
afile disposition
Returns
formatted string

Definition at line 2683 of file iosm.c.

References FA_ALTNAME, FA_BACKUP, FA_COPYIN, FA_COPYOUT, FA_CREATE, FA_ERASE, FA_SAVE, FA_SKIP, FA_SKIPCOLOR, FA_SKIPNETSHARED, FA_SKIPNSTATE, and FA_UNKNOWN.

const char* iosmFileStageString ( iosmFileStage  a)
static const char* iosmFsPath ( const IOSM_t  iosm,
const struct stat *  st,
const char *  subdir,
const char *  suffix 
)
static

Build path to file from file info, ornamented with subdir and suffix.

Parameters
iosmfile state machine data
stfile stat info
subdirsubdir to use (NULL disables)
suffixsuffix to use (NULL disables)
Return values
pathto file

Definition at line 118 of file iosm.c.

References iosm_s::baseName, iosm_s::dirName, stpcpy(), and xmalloc.

Referenced by iosmMapPath(), and iosmStage().

void* iosmGetFi ( const IOSM_t  iosm)

Retrieve transaction element file info from I/O state machine iterator.

Parameters
iosmI/O state machine
Returns
transaction element file info

Definition at line 97 of file iosm.c.

References iosmIterator_s::fi, and iosm_s::iter.

Referenced by dnlInitIterator(), iosmMapAttrs(), iosmMapFContext(), iosmMapPath(), iosmMkdirs(), iosmStage(), saveHardLink(), and writeFile().

static int iosmMakeLinks ( IOSM_t  iosm)
static

Create pending hard links to existing file.

Parameters
iosmfile state machine data
Returns
0 on success

Definition at line 1314 of file iosm.c.

References _free(), iosm_s::action, hardLink_s::createdPath, iosm_s::failedFile, hardLink_s::filex, i, IOSM_LINK, IOSM_MAP, IOSM_VERIFY, IOSMERR_ENOENT, iosmFileActionSkipped(), iosmNext(), iosmUNSAFE, iosm_s::ix, iosm_s::li, hardLink_s::linksLeft, hardLink_s::nlink, iosm_s::nsuffix, iosm_s::opath, iosm_s::path, and xstrdup().

Referenced by iosmStage().

int iosmMapAttrs ( IOSM_t  iosm)
static int iosmMapFContext ( IOSM_t  iosm)
static

Definition at line 835 of file iosm.c.

References iosm_s::fcontext, fi, i, iosmGetFi(), iosm_s::ix, iosm_s::nofcontexts, iosm_s::path, rpmsxMatch(), and iosm_s::sb.

Referenced by iosmStage().

int iosmMapPath ( IOSM_t  iosm)
static int iosmMkdirs ( IOSM_t  iosm)
static

Create (if necessary) directories not explicitly included in package.

Parameters
iosmfile state machine data
Returns
0 on success

Definition at line 1475 of file iosm.c.

References _free(), D_, dc, dnlCount(), dnlFreeIterator(), dnlIndex(), dnlInitIterator(), dnlNextIterator(), iosm_s::dnlx, iosm_s::fcontext, fi, i, IOSM_LSETFCON, IOSM_LSTAT, IOSM_MKDIR, IOSMERR_ENOENT, iosmGetFi(), iosmNext(), iosmUNSAFE, iosm_s::ldn, iosm_s::ldnalloc, iosm_s::ldnlen, iosm_s::osb, iosm_s::path, iosm_s::rdbuf, rpmlog(), RPMLOG_DEBUG, rpmsxMatch(), iosm_s::sb, stpcpy(), urlPath(), xcalloc(), and xrealloc.

Referenced by iosmStage().

int iosmNext ( IOSM_t  iosm,
iosmFileStage  nstage 
)

File state machine driver.

Parameters
iosmI/O state machine
nstagenext stage
Returns
0 on success

Definition at line 461 of file iosm.c.

References iosmStage(), iosm_s::multithreaded, iosm_s::nstage, rpmsqJoin(), and rpmsqThread().

Referenced by extractRegular(), iosmCommitLinks(), iosmMakeLinks(), iosmMkdirs(), iosmRmdirs(), iosmSetup(), iosmStage(), saveHardLink(), writeFile(), and writeLinkedFile().

static int iosmRmdirs ( IOSM_t  iosm)
static

Remove (if created) directories not explicitly included in package.

Parameters
iosmfile state machine data
Returns
0 on success

Definition at line 1420 of file iosm.c.

References dc, dnlCount(), dnlFreeIterator(), dnlIndex(), dnlInitIterator(), dnlNextIterator(), iosm_s::dnlx, IOSM_RMDIR, iosmNext(), iosm_s::ldn, iosm_s::path, iosm_s::rdbuf, and stpcpy().

Referenced by iosmStage().

int iosmSetup ( IOSM_t  iosm,
iosmFileStage  goal,
const char *  afmt,
const void *  _ts,
const void *  _fi,
FD_t  cfd,
unsigned int *  archiveSize,
const char **  failedFile 
)
int iosmStage ( IOSM_t  iosm,
iosmFileStage  stage 
)

File state machine driver.

Parameters
iosmI/O state machine
stagenext stage
Returns
0 on success

Definition at line 1638 of file iosm.c.

References _, _fafilter, _free(), iosm_s::action, alloca(), iosm_s::astriplen, iosm_s::blksize, iosm_s::cfd, Chmod(), Chown(), iosm_s::commit, CPIO_TRAILER, hardLink_s::createdPath, iosm_s::debug, iosm_s::diskchecked, iosm_s::dnlx, errno, iosm_s::exists, extractRegular(), FA_ERASE, FA_UNKNOWN, Fadvise(), iosm_s::failedFile, Fclose(), iosm_s::fcontext, fdGetCpioPos(), fdSetCpioPos(), FDSTAT_DIGEST, fdstat_op(), Ferror(), iosm_s::fflags, fi, hardLink_s::filex, Fopen(), Fread(), freeHardLink(), Fwrite(), iosm_s::goal, iosm_s::headerRead, iosm_s::headerWrite, i, IOSM_ALL_HARDLINKS, IOSM_CHMOD, IOSM_CHOWN, IOSM_CHROOT, IOSM_COMMIT, IOSM_CREATE, IOSM_DEAD, IOSM_DESTROY, IOSM_DREAD, IOSM_DWRITE, IOSM_EAT, IOSM_FINI, IOSM_FOLLOW_SYMLINKS, IOSM_HREAD, IOSM_HWRITE, IOSM_INIT, IOSM_INTERNAL, IOSM_LCHOWN, IOSM_LINK, IOSM_LSETFCON, IOSM_LSTAT, IOSM_MAP, IOSM_MKDIR, IOSM_MKDIRS, IOSM_MKFIFO, IOSM_MKLINKS, IOSM_MKNOD, IOSM_NEXT, IOSM_NOTIFY, IOSM_PAD, IOSM_PAYLOAD_EXTRACT, IOSM_PAYLOAD_LIST, IOSM_PKGBUILD, IOSM_PKGCOMMIT, IOSM_PKGERASE, IOSM_PKGINSTALL, IOSM_POS, IOSM_POST, IOSM_PRE, IOSM_PROCESS, IOSM_RCLOSE, IOSM_READ, IOSM_READLINK, IOSM_RENAME, IOSM_RMDIR, IOSM_RMDIRS, IOSM_ROPEN, IOSM_SBIT_CHECK, IOSM_STAT, IOSM_SYMLINK, IOSM_SYSCALL, IOSM_TRAILER, IOSM_UNDO, IOSM_UNKNOWN, IOSM_UNLINK, IOSM_UTIME, IOSM_VERBOSE, IOSM_VERIFY, IOSM_WCLOSE, IOSM_WOPEN, IOSM_WRITE, iosmCommitLinks(), IOSMERR_CHMOD_FAILED, IOSMERR_CHOWN_FAILED, IOSMERR_ENOENT, IOSMERR_ENOTEMPTY, IOSMERR_HDR_TRAILER, IOSMERR_LINK_FAILED, IOSMERR_LSETFCON_FAILED, IOSMERR_LSTAT_FAILED, IOSMERR_MISSING_HARDLINK, IOSMERR_MKDIR_FAILED, IOSMERR_MKFIFO_FAILED, IOSMERR_MKNOD_FAILED, IOSMERR_OPEN_FAILED, IOSMERR_READ_FAILED, IOSMERR_READLINK_FAILED, IOSMERR_RENAME_FAILED, IOSMERR_RMDIR_FAILED, IOSMERR_STAT_FAILED, IOSMERR_SYMLINK_FAILED, IOSMERR_UNKNOWN_FILETYPE, IOSMERR_UNLINK_FAILED, IOSMERR_UNMAPPED_FILE, IOSMERR_UTIME_FAILED, IOSMERR_WRITE_FAILED, iosmFileActionSkipped(), iosmFileStageString(), iosmFsPath(), iosmGetFi(), iosmGetTs(), iosmMakeLinks(), iosmMapAttrs(), iosmMapFContext(), iosmMapPath(), iosmMkdirs(), iosmNext(), iosmRmdirs(), iosmUNSAFE, IS_DEV_LOG, iosm_s::iter, iosm_s::ix, j, Lchown(), iosm_s::ldn, iosm_s::ldnalloc, iosm_s::ldnlen, iosm_s::li, Link(), hardLink_s::linkIndex, iosm_s::links, hardLink_s::linksLeft, iosm_s::lpath, Lstat(), mapFind(), iosm_s::mapFlags, mapNextIterator(), Mkdir(), iosm_s::mkdirsdone, Mkfifo(), Mknod(), hardLink_s::next, hardLink_s::nlink, iosm_s::nsuffix, iosm_s::op_digest, iosm_s::opath, iosm_s::osb, iosm_s::osuffix, iosm_s::path, iosm_s::postpone, iosm_s::rc, iosm_s::rdb, iosm_s::rdbuf, iosm_s::rdlen, iosm_s::rdnb, iosm_s::rdsize, Readlink(), Rename(), iosm_s::repackaged, iosm_s::rfd, Rmdir(), RPMCALLBACK_INST_PROGRESS, RPMFILE_GHOST, RPMFILE_MISSINGOK, rpmlog(), RPMLOG_DEBUG, RPMLOG_ERR, RPMLOG_WARNING, rpmswAdd(), rpmsxLsetfilecon(), rpmtsNotify(), S_ISLNK, S_ISSOCK, saveHardLink(), hardLink_s::sb, iosm_s::sb, iosm_s::stage, Stat(), stpcpy(), iosm_s::strict_erasures, iosm_s::subdir, iosm_s::sufbuf, iosm_s::suffix, Symlink(), iosm_s::trailerWrite, Unlink(), urlPath(), Utime(), iosm_s::wfd, iosm_s::wrb, iosm_s::wrbuf, writeFile(), writeLinkedFile(), iosm_s::wrlen, iosm_s::wrnb, iosm_s::wrsize, xmalloc, and xstrdup().

Referenced by fsmStage(), and iosmNext().

static int iosmStrCmp ( const void *  a,
const void *  b 
)
static

Definition at line 213 of file iosm.c.

References urlPath().

Referenced by mapFind().

char* iosmStrerror ( int  rc)
int iosmTeardown ( IOSM_t  iosm)

Clean I/O state machine.

Parameters
iosmI/O state machine
Returns
0 on success

Definition at line 802 of file iosm.c.

References _free(), iosm_s::cfd, iosm_s::debug, iosm_s::failedFile, fdFree(), IOSM_DESTROY, iosmGetTs(), iosmUNSAFE, iosm_s::iter, iosm_s::lmtab, mapFreeIterator(), iosm_s::op_digest, iosm_s::rc, rpmswAdd(), RPMTS_OP_DIGEST, rpmtsFree(), rpmtsOp(), and iosmIterator_s::ts.

static int mapFind ( IOSMI_t  iter,
const char *  iosmPath 
)
static

Locate archive path in file info.

Parameters
iterfile info iterator
iosmPatharchive path
Returns
index into file info, -1 if archive path was not found

Definition at line 247 of file iosm.c.

References _RPMFI_NOMETHODS, fi, iosmIterator_s::fi, iosmIterator_s::i, iosmStrCmp(), mapNextIterator(), and rpmfiFC().

Referenced by iosmStage().

static void* mapFreeIterator ( void *  _iter)
static

Destroy file info iterator.

Parameters
_iterfile info iterator
Return values
NULLalways

Definition at line 150 of file iosm.c.

References _free(), iosmIterator_s::fi, and rpmfiUnlink().

Referenced by freeIOSM(), and iosmTeardown().

static void* mapInitIterator ( rpmfi  fi,
int  reverse 
)
static

Create file info iterator.

Parameters
fitransaction element file info
reverseiterate in reverse order?
Returns
file info iterator

Definition at line 171 of file iosm.c.

References fi, iosmIterator_s::fi, iosmIterator_s::i, iosmIterator_s::isave, reverse, iosmIterator_s::reverse, rpmfiLink(), and xcalloc().

Referenced by iosmSetup().

static int mapNextIterator ( void *  _iter)
static

Return next index into file info.

Parameters
_iterfile info iterator
Returns
next index, -1 on termination

Definition at line 194 of file iosm.c.

References iosmIterator_s::fi, iosmIterator_s::i, i, iosmIterator_s::isave, and iosmIterator_s::reverse.

Referenced by iosmStage(), and mapFind().

IOSM_t newIOSM ( void  )

Create I/O state machine instance.

Returns
I/O state machine

Definition at line 574 of file iosm.c.

References xcalloc().

static int saveHardLink ( IOSM_t  iosm)
static
static int writeFile ( IOSM_t  iosm,
int  writeData 
)
static
static int writeLinkedFile ( IOSM_t  iosm)
static

Write set of linked files to payload stream.

Parameters
iosmfile state machine data
Returns
0 on success

Definition at line 1240 of file iosm.c.

References _free(), iosm_s::astriplen, iosm_s::failedFile, hardLink_s::filex, iosm_s::headerWrite, i, IOSM_MAP, iosmNext(), iosm_s::ix, iosm_s::li, iosm_s::lpath, hardLink_s::nlink, iosm_s::nsuffix, iosm_s::path, stpcpy(), tarHeaderWrite(), urlPath(), writeFile(), xmalloc, and xstrdup().

Referenced by iosmStage().

Variable Documentation

int _iosm_debug = 0

Definition at line 75 of file iosm.c.

Referenced by iosmSetup().

int _iosm_threads = 0

Definition at line 79 of file iosm.c.

Referenced by iosmSetup().

int(* _iosmNext)(IOSM_t iosm, iosmFileStage nstage) = &iosmNext