| 62 | } |
| 63 | |
| 64 | int match_stat_data(const struct stat_data *sd, struct stat *st) |
| 65 | { |
| 66 | int changed = 0; |
| 67 | struct repo_config_values *cfg = repo_config_values(the_repository); |
| 68 | |
| 69 | if (sd->sd_mtime.sec != (unsigned int)st->st_mtime) |
| 70 | changed |= MTIME_CHANGED; |
| 71 | if (cfg->trust_ctime && cfg->check_stat && |
| 72 | sd->sd_ctime.sec != (unsigned int)st->st_ctime) |
| 73 | changed |= CTIME_CHANGED; |
| 74 | |
| 75 | #ifdef USE_NSEC |
| 76 | if (cfg->check_stat && sd->sd_mtime.nsec != ST_MTIME_NSEC(*st)) |
| 77 | changed |= MTIME_CHANGED; |
| 78 | if (cfg->trust_ctime && cfg->check_stat && |
| 79 | sd->sd_ctime.nsec != ST_CTIME_NSEC(*st)) |
| 80 | changed |= CTIME_CHANGED; |
| 81 | #endif |
| 82 | |
| 83 | if (cfg->check_stat) { |
| 84 | if (sd->sd_uid != (unsigned int) st->st_uid || |
| 85 | sd->sd_gid != (unsigned int) st->st_gid) |
| 86 | changed |= OWNER_CHANGED; |
| 87 | if (sd->sd_ino != (unsigned int) st->st_ino) |
| 88 | changed |= INODE_CHANGED; |
| 89 | } |
| 90 | |
| 91 | #ifdef USE_STDEV |
| 92 | /* |
| 93 | * st_dev breaks on network filesystems where different |
| 94 | * clients will have different views of what "device" |
| 95 | * the filesystem is on |
| 96 | */ |
| 97 | if (cfg->check_stat && sd->sd_dev != (unsigned int) st->st_dev) |
| 98 | changed |= INODE_CHANGED; |
| 99 | #endif |
| 100 | |
| 101 | if (sd->sd_size != munge_st_size(st->st_size)) |
| 102 | changed |= DATA_CHANGED; |
| 103 | |
| 104 | return changed; |
| 105 | } |
| 106 | |
| 107 | void stat_validity_clear(struct stat_validity *sv) |
| 108 | { |