]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
pybind/cephfs: add python binding for symlinkat()
authorRishabh Dave <ridave@redhat.com>
Wed, 5 Nov 2025 08:55:54 +0000 (14:25 +0530)
committerRishabh Dave <ridave@redhat.com>
Thu, 16 Apr 2026 12:39:54 +0000 (18:09 +0530)
Signed-off-by: Rishabh Dave <ridave@redhat.com>
src/pybind/cephfs/c_cephfs.pxd
src/pybind/cephfs/cephfs.pyx
src/pybind/cephfs/mock_cephfs.pxi

index e177d00d9961e89693b84c20a053822c1527c0e4..dd6326527b26b1978b322c922cd1baa038ab8a1c 100644 (file)
@@ -113,6 +113,7 @@ cdef extern from "cephfs/libcephfs.h" nogil:
     int ceph_unlink(ceph_mount_info *cmount, const char *path)
     int ceph_unlinkat(ceph_mount_info *cmount, int dirfd, const char *relpath, int flags)
     int ceph_symlink(ceph_mount_info *cmount, const char *existing, const char *newname)
+    int ceph_symlinkat(ceph_mount_info *cmount, const char *existing, int fd, const char *newname)
     int ceph_readlink(ceph_mount_info *cmount, const char *path, char *buf, int64_t size)
     int ceph_readlinkat(ceph_mount_info *cmount, const int dirfd, char *path, char *buf, int64_t size)
     int ceph_setxattr(ceph_mount_info *cmount, const char *path, const char *name,
index adafd4d876e3c2f8b3551ccbe42fafed36b70362..e49d62f24e90726b8250c5046be5f43decd9e323 100644 (file)
@@ -2349,7 +2349,26 @@ cdef class LibCephFS(object):
             ret = ceph_symlink(self.cluster, _existing, _newname)
         if ret < 0:
             raise make_ex(ret, "error in symlink")
-    
+
+    def symlinkat(self, existing, fd, newname):
+        self.require_state("mounted")
+
+        if not isinstance(fd, int):
+            raise TypeError('"fd" must be of type int')
+
+        existing = cstr(existing, 'existing')
+        newname = cstr(newname, 'newname')
+        cdef:
+            int _fd = fd
+            char* _existing = existing
+            char* _newname = newname
+
+        with nogil:
+            ret = ceph_symlinkat(self.cluster, _existing, _fd, _newname)
+
+        if ret < 0:
+            raise make_ex(ret, "error in symlinkat")
+
     def link(self, existing, newname):
         """
         Create a link.
index 19cafd04e1b5b6e0b07983bef86d8e19445adb40..12075cb77c2ebdc0bdf76a21e79d1bc693bc158e 100644 (file)
@@ -143,6 +143,9 @@ cdef nogil:
         pass
     int ceph_symlink(ceph_mount_info *cmount, const char *existing, const char *newname):
         pass
+    int ceph_symlinkat(ceph_mount_info *cmount, const char *existing, int fd,
+                       const char *newname):
+        pass
     int ceph_readlink(ceph_mount_info *cmount, const char *path, char *buf, int64_t size):
         pass
     int ceph_readlinkat(ceph_mount_info *cmount, const int dirfd, char *path,