MCPcopy Create free account
hub / github.com/RsyncProject/rsync / maybe_hard_link

Function maybe_hard_link

hlink.c:210–242  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

208}
209
210static int maybe_hard_link(struct file_struct *file, int ndx,
211 char *fname, int statret, stat_x *sxp,
212 const char *oldname, STRUCT_STAT *old_stp,
213 const char *realname, int itemizing, enum logcode code)
214{
215 if (statret == 0) {
216 if (sxp->st.st_dev == old_stp->st_dev
217 && sxp->st.st_ino == old_stp->st_ino) {
218 if (itemizing) {
219 itemize(fname, file, ndx, statret, sxp,
220 ITEM_LOCAL_CHANGE | ITEM_XNAME_FOLLOWS,
221 0, "");
222 }
223 if (INFO_GTE(NAME, 2) && maybe_ATTRS_REPORT)
224 rprintf(FCLIENT, "%s is uptodate\n", fname);
225 file->flags |= FLAG_HLINK_DONE;
226 return 0;
227 }
228 }
229
230 if (atomic_create(file, fname, NULL, oldname, MAKEDEV(0, 0), sxp, statret == 0 ? DEL_FOR_FILE : 0)) {
231 if (itemizing) {
232 itemize(fname, file, ndx, statret, sxp,
233 ITEM_LOCAL_CHANGE | ITEM_XNAME_FOLLOWS, 0,
234 realname);
235 }
236 if (code != FNONE && INFO_GTE(NAME, 1))
237 rprintf(code, "%s => %s\n", fname, realname);
238 return 0;
239 }
240
241 return -1;
242}
243
244/* Figure out if a prior entry is still there or if we just have a
245 * cached name for it. */

Callers 2

hard_link_checkFunction · 0.85
finish_hard_linkFunction · 0.85

Calls 3

itemizeFunction · 0.85
atomic_createFunction · 0.85
rprintfFunction · 0.70

Tested by

no test coverage detected