📄 rsync.h
字号:
OFF_T p_offset; /* Window start */ OFF_T p_fd_offset; /* offset of cursor in fd ala lseek */ char *p; /* Window pointer */ int32 p_size; /* Largest window size we allocated */ int32 p_len; /* Latest (rounded) window size */ int32 def_window_size; /* Default window size */ int fd; /* File Descriptor */ int status; /* first errno from read errors */};#define MATCHFLG_WILD (1<<0) /* pattern has '*', '[', and/or '?' */#define MATCHFLG_WILD2 (1<<1) /* pattern has '**' */#define MATCHFLG_WILD2_PREFIX (1<<2) /* pattern starts with "**" */#define MATCHFLG_WILD3_SUFFIX (1<<3) /* pattern ends with "***" */#define MATCHFLG_ABS_PATH (1<<4) /* path-match on absolute path */#define MATCHFLG_INCLUDE (1<<5) /* this is an include, not an exclude */#define MATCHFLG_DIRECTORY (1<<6) /* this matches only directories */#define MATCHFLG_WORD_SPLIT (1<<7) /* split rules on whitespace */#define MATCHFLG_NO_INHERIT (1<<8) /* don't inherit these rules */#define MATCHFLG_NO_PREFIXES (1<<9) /* parse no prefixes from patterns */#define MATCHFLG_MERGE_FILE (1<<10)/* specifies a file to merge */#define MATCHFLG_PERDIR_MERGE (1<<11)/* merge-file is searched per-dir */#define MATCHFLG_EXCLUDE_SELF (1<<12)/* merge-file name should be excluded */#define MATCHFLG_FINISH_SETUP (1<<13)/* per-dir merge file needs setup */#define MATCHFLG_NEGATE (1<<14)/* rule matches when pattern does not */#define MATCHFLG_CVS_IGNORE (1<<15)/* rule was -C or :C */#define MATCHFLG_SENDER_SIDE (1<<16)/* rule applies to the sending side */#define MATCHFLG_RECEIVER_SIDE (1<<17)/* rule applies to the receiving side */#define MATCHFLG_CLEAR_LIST (1<<18)/* this item is the "!" token */#define MATCHFLG_PERISHABLE (1<<19)/* perishable if parent dir goes away */#define MATCHFLGS_FROM_CONTAINER (MATCHFLG_ABS_PATH | MATCHFLG_INCLUDE \ | MATCHFLG_DIRECTORY | MATCHFLG_SENDER_SIDE \ | MATCHFLG_NEGATE | MATCHFLG_RECEIVER_SIDE \ | MATCHFLG_PERISHABLE)struct filter_struct { struct filter_struct *next; char *pattern; uint32 match_flags; union { int slash_cnt; struct filter_list_struct *mergelist; } u;};struct filter_list_struct { struct filter_struct *head; struct filter_struct *tail; char *debug_type;};struct stats { int64 total_size; int64 total_transferred_size; int64 total_written; int64 total_read; int64 literal_data; int64 matched_data; int64 flist_buildtime; int64 flist_xfertime; int64 flist_size; int num_files; int num_transferred_files;};struct chmod_mode_struct;struct flist_ndx_item { struct flist_ndx_item *next; int ndx;};typedef struct { struct flist_ndx_item *head, *tail;} flist_ndx_list;#define EMPTY_ITEM_LIST {NULL, 0, 0}typedef struct { void *items; size_t count; size_t malloced;} item_list;#define EXPAND_ITEM_LIST(lp, type, incr) \ (type*)expand_item_list(lp, sizeof (type), #type, incr)#define EMPTY_XBUF {NULL, 0, 0, 0}typedef struct { char *buf; size_t pos; /* pos = read pos in the buf */ size_t len; /* len = chars following pos */ size_t size; /* size = total space in buf */} xbuf;#define INIT_XBUF(xb, str, ln, sz) (xb).buf = (str), (xb).len = (ln), (xb).size = (sz), (xb).pos = 0#define INIT_XBUF_STRLEN(xb, str) (xb).buf = (str), (xb).len = strlen((xb).buf), (xb).size = (-1), (xb).pos = 0/* This one is used to make an output xbuf based on a char[] buffer: */#define INIT_CONST_XBUF(xb, bf) (xb).buf = (bf), (xb).size = sizeof (bf), (xb).len = (xb).pos = 0#define ICB_EXPAND_OUT (1<<0)#define ICB_INCLUDE_BAD (1<<1)#define ICB_INCLUDE_INCOMPLETE (1<<2)#define RL_EOL_NULLS (1<<0)#define RL_DUMP_COMMENTS (1<<1)#define RL_CONVERT (1<<2)typedef struct { char name_type; char fname[1]; /* has variable size */} relnamecache;#include "byteorder.h"#include "lib/mdigest.h"#include "lib/wildmatch.h"#include "lib/permstring.h"#include "lib/addrinfo.h"#ifndef __GNUC__#define __attribute__(x)#else# if __GNUC__ <= 2# define NORETURN# endif#endif#define UNUSED(x) x __attribute__((__unused__))#ifndef NORETURN#define NORETURN __attribute__((__noreturn__))#endiftypedef struct { STRUCT_STAT st;#ifdef SUPPORT_ACLS struct rsync_acl *acc_acl; /* access ACL */ struct rsync_acl *def_acl; /* default ACL */#endif#ifdef SUPPORT_XATTRS item_list *xattr;#endif} stat_x;#define ACL_READY(sx) ((sx).acc_acl != NULL)#define XATTR_READY(sx) ((sx).xattr != NULL)#include "proto.h"#ifndef SUPPORT_XATTRS#define x_stat(fn,fst,xst) do_stat(fn,fst)#define x_lstat(fn,fst,xst) do_lstat(fn,fst)#define x_fstat(fd,fst,xst) do_fstat(fd,fst)#endif/* We have replacement versions of these if they're missing. */#ifndef HAVE_ASPRINTFint asprintf(char **ptr, const char *format, ...);#endif#ifndef HAVE_VASPRINTFint vasprintf(char **ptr, const char *format, va_list ap);#endif#if !defined HAVE_VSNPRINTF || !defined HAVE_C99_VSNPRINTF#define vsnprintf rsync_vsnprintfint vsnprintf(char *str, size_t count, const char *fmt, va_list args);#endif#if !defined HAVE_SNPRINTF || !defined HAVE_C99_VSNPRINTF#define snprintf rsync_snprintfint snprintf(char *str, size_t count, const char *fmt,...);#endif#ifndef HAVE_STRERRORextern char *sys_errlist[];#define strerror(i) sys_errlist[i]#endif#ifndef HAVE_STRCHR# define strchr index# define strrchr rindex#endif#ifndef HAVE_ERRNO_DECLextern int errno;#endif#ifdef HAVE_READLINK#define SUPPORT_LINKS 1#endif#ifdef HAVE_LINK#define SUPPORT_HARD_LINKS 1#endif#ifdef HAVE_SIGACTION#define SIGACTION(n,h) sigact.sa_handler=(h), sigaction((n),&sigact,NULL)#define signal(n,h) we_need_to_call_SIGACTION_not_signal(n,h)#else#define SIGACTION(n,h) signal(n,h)#endif#ifndef EWOULDBLOCK#define EWOULDBLOCK EAGAIN#endif#ifndef STDIN_FILENO#define STDIN_FILENO 0#endif#ifndef STDOUT_FILENO#define STDOUT_FILENO 1#endif#ifndef STDERR_FILENO#define STDERR_FILENO 2#endif#ifndef S_IRUSR#define S_IRUSR 0400#endif#ifndef S_IWUSR#define S_IWUSR 0200#endif#ifndef ACCESSPERMS#define ACCESSPERMS 0777#endif#ifndef S_ISVTX#define S_ISVTX 0#endif#define CHMOD_BITS (S_ISUID | S_ISGID | S_ISVTX | ACCESSPERMS)#ifndef _S_IFMT#define _S_IFMT 0170000#endif#ifndef _S_IFLNK#define _S_IFLNK 0120000#endif#ifndef S_ISLNK#define S_ISLNK(mode) (((mode) & (_S_IFMT)) == (_S_IFLNK))#endif#ifndef S_ISBLK#define S_ISBLK(mode) (((mode) & (_S_IFMT)) == (_S_IFBLK))#endif#ifndef S_ISCHR#define S_ISCHR(mode) (((mode) & (_S_IFMT)) == (_S_IFCHR))#endif#ifndef S_ISSOCK#ifdef _S_IFSOCK#define S_ISSOCK(mode) (((mode) & (_S_IFMT)) == (_S_IFSOCK))#else#define S_ISSOCK(mode) (0)#endif#endif#ifndef S_ISFIFO#ifdef _S_IFIFO#define S_ISFIFO(mode) (((mode) & (_S_IFMT)) == (_S_IFIFO))#else#define S_ISFIFO(mode) (0)#endif#endif#ifndef S_ISDIR#define S_ISDIR(mode) (((mode) & (_S_IFMT)) == (_S_IFDIR))#endif#ifndef S_ISREG#define S_ISREG(mode) (((mode) & (_S_IFMT)) == (_S_IFREG))#endif/* work out what fcntl flag to use for non-blocking */#ifdef O_NONBLOCK# define NONBLOCK_FLAG O_NONBLOCK#elif defined SYSV# define NONBLOCK_FLAG O_NDELAY#else# define NONBLOCK_FLAG FNDELAY#endif#ifndef INADDR_LOOPBACK#define INADDR_LOOPBACK 0x7f000001#endif#ifndef INADDR_NONE#define INADDR_NONE 0xffffffff#endif#define IS_SPECIAL(mode) (S_ISSOCK(mode) || S_ISFIFO(mode))#define IS_DEVICE(mode) (S_ISCHR(mode) || S_ISBLK(mode))/* Initial mask on permissions given to temporary files. Mask off setuid bits and group access because of potential race-condition security holes, and mask other access because mode 707 is bizarre */#define INITACCESSPERMS 0700/* handler for null strings in printf format */#define NS(s) ((s)?(s):"<NULL>")/* Convenient wrappers for malloc and realloc. Use them. */#define new(type) ((type*)malloc(sizeof (type)))#define new0(type) ((type*)calloc(1, sizeof (type)))#define new_array(type, num) ((type*)_new_array((num), sizeof (type), 0))#define new_array0(type, num) ((type*)_new_array((num), sizeof (type), 1))#define realloc_array(ptr, type, num) ((type*)_realloc_array((ptr), sizeof(type), (num)))/* use magic gcc attributes to catch format errors */ void rprintf(enum logcode , const char *, ...) __attribute__((format (printf, 2, 3)));/* This is just like rprintf, but it also tries to print some * representation of the error code. Normally errcode = errno. */void rsyserr(enum logcode, int, const char *, ...) __attribute__((format (printf, 3, 4))) ;/* Make sure that the O_BINARY flag is defined. */#ifndef O_BINARY#define O_BINARY 0#endif#ifndef HAVE_STRLCPYsize_t strlcpy(char *d, const char *s, size_t bufsize);#endif#ifndef HAVE_STRLCATsize_t strlcat(char *d, const char *s, size_t bufsize);#endif#ifndef WEXITSTATUS#define WEXITSTATUS(stat) ((int)(((stat)>>8)&0xFF))#endif#ifndef WIFEXITED#define WIFEXITED(stat) ((int)((stat)&0xFF) == 0)#endif#define exit_cleanup(code) _exit_cleanup(code, __FILE__, __LINE__)#ifdef HAVE_GETEUID#define MY_UID() geteuid()#else#define MY_UID() getuid()#endif#ifdef HAVE_GETEGID#define MY_GID() getegid()#else#define MY_GID() getgid()#endif#ifdef FORCE_FD_ZERO_MEMSET#undef FD_ZERO#define FD_ZERO(fdsetp) memset(fdsetp, 0, sizeof (fd_set))#endifextern int verbose;#ifndef HAVE_INET_NTOPconst char *inet_ntop(int af, const void *src, char *dst, size_t size);#endif#ifndef HAVE_INET_PTONint inet_pton(int af, const char *src, void *dst);#endif#ifdef MAINTAINER_MODEconst char *get_panic_action(void);#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -