Main Page   Modules   Data Structures   File List   Data Fields   Globals   Related Pages  

lib/fsm.h File Reference

File state machine to handle a payload within an rpm package. More...

#include <rpmlib.h>
#include "cpio.h"

Go to the source code of this file.

Data Structures

struct  fsm_s
struct  fsmIterator_s
struct  hardLink

Defines

#define FSM_VERBOSE   0x8000
#define FSM_INTERNAL   0x4000
#define FSM_SYSCALL   0x2000
#define FSM_DEAD   0x1000
#define _fv(_a)   ((_a) | FSM_VERBOSE)
#define _fi(_a)   ((_a) | FSM_INTERNAL)
#define _fs(_a)   ((_a) | (FSM_INTERNAL | FSM_SYSCALL))
#define _fd(_a)   ((_a) | (FSM_INTERNAL | FSM_DEAD))

Typedefs

typedef enum fileStage_e  fileStage

Enumerations

enum  fileStage_e {
  FSM_UNKNOWN = 0, FSM_INIT = (( 1 ) | ( 0x4000 | 0x1000 )), FSM_PRE = (( 2 ) | ( 0x4000 | 0x1000 )), FSM_PROCESS = (( 3 ) | 0x8000 ),
  FSM_POST = (( 4 ) | ( 0x4000 | 0x1000 )), FSM_UNDO = 5, FSM_FINI = 6, FSM_PKGINSTALL = (( 7 ) | ( 0x4000 | 0x1000 )),
  FSM_PKGERASE = (( 8 ) | ( 0x4000 | 0x1000 )), FSM_PKGBUILD = (( 9 ) | ( 0x4000 | 0x1000 )), FSM_PKGCOMMIT = (( 10 ) | ( 0x4000 | 0x1000 )), FSM_PKGUNDO = (( 11 ) | ( 0x4000 | 0x1000 )),
  FSM_CREATE = (( 17 ) | ( 0x4000 | 0x1000 )), FSM_MAP = (( 18 ) | ( 0x4000 | 0x1000 )), FSM_MKDIRS = (( 19 ) | 0x4000 ), FSM_RMDIRS = (( 20 ) | 0x4000 ),
  FSM_MKLINKS = (( 21 ) | 0x4000 ), FSM_NOTIFY = (( 22 ) | ( 0x4000 | 0x1000 )), FSM_DESTROY = (( 23 ) | ( 0x4000 | 0x1000 )), FSM_VERIFY = (( 24 ) | ( 0x4000 | 0x1000 )),
  FSM_COMMIT = (( 25 ) | ( 0x4000 | 0x1000 )), FSM_UNLINK = (( 33 ) | ( 0x4000 | 0x2000 )), FSM_RENAME = (( 34 ) | ( 0x4000 | 0x2000 )), FSM_MKDIR = (( 35 ) | ( 0x4000 | 0x2000 )),
  FSM_RMDIR = (( 36 ) | ( 0x4000 | 0x2000 )), FSM_CHOWN = (( 37 ) | ( 0x4000 | 0x2000 )), FSM_LCHOWN = (( 38 ) | ( 0x4000 | 0x2000 )), FSM_CHMOD = (( 39 ) | ( 0x4000 | 0x2000 )),
  FSM_UTIME = (( 40 ) | ( 0x4000 | 0x2000 )), FSM_SYMLINK = (( 41 ) | ( 0x4000 | 0x2000 )), FSM_LINK = (( 42 ) | ( 0x4000 | 0x2000 )), FSM_MKFIFO = (( 43 ) | ( 0x4000 | 0x2000 )),
  FSM_MKNOD = (( 44 ) | ( 0x4000 | 0x2000 )), FSM_LSTAT = (( 45 ) | ( 0x4000 | 0x2000 )), FSM_STAT = (( 46 ) | ( 0x4000 | 0x2000 )), FSM_READLINK = (( 47 ) | ( 0x4000 | 0x2000 )),
  FSM_CHROOT = (( 48 ) | ( 0x4000 | 0x2000 )), FSM_NEXT = (( 65 ) | ( 0x4000 | 0x1000 )), FSM_EAT = (( 66 ) | ( 0x4000 | 0x1000 )), FSM_POS = (( 67 ) | ( 0x4000 | 0x1000 )),
  FSM_PAD = (( 68 ) | ( 0x4000 | 0x1000 )), FSM_TRAILER = (( 69 ) | ( 0x4000 | 0x1000 )), FSM_HREAD = (( 70 ) | ( 0x4000 | 0x1000 )), FSM_HWRITE = (( 71 ) | ( 0x4000 | 0x1000 )),
  FSM_DREAD = (( 72 ) | ( 0x4000 | 0x2000 )), FSM_DWRITE = (( 73 ) | ( 0x4000 | 0x2000 )), FSM_ROPEN = (( 129 ) | ( 0x4000 | 0x2000 )), FSM_READ = (( 130 ) | ( 0x4000 | 0x2000 )),
  FSM_RCLOSE = (( 131 ) | ( 0x4000 | 0x2000 )), FSM_WOPEN = (( 132 ) | ( 0x4000 | 0x2000 )), FSM_WRITE = (( 133 ) | ( 0x4000 | 0x2000 )), FSM_WCLOSE = (( 134 ) | ( 0x4000 | 0x2000 ))
}

Functions

const char* const fileStageString (fileStage a)
 Return formatted string representation of file stages. More...

const char* const fileActionString (fileAction a)
 Return formatted string representation of file disposition. More...

FSM_t newFSM (void)
 Create file state machine instance. More...

FSM_t freeFSM (FSM_t fsm)
 Destroy file state machine instance. More...

int fsmSetup (FSM_t fsm, fileStage goal, const rpmTransactionSet ts, const TFI_t fi, FD_t cfd, unsigned int *archiveSize, const char **failedFile)
 Load external data into file state machine. More...

int fsmTeardown (FSM_t fsm)
 Clean file state machine. More...

rpmTransactionSet fsmGetTs (const FSM_t fsm)
 Retrieve transaction set from file state machine iterator. More...

TFI_t fsmGetFi (const FSM_t fsm)
 Retrieve transaction element file info from file state machine iterator. More...

int fsmMapPath (FSM_t fsm)
 Map next file path and action. More...

int fsmMapAttrs (FSM_t fsm)
 Map file stat(2) info. More...

int fsmStage (FSM_t fsm, fileStage stage)
 File state machine driver. More...


Detailed Description

File state machine to handle a payload within an rpm package.

Definition in file fsm.h.


Define Documentation

#define FSM_DEAD   0x1000
 

Definition at line 17 of file fsm.h.

#define FSM_INTERNAL   0x4000
 

Definition at line 15 of file fsm.h.

#define FSM_SYSCALL   0x2000
 

Definition at line 16 of file fsm.h.

#define FSM_VERBOSE   0x8000
 

Definition at line 14 of file fsm.h.

#define _fd( _a )   ((_a) | (FSM_INTERNAL | FSM_DEAD))
 

Definition at line 21 of file fsm.h.

Referenced by fileStage_e().

#define _fi( _a )   ((_a) | FSM_INTERNAL)
 

Definition at line 19 of file fsm.h.

Referenced by fileStage_e().

#define _fs( _a )   ((_a) | (FSM_INTERNAL | FSM_SYSCALL))
 

Definition at line 20 of file fsm.h.

Referenced by fileStage_e().

#define _fv( _a )   ((_a) | FSM_VERBOSE)
 

Definition at line 18 of file fsm.h.

Referenced by fileStage_e().


Typedef Documentation

typedef enum fileStage_e fileStage
 


Enumeration Type Documentation

enum fileStage_e
 

Enumeration values:
FSM_UNKNOWN  
FSM_INIT  
FSM_PRE  
FSM_PROCESS  
FSM_POST  
FSM_UNDO  
FSM_FINI  
FSM_PKGINSTALL  
FSM_PKGERASE  
FSM_PKGBUILD  
FSM_PKGCOMMIT  
FSM_PKGUNDO  
FSM_CREATE  
FSM_MAP  
FSM_MKDIRS  
FSM_RMDIRS  
FSM_MKLINKS  
FSM_NOTIFY  
FSM_DESTROY  
FSM_VERIFY  
FSM_COMMIT  
FSM_UNLINK  
FSM_RENAME  
FSM_MKDIR  
FSM_RMDIR  
FSM_CHOWN  
FSM_LCHOWN  
FSM_CHMOD  
FSM_UTIME  
FSM_SYMLINK  
FSM_LINK  
FSM_MKFIFO  
FSM_MKNOD  
FSM_LSTAT  
FSM_STAT  
FSM_READLINK  
FSM_CHROOT  
FSM_NEXT  
FSM_EAT  
FSM_POS  
FSM_PAD  
FSM_TRAILER  
FSM_HREAD  
FSM_HWRITE  
FSM_DREAD  
FSM_DWRITE  
FSM_ROPEN  
FSM_READ  
FSM_RCLOSE  
FSM_WOPEN  
FSM_WRITE  
FSM_WCLOSE  

Definition at line 22 of file fsm.h.


Function Documentation

const char* const fileActionString ( fileAction a )
 

Return formatted string representation of file disposition.

Parameters:
a   file dispostion
Returns:
formatted string

Definition at line 2101 of file fsm.c.

const char* const fileStageString ( fileStage a )
 

Return formatted string representation of file stages.

Parameters:
a   file stage
Returns:
formatted string

Definition at line 2121 of file fsm.c.

Referenced by fsmStage().

FSM_t freeFSM ( FSM_t fsm )
 

Destroy file state machine instance.

Parameters:
fsm   file state machine data
Returns:
always NULL

Definition at line 438 of file fsm.c.

Referenced by freeFi().

TFI_t fsmGetFi ( const FSM_t fsm )
 

Retrieve transaction element file info from file state machine iterator.

Parameters:
fsm   file state machine data
Returns:
transaction element file info

Definition at line 34 of file fsm.c.

Referenced by dnlInitIterator(), fsmMapAttrs(), fsmMapPath(), fsmMkdirs(), fsmStage(), saveHardLink(), and writeFile().

rpmTransactionSet fsmGetTs ( const FSM_t fsm )
 

Retrieve transaction set from file state machine iterator.

Parameters:
fsm   file state machine data
Returns:
transaction set

Definition at line 27 of file fsm.c.

Referenced by fsmStage(), and writeFile().

int fsmMapAttrs ( FSM_t fsm )
 

Map file stat(2) info.

Parameters:
fsm   file state machine data

Definition at line 616 of file fsm.c.

Referenced by fsmStage().

int fsmMapPath ( FSM_t fsm )
 

Map next file path and action.

Parameters:
fsm   file state machine data

Definition at line 521 of file fsm.c.

Referenced by fsmStage().

int fsmSetup ( FSM_t fsm,
fileStage goal,
const rpmTransactionSet ts,
const TFI_t fi,
FD_t cfd,
unsigned int * archiveSize,
const char ** failedFile )
 

Load external data into file state machine.

Parameters:
fsm   file state machine data
goal  
ts   transaction set
fi   transaction element file info
archiveSize   pointer to archive size
failedFile   pointer to first file name that failed.
Returns:
0 on success

Definition at line 454 of file fsm.c.

Referenced by cpio_doio(), and psmStage().

int fsmStage ( FSM_t fsm,
fileStage stage )
 

File state machine driver.

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

Definition at line 1188 of file fsm.c.

Referenced by cpioHeaderRead(), cpioHeaderWrite(), cpioTrailerWrite(), expandRegular(), fsmCommitLinks(), fsmMakeLinks(), fsmMkdirs(), fsmRmdirs(), fsmSetup(), fsmTeardown(), saveHardLink(), writeFile(), and writeLinkedFile().

int fsmTeardown ( FSM_t fsm )
 

Clean file state machine.

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

Definition at line 504 of file fsm.c.

Referenced by cpio_doio(), and psmStage().

FSM_t newFSM ( void )
 

Create file state machine instance.

Returns:
file state machine data

Definition at line 432 of file fsm.c.


Generated at Thu Sep 6 11:25:45 2001 for rpm by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001