rpm 5.2.1

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

Macros | Typedefs | Enumerations | Functions | Variables
iosm.h File Reference
PAYLOAD.

File state machine to handle archive I/O and system call's. More...

`#include <rpmiotypes.h>`
`#include <rpmsw.h>`
Include dependency graph for iosm.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Macros
#define | IOSM_VERBOSE 0x8000
#define | IOSM_INTERNAL 0x4000
#define | IOSM_SYSCALL 0x2000
#define | IOSM_DEAD 0x1000
#define | _fv(_a) ((_a) | IOSM_VERBOSE)
#define | _fi(_a) ((_a) | IOSM_INTERNAL)
#define | _fs(_a) ((_a) | (IOSM_INTERNAL | IOSM_SYSCALL))
#define | _fd(_a) ((_a) | (IOSM_INTERNAL | IOSM_DEAD))

## Typedefs
typedef struct iosm_s * | IOSM_t
| File state machine data. More...
typedef enum iosmFileAction_e | iosmFileAction
| File disposition(s) during package install/erase processing. More...
typedef enum iosmMapFlags_e | iosmMapFlags
typedef enum iosmFileStage_e | iosmFileStage

## Enumerations
enum | iosmFileAction_e { FA_UNKNOWN = 0, FA_CREATE, FA_COPYIN, FA_COPYOUT, FA_BACKUP, FA_SAVE, FA_SKIP, FA_ALTNAME, FA_ERASE, FA_SKIPNSTATE, FA_SKIPNETSHARED, FA_SKIPCOLOR }
| File disposition(s) during package install/erase processing. More...
enum | iosmMapFlags_e { IOSM_MAP_PATH = (1 << 0), IOSM_MAP_MODE = (1 << 1), IOSM_MAP_UID = (1 << 2), IOSM_MAP_GID = (1 << 3), IOSM_FOLLOW_SYMLINKS = (1 << 4), IOSM_MAP_ABSOLUTE = (1 << 5), IOSM_MAP_ADDDOT = (1 << 6), IOSM_ALL_HARDLINKS = (1 << 7), IOSM_MAP_TYPE = (1 << 8), IOSM_SBIT_CHECK = (1 << 9), IOSM_PAYLOAD_LIST = (1 << 10), IOSM_PAYLOAD_EXTRACT = (1 << 11), IOSM_PAYLOAD_CREATE = (1 << 12) }
enum | iosmFileStage_e { IOSM_UNKNOWN = 0, IOSM_INIT = (( 1 ) | ( 0x4000 | 0x1000 )), IOSM_PRE = (( 2 ) | ( 0x4000 | 0x1000 )), IOSM_PROCESS = (( 3 ) | 0x8000 ), IOSM_POST = (( 4 ) | ( 0x4000 | 0x1000 )), IOSM_UNDO = 5, IOSM_FINI = 6, IOSM_PKGINSTALL = (( 7 ) | ( 0x4000 | 0x1000 )), IOSM_PKGERASE = (( 8 ) | ( 0x4000 | 0x1000 )), IOSM_PKGBUILD = (( 9 ) | ( 0x4000 | 0x1000 )), IOSM_PKGCOMMIT = (( 10 ) | ( 0x4000 | 0x1000 )), IOSM_PKGUNDO = (( 11 ) | ( 0x4000 | 0x1000 )), IOSM_CREATE = (( 17 ) | ( 0x4000 | 0x1000 )), IOSM_MAP = (( 18 ) | ( 0x4000 | 0x1000 )), IOSM_MKDIRS = (( 19 ) | 0x4000 ), IOSM_RMDIRS = (( 20 ) | 0x4000 ), IOSM_MKLINKS = (( 21 ) | 0x4000 ), IOSM_NOTIFY = (( 22 ) | ( 0x4000 | 0x1000 )), IOSM_DESTROY = (( 23 ) | ( 0x4000 | 0x1000 )), IOSM_VERIFY = (( 24 ) | ( 0x4000 | 0x1000 )), IOSM_COMMIT = (( 25 ) | ( 0x4000 | 0x1000 )), IOSM_UNLINK = (( 33 ) | ( 0x4000 | 0x2000 )), IOSM_RENAME = (( 34 ) | ( 0x4000 | 0x2000 )), IOSM_MKDIR = (( 35 ) | ( 0x4000 | 0x2000 )), IOSM_RMDIR = (( 36 ) | ( 0x4000 | 0x2000 )), IOSM_LSETFCON = (( 39 ) | ( 0x4000 | 0x2000 )), IOSM_CHOWN = (( 40 ) | ( 0x4000 | 0x2000 )), IOSM_LCHOWN = (( 41 ) | ( 0x4000 | 0x2000 )), IOSM_CHMOD = (( 42 ) | ( 0x4000 | 0x2000 )), IOSM_UTIME = (( 43 ) | ( 0x4000 | 0x2000 )), IOSM_SYMLINK = (( 44 ) | ( 0x4000 | 0x2000 )), IOSM_LINK = (( 45 ) | ( 0x4000 | 0x2000 )), IOSM_MKFIFO = (( 46 ) | ( 0x4000 | 0x2000 )), IOSM_MKNOD = (( 47 ) | ( 0x4000 | 0x2000 )), IOSM_LSTAT = (( 48 ) | ( 0x4000 | 0x2000 )), IOSM_STAT = (( 49 ) | ( 0x4000 | 0x2000 )), IOSM_READLINK = (( 50 ) | ( 0x4000 | 0x2000 )), IOSM_CHROOT = (( 51 ) | ( 0x4000 | 0x2000 )), IOSM_NEXT = (( 65 ) | ( 0x4000 | 0x1000 )), IOSM_EAT = (( 66 ) | ( 0x4000 | 0x1000 )), IOSM_POS = (( 67 ) | ( 0x4000 | 0x1000 )), IOSM_PAD = (( 68 ) | ( 0x4000 | 0x1000 )), IOSM_TRAILER = (( 69 ) | ( 0x4000 | 0x1000 )), IOSM_HREAD = (( 70 ) | ( 0x4000 | 0x1000 )), IOSM_HWRITE = (( 71 ) | ( 0x4000 | 0x1000 )), IOSM_DREAD = (( 72 ) | ( 0x4000 | 0x2000 )), IOSM_DWRITE = (( 73 ) | ( 0x4000 | 0x2000 )), IOSM_ROPEN = (( 129 ) | ( 0x4000 | 0x2000 )), IOSM_READ = (( 130 ) | ( 0x4000 | 0x2000 )), IOSM_RCLOSE = (( 131 ) | ( 0x4000 | 0x2000 )), IOSM_WOPEN = (( 132 ) | ( 0x4000 | 0x2000 )), IOSM_WRITE = (( 133 ) | ( 0x4000 | 0x2000 )), IOSM_WCLOSE = (( 134 ) | ( 0x4000 | 0x2000 )) }

## Functions
const char * | iosmFileStageString (iosmFileStage a)
| Return formatted string representation of file stages. More...
const char * | iosmFileActionString (iosmFileAction a)
| Return formatted string representation of file disposition. More...
char * | iosmStrerror (int rc)
| Return formatted error message on payload handling failure. More...
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...
int | iosmFileActionSkipped (iosmFileAction action)
| Is the file going to be skipped? More...
int | iosmNext (IOSM_t iosm, iosmFileStage nstage)
| File state machine driver. More...
int | iosmStage (IOSM_t iosm, iosmFileStage stage)
| File state machine driver. More...

## Variables
int | _iosm_debug

## Detailed Description

File state machine to handle archive I/O and system call's.

Definition in file iosm.h.

## Macro Definition Documentation

#define _fd | ( |  | _a | ) | ((_a) | (IOSM_INTERNAL | IOSM_DEAD))

Definition at line 111 of file iosm.h.

#define _fi | ( |  | _a | ) | ((_a) | IOSM_INTERNAL)

Definition at line 109 of file iosm.h.

#define _fs | ( |  | _a | ) | ((_a) | (IOSM_INTERNAL | IOSM_SYSCALL))

Definition at line 110 of file iosm.h.

#define _fv | ( |  | _a | ) | ((_a) | IOSM_VERBOSE)

Definition at line 108 of file iosm.h.

#define IOSM_DEAD 0x1000

Definition at line 106 of file iosm.h.

Referenced by fsmStage(), and iosmStage().

#define IOSM_INTERNAL 0x4000

Definition at line 104 of file iosm.h.

Referenced by fsmStage(), and iosmStage().

#define IOSM_SYSCALL 0x2000

Definition at line 105 of file iosm.h.

Referenced by fsmStage(), and iosmStage().

#define IOSM_VERBOSE 0x8000

Definition at line 103 of file iosm.h.

Referenced by fsmStage(), and iosmStage().

## Typedef Documentation

typedef enum iosmFileAction_e iosmFileAction

File disposition(s) during package install/erase processing.

typedef enum iosmFileStage_e iosmFileStage

## Enumeration Type Documentation

enum iosmFileAction_e

File disposition(s) during package install/erase processing.

Enumerator
FA_UNKNOWN | initial action for file ...
FA_CREATE | ... copy in from payload.
FA_COPYIN | ... copy in from payload.
FA_COPYOUT | ... copy out to payload.
FA_BACKUP | ... renamed with ".rpmorig" extension.
FA_SAVE | ... renamed with ".rpmsave" extension.
FA_SKIP | ... already replaced, don't remove.
FA_ALTNAME | ... create with ".rpmnew" extension.
FA_ERASE | ... to be removed.
FA_SKIPNSTATE | ... untouched, state "not installed".
FA_SKIPNETSHARED | ... untouched, state "netshared".
FA_SKIPCOLOR | ... untouched, state "wrong color".

Definition at line 25 of file iosm.h.

enum iosmFileStage_e

Enumerator
IOSM_UNKNOWN |
IOSM_INIT |
IOSM_PRE |
IOSM_PROCESS |
IOSM_POST |
IOSM_UNDO |
IOSM_FINI |
IOSM_PKGINSTALL |
IOSM_PKGERASE |
IOSM_PKGBUILD |
IOSM_PKGCOMMIT |
IOSM_PKGUNDO |
IOSM_CREATE |
IOSM_MAP |
IOSM_MKDIRS |
IOSM_RMDIRS |
IOSM_MKLINKS |
IOSM_NOTIFY |
IOSM_DESTROY |
IOSM_VERIFY |
IOSM_COMMIT |
IOSM_UNLINK |
IOSM_RENAME |
IOSM_MKDIR |
IOSM_RMDIR |
IOSM_LSETFCON |
IOSM_CHOWN |
IOSM_LCHOWN |
IOSM_CHMOD |
IOSM_UTIME |
IOSM_SYMLINK |
IOSM_LINK |
IOSM_MKFIFO |
IOSM_MKNOD |
IOSM_LSTAT |
IOSM_STAT |
IOSM_READLINK |
IOSM_CHROOT |
IOSM_NEXT |
IOSM_EAT |
IOSM_POS |
IOSM_PAD |
IOSM_TRAILER |
IOSM_HREAD |
IOSM_HWRITE |
IOSM_DREAD |
IOSM_DWRITE |
IOSM_ROPEN |
IOSM_READ |
IOSM_RCLOSE |
IOSM_WOPEN |
IOSM_WRITE |
IOSM_WCLOSE |

Definition at line 113 of file iosm.h.

## Function Documentation

int iosmFileActionSkipped | ( | iosmFileAction | action | ) |

Is the file going to be skipped?

Parameters

  iosm | I/O state machine

Returns
  Is file to be skipped?

Definition at line 2678 of file iosm.c.

References IOSM_SKIPPING.

Referenced by dnlInitIterator(), fsmCommitLinks(), fsmMakeLinks(), fsmStage(), handleInstInstalledFiles(), handleOverlappedFiles(), iosmCommitLinks(), iosmMakeLinks(), iosmStage(), rpmtsRun(), saveHardLink(), and skipFiles().

const char* iosmFileActionString | ( | iosmFileAction | a | ) |

Return formatted string representation of file disposition.

Parameters

  a | file dispostion

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 | ) |

Return formatted string representation of file stages.

Parameters

  a | file stage

Returns
  formatted string

Definition at line 2703 of file iosm.c.

References IOSM_CHMOD, IOSM_CHOWN, IOSM_CHROOT, IOSM_COMMIT, IOSM_CREATE, IOSM_DESTROY, IOSM_DREAD, IOSM_DWRITE, IOSM_EAT, IOSM_FINI, IOSM_HREAD, IOSM_HWRITE, IOSM_INIT, 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_PKGBUILD, IOSM_PKGCOMMIT, IOSM_PKGERASE, IOSM_PKGINSTALL, IOSM_PKGUNDO, IOSM_POS, IOSM_POST, IOSM_PRE, IOSM_PROCESS, IOSM_RCLOSE, IOSM_READ, IOSM_READLINK, IOSM_RENAME, IOSM_RMDIR, IOSM_RMDIRS, IOSM_ROPEN, IOSM_STAT, IOSM_SYMLINK, IOSM_TRAILER, IOSM_UNDO, IOSM_UNKNOWN, IOSM_UNLINK, IOSM_UTIME, IOSM_VERIFY, IOSM_WCLOSE, IOSM_WOPEN, and IOSM_WRITE.

Referenced by fsmStage(), and iosmStage().

int iosmNext | ( | IOSM_t | iosm,
|  | iosmFileStage | nstage
| ) |  |

File state machine driver.

Parameters

  iosm | I/O state machine
  nstage | next stage

Returns
  0 on success

Definition at line 452 of file iosm.c.

References iosmStage(), rpmsqJoin(), and rpmsqThread().

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

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.

Parameters

  iosm | I/O state machine
  goal |
  afmt | archive format (NULL uses cpio)
  _ts | transaction set
  _fi | transaction element file info
  cfd | payload descriptor

Return values

  archiveSize | pointer to archive size
  failedFile | pointer to first file name that failed.

Returns
  0 on success

Definition at line 660 of file iosm.c.

References _iosm_debug, _iosm_threads, _iosmNext, _tsmask, arHeaderRead(), arHeaderWrite(), arSetup(), arTrailerWrite(), cpioHeaderRead(), cpioHeaderWrite(), cpioTrailerWrite(), FA_COPYOUT, fdGetCpioPos(), fdLink(), fdSetCpioPos(), IOSM_CREATE, IOSM_PKGBUILD, IOSM_PKGCOMMIT, IOSM_PKGERASE, IOSM_PKGINSTALL, iosmNext(), iosmUNSAFE, mapInitIterator(), reverse, RPMCALLBACK_INST_START, rpmteType(), RPMTRANS_FLAG_NOCONTEXTS, RPMTRANS_FLAG_NOFDIGESTS, rpmtsFlags(), rpmtsGetTid(), rpmtsLink(), rpmtsNotify(), TAR_BLOCK_SIZE, tarHeaderRead(), tarHeaderWrite(), tarTrailerWrite(), TR_ADDED, and TR_REMOVED.

int iosmStage | ( | IOSM_t | iosm,
|  | iosmFileStage | stage
| ) |  |

File state machine driver.

Parameters

  iosm | I/O state machine
  stage | next stage

Returns
  0 on success

Definition at line 1648 of file iosm.c.

References _, _fafilter, _free(), alloca(), Chmod(), Chown(), CPIO_TRAILER, errno, extractRegular(), FA_ERASE, FA_UNKNOWN, Fclose(), fdGetCpioPos(), fdSetCpioPos(), FDSTAT_DIGEST, fdstat_op(), Ferror(), Fopen(), Fread(), freeHardLink(), Fwrite(), 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(), iosmFileActionSkipped(), iosmFileStageString(), iosmFsPath(), iosmGetFi(), iosmMakeLinks(), iosmMapAttrs(), iosmMapFContext(), iosmMapPath(), iosmMkdirs(), iosmNext(), iosmRmdirs(), iosmUNSAFE, IS_DEV_LOG, Lchown(), Link(), lsetfilecon, Lstat(), mapFind(), mapNextIterator(), Mkdir(), Mkfifo(), Mknod(), Readlink(), Rename(), Rmdir(), RPMCALLBACK_INST_PROGRESS, RPMFILE_GHOST, RPMFILE_MISSINGOK, rpmlog(), RPMLOG_DEBUG, RPMLOG_ERR, RPMLOG_WARNING, rpmswAdd(), rpmtsNotify(), S_ISLNK, S_ISSOCK, saveHardLink(), Stat(), stpcpy(), Symlink(), Unlink(), urlPath(), Utime(), writeFile(), writeLinkedFile(), xmalloc(), and xstrdup().

Referenced by fsmStage(), and iosmNext().

int iosmTeardown | ( | IOSM_t | iosm | ) |

Clean I/O state machine.

Parameters

  iosm | I/O state machine

Returns
  0 on success

Definition at line 793 of file iosm.c.

References _free(), fdFree(), IOSM_DESTROY, iosmUNSAFE, mapFreeIterator(), rpmswAdd(), RPMTS_OP_DIGEST, rpmtsFree(), and rpmtsOp().

## Variable Documentation

int _iosm_debug

Definition at line 67 of file iosm.c.