PAYLOAD.


Files

file  cpio.c
 Handle cpio payloads within rpm packages.
file  cpio.h
 Structures used to handle cpio payloads within rpm packages.
file  fsm.c
 File state machine to handle a payload from a package.
file  fsm.h
 File state machine to handle a payload within an rpm package.
file  psm.c
 Package state machine to handle a package from a transaction set.
file  psm.h
 Package state machine to handle a package from a transaction set.
file  rpmlib.h
 In Memoriam: Steve Taylor <staylor@redhat.com> was here, now he's not.

Data Structures

struct  cpioCrcPhysicalHeader
 Cpio archive header information. More...
struct  dnli_s
 Directory name iterator. More...
struct  hardLink_s
 Keeps track of the set of all hard links to a file in an archive. More...
struct  fsmIterator_s
 Iterator across package file info, forward on install, backward on erase. More...
struct  fsm_s
 File name and stat information. More...

RPMTS

typedef fsmIterator_sFSMI_t
 Iterator across package file info, forward on install, backward on erase.
typedef fsm_sFSM_t
 File state machine data.

Defines

#define CPIOERR_CHECK_ERRNO   0x00008000
 
Note:
CPIO_CHECK_ERRNO bit is set only if errno is valid.


Typedefs

typedef enum cpioMapFlags_e cpioMapFlags
typedef dnli_sDNLI_t
 Directory name iterator.

Enumerations

enum  cpioErrorReturns {
  CPIOERR_BAD_MAGIC = (2 ), CPIOERR_BAD_HEADER = (3 ), CPIOERR_OPEN_FAILED = (4 | 0x00008000 ), CPIOERR_CHMOD_FAILED = (5 | 0x00008000 ),
  CPIOERR_CHOWN_FAILED = (6 | 0x00008000 ), CPIOERR_WRITE_FAILED = (7 | 0x00008000 ), CPIOERR_UTIME_FAILED = (8 | 0x00008000 ), CPIOERR_UNLINK_FAILED = (9 | 0x00008000 ),
  CPIOERR_RENAME_FAILED = (10 | 0x00008000 ), CPIOERR_SYMLINK_FAILED = (11 | 0x00008000 ), CPIOERR_STAT_FAILED = (12 | 0x00008000 ), CPIOERR_LSTAT_FAILED = (13 | 0x00008000 ),
  CPIOERR_MKDIR_FAILED = (14 | 0x00008000 ), CPIOERR_RMDIR_FAILED = (15 | 0x00008000 ), CPIOERR_MKNOD_FAILED = (16 | 0x00008000 ), CPIOERR_MKFIFO_FAILED = (17 | 0x00008000 ),
  CPIOERR_LINK_FAILED = (18 | 0x00008000 ), CPIOERR_READLINK_FAILED = (19 | 0x00008000 ), CPIOERR_READ_FAILED = (20 | 0x00008000 ), CPIOERR_COPY_FAILED = (21 | 0x00008000 ),
  CPIOERR_LSETFCON_FAILED = (22 | 0x00008000 ), CPIOERR_HDR_SIZE = (23 ), CPIOERR_HDR_TRAILER = (24 ), CPIOERR_UNKNOWN_FILETYPE = (25 ),
  CPIOERR_MISSING_HARDLINK = (26 ), CPIOERR_MD5SUM_MISMATCH = (27 ), CPIOERR_INTERNAL = (28 ), CPIOERR_UNMAPPED_FILE = (29 ),
  CPIOERR_ENOENT = (30 ), CPIOERR_ENOTEMPTY = (31 )
}
enum  cpioMapFlags_e {
  CPIO_MAP_PATH = (1 << 0), CPIO_MAP_MODE = (1 << 1), CPIO_MAP_UID = (1 << 2), CPIO_MAP_GID = (1 << 3),
  CPIO_FOLLOW_SYMLINKS = (1 << 4), CPIO_MAP_ABSOLUTE = (1 << 5), CPIO_MAP_ADDDOT = (1 << 6), CPIO_ALL_HARDLINKS = (1 << 7),
  CPIO_MAP_TYPE = (1 << 8), CPIO_SBIT_CHECK = (1 << 9)
}

Functions

const char *const cpioStrerror (int rc)
 Return formatted error message on payload handling failure.
static const char * fsmFsPath (const FSM_t fsm, const struct stat *st, const char *subdir, const char *suffix)
 Build path to file from file info, ornamented with subdir and suffix.
static void * mapFreeIterator (void *p)
 Destroy file info iterator.
static void * mapInitIterator (rpmts ts, rpmfi fi)
 Create file info iterator.
static int mapNextIterator (void *a)
 Return next index into file info.
static int cpioStrCmp (const void *a, const void *b)
static int mapFind (FSMI_t iter, const char *fsmPath)
 Locate archive path in file info.
static void * dnlFreeIterator (const void *a)
 Destroy directory name iterator.
static int dnlCount (const DNLI_t dnli)
static int dnlIndex (const DNLI_t dnli)
static void * dnlInitIterator (const FSM_t fsm, int reverse)
 Create directory name iterator.
static const char * dnlNextIterator (DNLI_t dnli)
 Return next directory name (from file info).
static int saveHardLink (FSM_t fsm)
 Save hard link in chain.
static void * freeHardLink (struct hardLink_s *li)
 Destroy set of hard links.
static int expandRegular (FSM_t fsm)
 Create file from payload stream.
static int writeFile (FSM_t fsm, int writeData)
 Write next item to payload stream.
static int writeLinkedFile (FSM_t fsm)
 Write set of linked files to payload stream.
static int fsmMakeLinks (FSM_t fsm)
 Create pending hard links to existing file.
static int fsmCommitLinks (FSM_t fsm)
 Commit hard linked file set atomically.

Define Documentation

#define CPIOERR_CHECK_ERRNO   0x00008000

Note:
CPIO_CHECK_ERRNO bit is set only if errno is valid.

Definition at line 18 of file cpio.h.

Referenced by cpioStrerror().


Typedef Documentation

typedef enum cpioMapFlags_e cpioMapFlags

typedef struct dnli_s * DNLI_t

Directory name iterator.

typedef struct fsm_s* FSM_t

File state machine data.

Definition at line 876 of file rpmlib.h.

typedef struct fsmIterator_s* FSMI_t

Iterator across package file info, forward on install, backward on erase.

Definition at line 871 of file rpmlib.h.


Enumeration Type Documentation

enum cpioErrorReturns

Enumerator:
CPIOERR_BAD_MAGIC 
CPIOERR_BAD_HEADER 
CPIOERR_OPEN_FAILED 
CPIOERR_CHMOD_FAILED 
CPIOERR_CHOWN_FAILED 
CPIOERR_WRITE_FAILED 
CPIOERR_UTIME_FAILED 
CPIOERR_UNLINK_FAILED 
CPIOERR_RENAME_FAILED 
CPIOERR_SYMLINK_FAILED 
CPIOERR_STAT_FAILED 
CPIOERR_LSTAT_FAILED 
CPIOERR_MKDIR_FAILED 
CPIOERR_RMDIR_FAILED 
CPIOERR_MKNOD_FAILED 
CPIOERR_MKFIFO_FAILED 
CPIOERR_LINK_FAILED 
CPIOERR_READLINK_FAILED 
CPIOERR_READ_FAILED 
CPIOERR_COPY_FAILED 
CPIOERR_LSETFCON_FAILED 
CPIOERR_HDR_SIZE 
CPIOERR_HDR_TRAILER 
CPIOERR_UNKNOWN_FILETYPE 
CPIOERR_MISSING_HARDLINK 
CPIOERR_MD5SUM_MISMATCH 
CPIOERR_INTERNAL 
CPIOERR_UNMAPPED_FILE 
CPIOERR_ENOENT 
CPIOERR_ENOTEMPTY 

Definition at line 22 of file cpio.h.

enum cpioMapFlags_e

Enumerator:
CPIO_MAP_PATH 
CPIO_MAP_MODE 
CPIO_MAP_UID 
CPIO_MAP_GID 
CPIO_FOLLOW_SYMLINKS  only for building.
CPIO_MAP_ABSOLUTE 
CPIO_MAP_ADDDOT 
CPIO_ALL_HARDLINKS  fail if hardlinks are missing.
CPIO_MAP_TYPE  only for building.
CPIO_SBIT_CHECK 

Definition at line 58 of file cpio.h.


Function Documentation

static int cpioStrCmp ( const void *  a,
const void *  b 
) [static]

Definition at line 174 of file fsm.c.

Referenced by mapFind().

const char* const cpioStrerror ( int  rc  ) 

Return formatted error message on payload handling failure.

Parameters:
rc error code
Returns:
formatted error string

Definition at line 196 of file cpio.c.

References _, CPIOERR_BAD_HEADER, CPIOERR_BAD_MAGIC, CPIOERR_CHECK_ERRNO, CPIOERR_CHMOD_FAILED, CPIOERR_CHOWN_FAILED, CPIOERR_COPY_FAILED, CPIOERR_ENOENT, CPIOERR_ENOTEMPTY, CPIOERR_HDR_SIZE, CPIOERR_INTERNAL, CPIOERR_LINK_FAILED, CPIOERR_LSETFCON_FAILED, CPIOERR_LSTAT_FAILED, CPIOERR_MD5SUM_MISMATCH, CPIOERR_MISSING_HARDLINK, CPIOERR_MKDIR_FAILED, CPIOERR_MKFIFO_FAILED, CPIOERR_MKNOD_FAILED, CPIOERR_OPEN_FAILED, CPIOERR_READ_FAILED, CPIOERR_READLINK_FAILED, CPIOERR_RENAME_FAILED, CPIOERR_RMDIR_FAILED, CPIOERR_STAT_FAILED, CPIOERR_SYMLINK_FAILED, CPIOERR_UNKNOWN_FILETYPE, CPIOERR_UNLINK_FAILED, CPIOERR_UNMAPPED_FILE, CPIOERR_UTIME_FAILED, CPIOERR_WRITE_FAILED, errno, and strerror.

Referenced by cpio_doio(), and rpmpsmStage().

static int dnlCount ( const DNLI_t  dnli  )  [inline, static]

Definition at line 259 of file fsm.c.

References dnli_s::fi.

Referenced by fsmMkdirs(), and fsmRmdirs().

static void* dnlFreeIterator ( const void *  a  )  [static]

Destroy directory name iterator.

Parameters:
a directory name iterator
Return values:
NULL always

Definition at line 247 of file fsm.c.

References _free(), and dnli_s::active.

Referenced by fsmRmdirs().

static int dnlIndex ( const DNLI_t  dnli  )  [inline, static]

Definition at line 267 of file fsm.c.

References dnli_s::isave.

Referenced by fsmMkdirs(), and fsmRmdirs().

static void* dnlInitIterator ( const FSM_t  fsm,
int  reverse 
) [static]

Create directory name iterator.

Parameters:
fsm file state machine data
reverse traverse directory names in reverse order?
Returns:
directory name iterator

Definition at line 282 of file fsm.c.

References _, fsmGetFi(), RPMMESS_DEBUG, rpmMessage, xcalloc(), and XFA_SKIPPING.

Referenced by fsmMkdirs(), and fsmRmdirs().

static const char* dnlNextIterator ( DNLI_t  dnli  )  [static]

Return next directory name (from file info).

Parameters:
dnli directory name iterator
Returns:
next directory name

Definition at line 372 of file fsm.c.

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

Referenced by fsmMkdirs(), and fsmRmdirs().

static int expandRegular ( FSM_t  fsm  )  [static]

Create file from payload stream.

Parameters:
fsm file state machine data
Returns:
0 on success

Definition at line 824 of file fsm.c.

References _free(), CPIOERR_MD5SUM_MISMATCH, fdFiniDigest(), fdInitDigest(), Fflush(), fsm_s::fmd5sum, FSM_DREAD, FSM_NOTIFY, FSM_WCLOSE, FSM_WOPEN, FSM_WRITE, fsmNext(), left, fsm_s::md5sum, PGPHASHALGO_MD5, fsm_s::sb, fsm_s::wfd, fsm_s::wrlen, fsm_s::wrnb, and fsm_s::wrsize.

Referenced by fsmStage().

static void* freeHardLink ( struct hardLink_s li  )  [static]

Destroy set of hard links.

Parameters:
li set of hard links
Returns:
NULL always

Definition at line 517 of file fsm.c.

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

Referenced by freeFSM(), and fsmStage().

static int fsmCommitLinks ( FSM_t  fsm  )  [static]

Commit hard linked file set atomically.

Parameters:
fsm file state machine data
Returns:
0 on success

Definition at line 1155 of file fsm.c.

References _free(), fsm_s::action, hardLink_s::filex, FSM_COMMIT, FSM_MAP, fsmNext(), fsm_s::ix, fsm_s::li, fsm_s::links, hardLink_s::next, hardLink_s::nlink, fsm_s::nsuffix, fsm_s::path, hardLink_s::sb, fsm_s::sb, and XFA_SKIPPING.

Referenced by fsmStage().

static const char* fsmFsPath ( const FSM_t  fsm,
const struct stat *  st,
const char *  subdir,
const char *  suffix 
) [static]

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

Parameters:
fsm file state machine data
st file stat info
subdir subdir to use (NULL disables)
suffix suffix to use (NULL disables)
Return values:
path to file

Definition at line 79 of file fsm.c.

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

Referenced by fsmMapPath(), and fsmStage().

static int fsmMakeLinks ( FSM_t  fsm  )  [static]

Create pending hard links to existing file.

Parameters:
fsm file state machine data
Returns:
0 on success

Definition at line 1089 of file fsm.c.

References _free(), fsm_s::action, CPIOERR_ENOENT, hardLink_s::createdPath, fsm_s::failedFile, hardLink_s::filex, FSM_LINK, FSM_MAP, FSM_VERIFY, fsmNext(), fsmUNSAFE, fsm_s::ix, fsm_s::li, hardLink_s::linksLeft, hardLink_s::nlink, fsm_s::nsuffix, fsm_s::opath, opath, fsm_s::path, XFA_SKIPPING, and xstrdup().

Referenced by fsmStage().

static int mapFind ( FSMI_t  iter,
const char *  fsmPath 
) [static]

Locate archive path in file info.

Parameters:
iter file info iterator
fsmPath archive path
Returns:
index into file info, -1 if archive path was not found

Definition at line 205 of file fsm.c.

References cpioStrCmp(), fsmIterator_s::fi, fsmIterator_s::i, and mapNextIterator().

Referenced by fsmStage().

static void* mapFreeIterator ( void *  p  )  [static]

Destroy file info iterator.

Parameters:
p file info iterator
Return values:
NULL always

Definition at line 113 of file fsm.c.

References _free(), fsmIterator_s::fi, rpmfiUnlink, rpmtsFree(), and fsmIterator_s::ts.

Referenced by freeFSM(), and fsmTeardown().

static void* mapInitIterator ( rpmts  ts,
rpmfi  fi 
) [static]

Create file info iterator.

Parameters:
ts transaction set
fi transaction element file info
Returns:
file info iterator

Definition at line 134 of file fsm.c.

References FA_COPYOUT, rpmfiLink, rpmteType(), rpmtsLink, TR_REMOVED, and xcalloc().

Referenced by fsmSetup().

static int mapNextIterator ( void *  a  )  [static]

Return next index into file info.

Parameters:
a file info iterator
Returns:
next index, -1 on termination

Definition at line 153 of file fsm.c.

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

Referenced by fsmStage(), and mapFind().

static int saveHardLink ( FSM_t  fsm  )  [static]

Save hard link in chain.

Parameters:
fsm file state machine data
Returns:
Is chain only partially filled?

Definition at line 422 of file fsm.c.

References _free(), hardLink_s::createdPath, hardLink_s::filex, FSM_MAP, FSM_PKGBUILD, FSM_PKGINSTALL, fsmGetFi(), fsmNext(), fsm_s::goal, fsm_s::ix, fsm_s::li, hardLink_s::linkIndex, fsm_s::links, hardLink_s::linksLeft, hardLink_s::next, hardLink_s::nlink, fsm_s::nsuffix, hardLink_s::nsuffix, fsm_s::path, hardLink_s::sb, fsm_s::sb, xcalloc(), and XFA_SKIPPING.

Referenced by fsmStage().

static int writeFile ( FSM_t  fsm,
int  writeData 
) [static]

Write next item to payload stream.

Parameters:
fsm file state machine data
writeData should data be written?
Returns:
0 on success

Definition at line 893 of file fsm.c.

References alloca(), alloca_strdup, fsm_s::baseName, CPIO_MAP_ABSOLUTE, CPIO_MAP_ADDDOT, CPIO_MAP_PATH, fsm_s::dirName, Fileno(), FSM_DWRITE, FSM_HWRITE, FSM_PAD, FSM_RCLOSE, FSM_READ, FSM_READLINK, FSM_ROPEN, fsmGetFi(), fsmNext(), fsmUNSAFE, fsm_s::ix, left, fsm_s::mapFlags, fsm_s::opath, opath, fsm_s::osb, fsm_s::path, fsm_s::rdbuf, fsm_s::rdlen, fsm_s::rdnb, fsm_s::rdsize, fsm_s::rfd, S_ISLNK, fsm_s::sb, stpcpy(), and fsm_s::wrnb.

Referenced by fsmStage(), and writeLinkedFile().

static int writeLinkedFile ( FSM_t  fsm  )  [static]

Write set of linked files to payload stream.

Parameters:
fsm file state machine data
Returns:
0 on success

Definition at line 1036 of file fsm.c.

References _free(), fsm_s::failedFile, hardLink_s::filex, FSM_MAP, fsmNext(), fsm_s::ix, fsm_s::li, hardLink_s::nlink, fsm_s::nsuffix, fsm_s::path, writeFile(), and xstrdup().

Referenced by fsmStage().


Generated on Fri Oct 12 08:44:57 2007 for rpm by  doxygen 1.5.2