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     struct stat sb;
00094     int nlink;
00095     int linksLeft;
00096     int linkIndex;
00097     int createdPath;
00098 };
00099 
00103 struct fsmIterator_s {
00104 /*@kept@*/ rpmTransactionSet ts;        
00105 /*@kept@*/ TFI_t fi;                    
00106     int reverse;                        
00107     int isave;                          
00108     int i;                              
00109 };
00110 
00114 struct fsm_s {
00115 /*@owned@*/ const char * path;          
00116 /*@owned@*/ const char * opath;         
00117     FD_t cfd;                           
00118     FD_t rfd;                           
00119 /*@dependent@*/ char * rdbuf;           
00120 /*@owned@*/ char * rdb;                 
00121     size_t rdsize;                      
00122     size_t rdlen;                       
00123     size_t rdnb;                        
00124     FD_t wfd;                           
00125 /*@dependent@*/ char * wrbuf;           
00126 /*@owned@*/ char * wrb;                 
00127     size_t wrsize;                      
00128     size_t wrlen;                       
00129     size_t wrnb;                        
00130 /*@only@*/ FSMI_t iter;                 
00131     int ix;                             
00132 /*@only@*/ struct hardLink * links;     
00133 /*@only@*/ struct hardLink * li;        
00134 /*@kept@*/ /*@null@*/ unsigned int * archiveSize;       
00135 /*@kept@*/ /*@null@*/ const char ** failedFile; 
00136 /*@shared@*/ const char * subdir;       
00137 /*@unused@*/ char subbuf[64];   /* XXX eliminate */
00138 /*@observer@*/ const char * osuffix;    
00139 /*@observer@*/ const char * nsuffix;    
00140 /*@shared@*/ const char * suffix;       
00141     char sufbuf[64];    /* XXX eliminate */
00142 /*@only@*/ /*@null@*/ short * dnlx;     
00143 /*@only@*/ /*@null@*/ char * ldn;       
00144     int ldnlen;                         
00145     int ldnalloc;                       
00146     int postpone;                       
00147     int diskchecked;                    
00148     int exists;                         
00149     int mkdirsdone;                     
00150     int astriplen;                      
00151     int rc;                             
00152     int commit;                         
00153     cpioMapFlags mapFlags;              
00154 /*@shared@*/ const char * dirName;      
00155 /*@shared@*/ const char * baseName;     
00156 /*@shared@*/ const char * fmd5sum;      
00157     unsigned fflags;                    
00158     fileAction action;                  
00159     fileStage goal;                     
00160     fileStage stage;                    
00161     struct stat sb;                     
00162     struct stat osb;                    
00163 };
00164 
00165 #ifdef __cplusplus
00166 extern "C" {
00167 #endif
00168 
00169 /*@-exportlocal@*/
00175 /*@observer@*/ const char *const fileStageString(fileStage a)   /*@*/;
00176 
00182 /*@observer@*/ const char *const fileActionString(fileAction a) /*@*/;
00183 /*@=exportlocal@*/
00184 
00189 /*@only@*/ FSM_t newFSM(void)
00190         /*@*/;
00191 
00197 /*@null@*/ FSM_t freeFSM(/*@only@*/ /*@null@*/ FSM_t fsm)
00198         /*@modifies fsm @*/;
00199 
00210 int fsmSetup(FSM_t fsm, fileStage goal,
00211                 /*@kept@*/ const rpmTransactionSet ts,
00212                 /*@kept@*/ const TFI_t fi,
00213                 FD_t cfd,
00214                 /*@out@*/ unsigned int * archiveSize,
00215                 /*@out@*/ const char ** failedFile)
00216         /*@modifies fsm, *archiveSize, *failedFile, fileSystem  @*/;
00217 
00223 int fsmTeardown(FSM_t fsm)
00224         /*@modifies fsm @*/;
00225 
00226 /*@-exportlocal@*/
00232 /*@kept@*/ rpmTransactionSet fsmGetTs(const FSM_t fsm)
00233         /*@*/;
00234 
00240 /*@kept@*/ TFI_t fsmGetFi(/*@partial@*/const FSM_t fsm)
00241         /*@*/;
00242 
00247 int fsmMapPath(FSM_t fsm)
00248         /*@modifies fsm @*/;
00249 
00254 int fsmMapAttrs(FSM_t fsm)
00255         /*@modifies fsm @*/;
00256 /*@=exportlocal@*/
00257 
00264 int fsmStage(/*@partial@*/ FSM_t fsm, fileStage stage)
00265         /*@modifies fsm, fileSystem @*/;
00266 
00267 #ifdef __cplusplus
00268 }
00269 #endif
00270 
00271 #endif  /* H_FSM */

Generated on Wed Mar 13 15:34:47 2002 for rpm by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002