batch.c

ソースコードを見る。


関数

void write_stream_flags (int fd)
void read_stream_flags (int fd)
static void write_arg (int fd, char *arg)
static void write_filter_rules (int fd)
void write_batch_shell_file (int argc, char *argv[], int file_arg_cnt)

変数

int eol_nulls
int recurse
int xfer_dirs
int preserve_links
int preserve_hard_links
int preserve_devices
int preserve_uid
int preserve_gid
int always_checksum
int do_compression
int def_compress_level
int protocol_version
char * batch_name
filter_list_struct filter_list
static int tweaked_compress_level
static int * flag_ptr []
static char * flag_name []

関数

void write_stream_flags ( int  fd  ) 

batch.c56 行で定義されています。

参照先 def_compress_leveldo_compressionflag_ptrprotocol_versiontweaked_compress_levelwrite_int().

参照元 start_write_batch().

00057 {
00058         int i, flags;
00059 
00060 #if Z_DEFAULT_COMPRESSION == -1
00061         tweaked_compress_level = do_compression ? def_compress_level + 2 : 0;
00062 #else
00063 #error internal logic error!  Fix def_compress_level logic above and below too!
00064 #endif
00065 
00066         /* Start the batch file with a bitmap of data-stream-affecting
00067          * flags. */
00068         if (protocol_version < 29)
00069                 flag_ptr[7] = NULL;
00070         for (i = 0, flags = 0; flag_ptr[i]; i++) {
00071                 if (*flag_ptr[i])
00072                         flags |= 1 << i;
00073         }
00074         write_int(fd, flags);
00075 }

void read_stream_flags ( int  fd  ) 

batch.c77 行で定義されています。

参照先 def_compress_leveldo_compressionFINFOflag_nameflag_ptrprotocol_versionread_int()recurserprintf()tweaked_compress_levelverbosexfer_dirs.

参照元 main().

00078 {
00079         int i, flags;
00080 
00081         if (protocol_version < 29)
00082                 flag_ptr[7] = NULL;
00083         for (i = 0, flags = read_int(fd); flag_ptr[i]; i++) {
00084                 int set = flags & (1 << i) ? 1 : 0;
00085                 if (*flag_ptr[i] != set) {
00086                         if (verbose) {
00087                                 rprintf(FINFO,
00088                                         "%sing the %s option to match the batchfile.\n",
00089                                         set ? "Sett" : "Clear", flag_name[i]);
00090                         }
00091                         *flag_ptr[i] = set;
00092                 }
00093         }
00094         if (protocol_version < 29) {
00095                 if (recurse)
00096                         xfer_dirs |= 1;
00097                 else if (xfer_dirs < 2)
00098                         xfer_dirs = 0;
00099         }
00100 
00101         if (tweaked_compress_level == 0 || tweaked_compress_level == 2)
00102                 do_compression = 0;
00103         else {
00104                 do_compression = 1;
00105                 def_compress_level = tweaked_compress_level - 2;
00106         }
00107 }

static void write_arg ( int  fd,
char *  arg 
) [static]

batch.c109 行で定義されています。

参照先 strpbrk().

参照元 write_batch_shell_file().

00110 {
00111         char *x, *s;
00112 
00113         if (*arg == '-' && (x = strchr(arg, '=')) != NULL) {
00114                 write(fd, arg, x - arg + 1);
00115                 arg += x - arg + 1;
00116         }
00117 
00118         if (strpbrk(arg, " \"'&;|[]()$#!*?^\\") != NULL) {
00119                 write(fd, "'", 1);
00120                 for (s = arg; (x = strchr(s, '\'')) != NULL; s = x + 1) {
00121                         write(fd, s, x - s + 1);
00122                         write(fd, "'", 1);
00123                 }
00124                 write(fd, s, strlen(s));
00125                 write(fd, "'", 1);
00126                 return;
00127         }
00128 
00129         write(fd, arg, strlen(arg));
00130 }

static void write_filter_rules ( int  fd  )  [static]

batch.c132 行で定義されています。

参照先 eol_nullsfilter_listget_rule_prefix()filter_list_struct::headfilter_struct::match_flagsfilter_struct::nextfilter_struct::patternwrite_buf()write_byte()write_sbuf().

参照元 write_batch_shell_file().

00133 {
00134         struct filter_struct *ent;
00135 
00136         write_sbuf(fd, " <<'#E#'\n");
00137         for (ent = filter_list.head; ent; ent = ent->next) {
00138                 unsigned int plen;
00139                 char *p = get_rule_prefix(ent->match_flags, "- ", 0, &plen);
00140                 write_buf(fd, p, plen);
00141                 write_sbuf(fd, ent->pattern);
00142                 if (ent->match_flags & MATCHFLG_DIRECTORY)
00143                         write_byte(fd, '/');
00144                 write_byte(fd, eol_nulls ? 0 : '\n');
00145         }
00146         if (eol_nulls)
00147                 write_sbuf(fd, ";\n");
00148         write_sbuf(fd, "#E#");
00149 }

void write_batch_shell_file ( int  argc,
char *  argv[],
int  file_arg_cnt 
)

batch.c156 行で定義されています。

参照先 batch_namecheck_for_hostspec()do_open()errnoFERRORfilter_listfilter_list_struct::headprotocol_versionrsyserr()stringjoin()write_arg()write_byte()write_filter_rules()write_sbuf().

参照元 main().

00157 {
00158         int fd, i, len;
00159         char *p, filename[MAXPATHLEN];
00160 
00161         stringjoin(filename, sizeof filename,
00162                    batch_name, ".sh", NULL);
00163         fd = do_open(filename, O_WRONLY | O_CREAT | O_TRUNC,
00164                      S_IRUSR | S_IWUSR | S_IEXEC);
00165         if (fd < 0) {
00166                 rsyserr(FERROR, errno, "Batch file %s open error",
00167                         filename);
00168                 exit_cleanup(1);
00169         }
00170 
00171         /* Write argvs info to BATCH.sh file */
00172         write_arg(fd, argv[0]);
00173         if (filter_list.head) {
00174                 if (protocol_version >= 29)
00175                         write_sbuf(fd, " --filter=._-");
00176                 else
00177                         write_sbuf(fd, " --exclude-from=-");
00178         }
00179         for (i = 1; i < argc - file_arg_cnt; i++) {
00180                 p = argv[i];
00181                 if (strncmp(p, "--files-from", 12) == 0
00182                     || strncmp(p, "--filter", 8) == 0
00183                     || strncmp(p, "--include", 9) == 0
00184                     || strncmp(p, "--exclude", 9) == 0) {
00185                         if (strchr(p, '=') == NULL)
00186                                 i++;
00187                         continue;
00188                 }
00189                 if (strcmp(p, "-f") == 0) {
00190                         i++;
00191                         continue;
00192                 }
00193                 write(fd, " ", 1);
00194                 if (strncmp(p, "--write-batch", len = 13) == 0
00195                  || strncmp(p, "--only-write-batch", len = 18) == 0) {
00196                         write(fd, "--read-batch", 12);
00197                         if (p[len] == '=') {
00198                                 write(fd, "=", 1);
00199                                 write_arg(fd, p + len + 1);
00200                         }
00201                 } else
00202                         write_arg(fd, p);
00203         }
00204         if (!(p = check_for_hostspec(argv[argc - 1], &p, &i)))
00205                 p = argv[argc - 1];
00206         write(fd, " ${1:-", 6);
00207         write_arg(fd, p);
00208         write_byte(fd, '}');
00209         if (filter_list.head)
00210                 write_filter_rules(fd);
00211         if (write(fd, "\n", 1) != 1 || close(fd) < 0) {
00212                 rsyserr(FERROR, errno, "Batch file %s write error",
00213                         filename);
00214                 exit_cleanup(1);
00215         }
00216 }


変数

int eol_nulls

options.c90 行で定義されています。

参照元 parse_filter_file()read_filesfrom_line()read_timeout()server_options()write_filter_rules().

int recurse

options.c92 行で定義されています。

参照元 do_server_sender()get_dirlist()parse_arguments()read_stream_flags()receive_file_entry()send_directory()send_file_list()send_filter_list()server_options().

int xfer_dirs

options.c93 行で定義されています。

参照元 get_dirlist()make_file()parse_arguments()read_stream_flags()send_file_list()server_options()show_filelist_p().

int preserve_links

options.c46 行で定義されています。

int preserve_hard_links

options.c47 行で定義されています。

参照元 do_recv()flist_new()generate_files()handle_delayed_updates()parse_arguments()read_msg_fd()receive_file_entry()recv_files()recv_generator()server_options()try_dests_non()try_dests_reg().

int preserve_devices

options.c52 行で定義されています。

int preserve_uid

options.c54 行で定義されています。

参照元 itemize()output_flist()parse_arguments()receive_file_entry()recv_uid_list()send_file_entry()send_uid_list()server_options()set_file_attrs()unchanged_attrs().

int preserve_gid

options.c55 行で定義されています。

参照元 itemize()output_flist()parse_arguments()receive_file_entry()recv_uid_list()send_file_entry()send_uid_list()server_options()set_file_attrs()unchanged_attrs().

int always_checksum

options.c168 行で定義されています。

参照元 generate_files()make_file()receive_file_entry()recv_generator()send_file_entry()server_options()try_dests_reg()unchanged_file().

int do_compression

options.c72 行で定義されています。

参照元 parse_arguments()read_stream_flags()recv_token()see_token()send_token()server_options()set_compression()write_stream_flags().

int def_compress_level

options.c73 行で定義されています。

参照元 parse_arguments()read_stream_flags()server_options()set_compression()write_stream_flags().

int protocol_version

mdfour.c209 行で定義されています。

参照元 clean_flist()client_run()do_recv()do_server_sender()f_name_cmp()file_checksum()file_checksum1()flist_find()generate_files()get_checksum2()get_rule_prefix()handle_stats()init_flist()itemize()log_delete()make_file()maybe_send_keepalive()mdfour_tail()read_final_goodbye()read_item_attrs()read_stream_flags()read_sum_head()receive_file_entry()recv_file_list()recv_files()recv_filter_list()rsync_module()send_file_entry()send_files()send_filter_list()send_listing()send_rules()setup_protocol()start_daemon()start_inband_exchange()start_server()start_write_batch()sum_end()sum_sizes_sqroot()write_batch_shell_file()write_ndx_and_attrs()write_stream_flags()write_sum_head().

char* batch_name

options.c172 行で定義されています。

参照元 main()parse_arguments()write_batch_shell_file().

struct filter_list_struct filter_list

exclude.c49 行で定義されています。

参照元 is_excluded()parse_arguments()recv_filter_list()send_filter_list()write_batch_shell_file()write_filter_rules().

int tweaked_compress_level [static]

batch.c28 行で定義されています。

参照元 read_stream_flags()write_stream_flags().

int* flag_ptr[] [static]

初期値:

batch.c30 行で定義されています。

参照元 read_stream_flags()write_stream_flags().

char* flag_name[] [static]

初期値:

 {
        "--recurse (-r)",
        "--owner (-o)",
        "--group (-g)",
        "--links (-l)",
        "--devices (-D)",
        "--hard-links (-H)",
        "--checksum (-c)",
        "--dirs (-d)",
        "--compress (-z)",
        NULL
}

batch.c43 行で定義されています。

参照元 read_stream_flags().


rsyncに対してSat Dec 5 19:45:43 2009に生成されました。  doxygen 1.4.7