+/* choose whether to skip a particular file */
+static int skip_file(char *fname,
+ struct file_struct *file, struct stat *st)
+{
+ if (st->st_size != file->length) {
+ return 0;
+ }
+
+ /* if always checksum is set then we use the checksum instead
+ of the file time to determine whether to sync */
+ if (always_checksum && S_ISREG(st->st_mode)) {
+ char sum[MD4_SUM_LENGTH];
+ file_checksum(fname,sum,st->st_size);
+ return (memcmp(sum,file->sum,csum_length) == 0);
+ }
+
+ if (ignore_times) {
+ return 0;
+ }
+
+ return (st->st_mtime == file->modtime);
+}
+
+
+/* use a larger block size for really big files */
+int adapt_block_size(struct file_struct *file, int bsize)
+{
+ int ret = file->length / (10000); /* rough heuristic */
+ ret = ret & ~15; /* multiple of 16 */
+ if (ret < bsize) ret = bsize;
+ if (ret > CHUNK_SIZE/2) ret = CHUNK_SIZE/2;
+ return ret;
+}
+