1 /* 2 * CPDUP.H 3 * 4 * $DragonFly: src/bin/cpdup/cpdup.h,v 1.9 2008/04/14 05:40:51 dillon Exp $ 5 */ 6 7 #include <sys/param.h> 8 #include <sys/time.h> 9 #include <sys/stat.h> 10 #include <sys/file.h> 11 12 #include <fcntl.h> 13 #include <stdio.h> 14 #include <stdlib.h> 15 #include <stdarg.h> 16 #include <stddef.h> 17 #include <stdint.h> 18 #include <string.h> 19 #include <errno.h> 20 #include <unistd.h> 21 #include <utime.h> 22 #include <dirent.h> 23 #include <signal.h> 24 #include <pwd.h> 25 #include <fnmatch.h> 26 #include <assert.h> 27 #ifndef NOMD5 28 #include <md5.h> 29 #endif 30 31 /* Solaris needs <strings.h> for bzero(), bcopy() and bcmp(). */ 32 #include <strings.h> 33 34 #ifdef __sun 35 #include "compat_sun.h" 36 #endif 37 38 #ifdef __linux 39 #define __printflike(a,b) 40 #define __printf0like(a,b) 41 #define __aligned(x) 42 #define __unused 43 #endif 44 45 void logstd(const char *ctl, ...) __printflike(1, 2); 46 void logerr(const char *ctl, ...) __printflike(1, 2); 47 char *mprintf(const char *ctl, ...) __printflike(1, 2); 48 void fatal(const char *ctl, ...) __printf0like(1, 2); 49 char *fextract(FILE *fi, int n, int *pc, int skip); 50 51 int16_t hc_bswap16(int16_t var); 52 int32_t hc_bswap32(int32_t var); 53 int64_t hc_bswap64(int64_t var); 54 55 int fsmid_check(int64_t fsmid, const char *dpath); 56 void fsmid_flush(void); 57 #ifndef NOMD5 58 int md5_check(const char *spath, const char *dpath); 59 void md5_flush(void); 60 #endif 61 62 extern const char *UseCpFile; 63 extern const char *MD5CacheFile; 64 extern const char *FSMIDCacheFile; 65 extern const char *UseHLPath; 66 67 extern int AskConfirmation; 68 extern int SafetyOpt; 69 extern int ForceOpt; 70 extern int DeviceOpt; 71 extern int VerboseOpt; 72 extern int DirShowOpt; 73 extern int QuietOpt; 74 extern int NotForRealOpt; 75 extern int NoRemoveOpt; 76 extern int UseMD5Opt; 77 extern int UseFSMIDOpt; 78 extern int SlaveOpt; 79 extern int SummaryOpt; 80 extern int CompressOpt; 81 extern int ReadOnlyOpt; 82 extern int DstRootPrivs; 83 extern int ValidateOpt; 84 85 extern int ssh_argc; 86 extern const char *ssh_argv[]; 87 88 extern int64_t CountSourceBytes; 89 extern int64_t CountSourceItems; 90 extern int64_t CountCopiedItems; 91 extern int64_t CountSourceReadBytes; 92 extern int64_t CountTargetReadBytes; 93 extern int64_t CountWriteBytes; 94 extern int64_t CountRemovedItems; 95 extern int64_t CountLinkedItems; 96 97 #ifdef DEBUG_MALLOC 98 void *debug_malloc(size_t bytes, const char *file, int line); 99 void debug_free(void *ptr); 100 101 #define malloc(bytes) debug_malloc(bytes, __FILE__, __LINE__) 102 #define free(ptr) debug_free(ptr) 103 #endif 104