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

lib/fsm.h

Go to the documentation of this file.
00001 #ifndef H_FSM
00002 #define H_FSM
00003 
00009 #include <rpmlib.h>
00010 #include "cpio.h"
00011 
00014 #define FSM_VERBOSE     0x8000
00015 #define FSM_INTERNAL    0x4000
00016 #define FSM_SYSCALL     0x2000
00017 #define FSM_DEAD        0x1000
00018 #define _fv(_a)         ((_a) | FSM_VERBOSE)
00019 #define _fi(_a)         ((_a) | FSM_INTERNAL)
00020 #define _fs(_a)         ((_a) | (FSM_INTERNAL | FSM_SYSCALL))
00021 #define _fd(_a)         ((_a) | (FSM_INTERNAL | FSM_DEAD))
00022 typedef enum fileStage_e {
00023     FSM_UNKNOWN =   0,
00024     FSM_INIT    =  _fd(1),
00025     FSM_PRE     =  _fd(2),
00026     FSM_PROCESS =  _fv(3),
00027     FSM_POST    =  _fd(4),
00028     FSM_UNDO    =  5,
00029     FSM_FINI    =  6,
00030 
00031     FSM_PKGINSTALL      = _fd(7),
00032     FSM_PKGERASE        = _fd(8),
00033     FSM_PKGBUILD        = _fd(9),
00034     FSM_PKGCOMMIT       = _fd(10),
00035     FSM_PKGUNDO         = _fd(11),
00036 
00037     FSM_CREATE  =  _fd(17),
00038     FSM_MAP     =  _fd(18),
00039     FSM_MKDIRS  =  _fi(19),
00040     FSM_RMDIRS  =  _fi(20),
00041     FSM_MKLINKS =  _fi(21),
00042     FSM_NOTIFY  =  _fd(22),
00043     FSM_DESTROY =  _fd(23),
00044     FSM_VERIFY  =  _fd(24),
00045     FSM_COMMIT  =  _fd(25),
00046 
00047     FSM_UNLINK  =  _fs(33),
00048     FSM_RENAME  =  _fs(34),
00049     FSM_MKDIR   =  _fs(35),
00050     FSM_RMDIR   =  _fs(36),
00051     FSM_CHOWN   =  _fs(37),
00052     FSM_LCHOWN  =  _fs(38),
00053     FSM_CHMOD   =  _fs(39),
00054     FSM_UTIME   =  _fs(40),
00055     FSM_SYMLINK =  _fs(41),
00056     FSM_LINK    =  _fs(42),
00057     FSM_MKFIFO  =  _fs(43),
00058     FSM_MKNOD   =  _fs(44),
00059     FSM_LSTAT   =  _fs(45),
00060     FSM_STAT    =  _fs(46),
00061     FSM_READLINK=  _fs(47),
00062     FSM_CHROOT  =  _fs(48),
00063 
00064     FSM_NEXT    =  _fd(65),
00065     FSM_EAT     =  _fd(66),
00066     FSM_POS     =  _fd(67),
00067     FSM_PAD     =  _fd(68),
00068     FSM_TRAILER =  _fd(69),
00069     FSM_HREAD   =  _fd(70),
00070     FSM_HWRITE  =  _fd(71),
00071     FSM_DREAD   =  _fs(72),
00072     FSM_DWRITE  =  _fs(73),
00073 
00074     FSM_ROPEN   =  _fs(129),
00075     FSM_READ    =  _fs(130),
00076     FSM_RCLOSE  =  _fs(131),
00077     FSM_WOPEN   =  _fs(132),
00078     FSM_WRITE   =  _fs(133),
00079     FSM_WCLOSE  =  _fs(134),
00080 } fileStage;
00081 #undef  _fv
00082 #undef  _fi
00083 #undef  _fs
00084 #undef  _fd
00085 
00089 struct hardLink {
00090 /*@owned@*/ struct hardLink * next;
00091 /*@owned@*/ const char ** nsuffix;
00092 /*@owned@*/ int * filex;
00093     dev_t dev;
00094     ino_t inode;
00095     int nlink;
00096     int linksLeft;
00097     int linkIndex;
00098     int createdPath;
00099 };
00100 
00104 struct fsmIterator_s {
00105 /*@kept@*/ rpmTransactionSet ts;        
00106 /*@kept@*/ TFI_t fi;                    
00107     int reverse;                        
00108     int isave;                          
00109     int i;                              
00110 };
00111 
00115 struct fsm_s {
00116 /*@owned@*/ const char * path;          
00117 /*@owned@*/ const char * opath;         
00118     FD_t cfd;                           
00119     FD_t rfd;                           
00120 /*@dependent@*/ char * rdbuf;           
00121 /*@owned@*/ char * rdb;                 
00122     size_t rdsize;                      
00123     size_t rdlen;                       
00124     size_t rdnb;                        
00125     FD_t wfd;                           
00126 /*@dependent@*/ char * wrbuf;           
00127 /*@owned@*/ char * wrb;                 
00128     size_t wrsize;                      
00129     size_t wrlen;                       
00130     size_t wrnb;                        
00131 /*@only@*/ FSMI_t iter;                 
00132     int ix;                             
00133 /*@only@*/ struct hardLink * links;     
00134 /*@only@*/ struct hardLink * li;        
00135 /*@kept@*/ unsigned int * archiveSize;  
00136 /*@kept@*/ const char ** failedFile;    
00137 /*@shared@*/ const char * subdir;       
00138     char subbuf[64];    /* XXX eliminate */
00139 /*@observer@*/ const char * osuffix;    
00140 /*@observer@*/ const char * nsuffix;    
00141 /*@shared@*/ const char * suffix;       
00142     char sufbuf[64];    /* XXX eliminate */
00143 /*@only@*/ short * dnlx;                
00144 /*@only@*/ char * ldn;                  
00145     int ldnlen;                         
00146     int ldnalloc;                       
00147     int postpone;                       
00148     int diskchecked;                    
00149     int exists;                         
00150     int mkdirsdone;                     
00151     int astriplen;                      
00152     int rc;                             
00153     int commit;                         
00154     cpioMapFlags mapFlags;              
00155 /*@shared@*/ const char * dirName;      
00156 /*@shared@*/ const char * baseName;     
00157 /*@shared@*/ const char * fmd5sum;      
00158     unsigned fflags;                    
00159     fileAction action;                  
00160     fileStage goal;                     
00161     fileStage stage;                    
00162     struct stat sb;                     
00163     struct stat osb;                    
00164 };
00165 
00166 #ifdef __cplusplus
00167 extern "C" {
00168 #endif
00169 
00175 /*@observer@*/ const char *const fileStageString(fileStage a);
00176 
00182 /*@observer@*/ const char *const fileActionString(fileAction a);
00183 
00188 /*@only@*/ /*@null@*/ FSM_t newFSM(void);
00189 
00195 /*@null@*/ FSM_t freeFSM(/*@only@*/ /*@null@*/ FSM_t fsm);
00196 
00207 int fsmSetup(FSM_t fsm, fileStage goal,
00208         /*@kept@*/ const rpmTransactionSet ts,
00209         /*@kept@*/ const TFI_t fi,
00210         FD_t cfd,
00211         /*@out@*/ unsigned int * archiveSize,
00212         /*@out@*/ const char ** failedFile)
00213                 /*@modifies fsm, *archiveSize, *failedFile  @*/;
00214 
00220 int fsmTeardown(FSM_t fsm)
00221                 /*@modifies fsm @*/;
00222 
00228 /*@kept@*/ rpmTransactionSet fsmGetTs(const FSM_t fsm)  /*@*/;
00229 
00235 /*@kept@*/ TFI_t fsmGetFi(const FSM_t fsm)      /*@*/;
00236 
00241 int fsmMapPath(FSM_t fsm)
00242                 /*@modifies fsm @*/;
00243 
00248 int fsmMapAttrs(FSM_t fsm)
00249                 /*@modifies fsm @*/;
00250 
00257 int fsmStage(FSM_t fsm, fileStage stage)
00258                 /*@modifies fsm @*/;
00259 
00260 #ifdef __cplusplus
00261 }
00262 #endif
00263 
00264 #endif  /* H_FSM */

Generated at Thu Apr 19 15:29:42 2001 for rpm by doxygen1.2.6-20010408 written by Dimitri van Heesch, © 1997-2001