Lines Matching defs:fdt

51 int copy_bytes(int fdf, int fdt, uint64_t max_bytes, bool try_reflink) {
56 assert(fdt >= 0);
62 lseek(fdt, 0, SEEK_CUR) == 0) {
64 r = btrfs_reflink(fdf, fdt);
85 n = sendfile(fdt, fdf, NULL, m);
101 n = splice(fdf, NULL, fdt, NULL, m, 0);
125 r = loop_write(fdt, buf, (size_t) n, false);
162 _cleanup_close_ int fdf = -1, fdt = -1;
174 fdt = openat(dt, to, O_WRONLY|O_CREAT|O_EXCL|O_CLOEXEC|O_NOCTTY|O_NOFOLLOW, st->st_mode & 07777);
175 if (fdt < 0)
178 r = copy_bytes(fdf, fdt, (uint64_t) -1, true);
184 if (fchown(fdt, st->st_uid, st->st_gid) < 0)
187 if (fchmod(fdt, st->st_mode & 07777) < 0)
192 (void) futimens(fdt, ts);
194 (void) copy_xattr(fdf, fdt);
196 q = close(fdt);
197 fdt = -1;
256 _cleanup_close_ int fdf = -1, fdt = -1;
283 fdt = openat(dt, to, O_RDONLY|O_DIRECTORY|O_CLOEXEC|O_NOCTTY|O_NOFOLLOW);
284 if (fdt < 0)
295 if (fchown(fdt, st->st_uid, st->st_gid) < 0)
298 if (fchmod(fdt, st->st_mode & 07777) < 0)
301 (void) futimens(fdt, ut);
302 (void) copy_xattr(dirfd(d), fdt);
321 q = fd_copy_regular(dirfd(d), de->d_name, &buf, fdt, de->d_name);
323 q = fd_copy_directory(dirfd(d), de->d_name, &buf, fdt, de->d_name, original_device, merge);
325 q = fd_copy_symlink(dirfd(d), de->d_name, &buf, fdt, de->d_name);
327 q = fd_copy_fifo(dirfd(d), de->d_name, &buf, fdt, de->d_name);
329 q = fd_copy_node(dirfd(d), de->d_name, &buf, fdt, de->d_name);
343 int copy_tree_at(int fdf, const char *from, int fdt, const char *to, bool merge) {
353 return fd_copy_regular(fdf, from, &st, fdt, to);
355 return fd_copy_directory(fdf, from, &st, fdt, to, st.st_dev, merge);
357 return fd_copy_symlink(fdf, from, &st, fdt, to);
359 return fd_copy_fifo(fdf, from, &st, fdt, to);
361 return fd_copy_node(fdf, from, &st, fdt, to);
386 int copy_file_fd(const char *from, int fdt, bool try_reflink) {
391 assert(fdt >= 0);
397 r = copy_bytes(fdf, fdt, (uint64_t) -1, try_reflink);
399 (void) copy_times(fdf, fdt);
400 (void) copy_xattr(fdf, fdt);
406 int fdt = -1, r;
412 fdt = open(to, flags|O_WRONLY|O_CREAT|O_CLOEXEC|O_NOCTTY, mode);
413 if (fdt < 0)
418 (void) chattr_fd(fdt, chattr_flags, (unsigned) -1);
420 r = copy_file_fd(from, fdt, true);
422 close(fdt);
427 if (close(fdt) < 0) {
464 int copy_times(int fdf, int fdt) {
470 assert(fdt >= 0);
478 if (futimens(fdt, ut) < 0)
482 (void) fd_setcrtime(fdt, crtime);
487 int copy_xattr(int fdf, int fdt) {
539 if (fsetxattr(fdt, p, bufb, m, 0) < 0)