Skip to content

Commit

Permalink
fs: system: cleanup reflink (#235)
Browse files Browse the repository at this point in the history
* fs: system: cleanup reflink

Per https://github.com/iterative/dvc-objects/pull/234/files#r1416499169

* Update system.py

* Update system.py
  • Loading branch information
efiop authored Dec 6, 2023
1 parent dc95f2e commit 5e37397
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/dvc_objects/fs/system.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import ctypes
import errno
import logging
import os
Expand Down Expand Up @@ -39,8 +40,6 @@ def symlink(source: "AnyFSPath", link_name: "AnyFSPath") -> None:

@functools.lru_cache(maxsize=1)
def _clonefile():
import ctypes

def _cdll(name):
return ctypes.CDLL(name, use_errno=True)

Expand All @@ -67,15 +66,14 @@ def _cdll(name):
"'clonefile' not supported by the standard library",
)

clonefile.argtypes = [ctypes.c_char_p, ctypes.c_char_p, ctypes.c_int]
clonefile.restype = ctypes.c_int

return clonefile


def _reflink_darwin(src: "AnyFSPath", dst: "AnyFSPath") -> None:
import ctypes

clonefile = _clonefile()
clonefile.argtypes = [ctypes.c_char_p, ctypes.c_char_p, ctypes.c_int]
clonefile.restype = ctypes.c_int

ret = clonefile(
ctypes.c_char_p(os.fsencode(src)),
Expand Down

0 comments on commit 5e37397

Please sign in to comment.