[libcxx-commits] [PATCH] D60880: [libc++] Use COPYFILE_CLONE from the macOS copyfile(3) API to support APFS clones

Adrian Prantl via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Apr 18 14:07:43 PDT 2019


aprantl added inline comments.


================
Comment at: libcxx/src/filesystem/operations.cpp:681
   CopyFileState cfs;
-  if (fcopyfile(read_fd.fd, write_fd.fd, cfs.state, COPYFILE_DATA) < 0) {
+  if (fcopyfile(read_fd.fd, write_fd.fd, cfs.state, COPYFILE_CLONE) < 0) {
     ec = capture_errno();
----------------
ldionne wrote:
> aprantl wrote:
> > It looks like you may be able to pass `nullptr` as the third parameter if you don't need the state afterwards.
> Hmm, I think that's correct:
> 
> > If the state parameter is the return value from `copyfile_state_alloc()`, then `copyfile()` and `fcopyfile()` will use the information from the state object; if it is `NULL`, then both functions will work normally, but less control will be available to the caller.
> 
> So we could get rid of the `CopyFileState` helper and instead just pass `nullptr` -- is that your suggestion?
> 
Yes.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D60880/new/

https://reviews.llvm.org/D60880





More information about the libcxx-commits mailing list