]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
libcephfs / pybind: use uid_t and gid_t instead of int 62934/head
authorCecilia Lau <cecilialau6776@gmail.com>
Tue, 22 Apr 2025 22:12:28 +0000 (18:12 -0400)
committerCecilia Lau <cecilialau6776@gmail.com>
Tue, 22 Apr 2025 22:35:57 +0000 (18:35 -0400)
allows for setting uid/gid over 2^31-1 through libcephfs
Fixes: https://tracker.ceph.com/issues/71015
Signed-off-by: Cecilia Lau <cecilialau6776@gmail.com>
src/include/cephfs/libcephfs.h
src/libcephfs.cc
src/pybind/cephfs/cephfs.pyx
src/pybind/cephfs/types.pxd

index 0a08e89566cc82d3f25597b07d099699e4843d51..b75f279a0d9daa11b252b351fc4bed569d4ea83d 100644 (file)
@@ -1148,7 +1148,7 @@ int ceph_chmodat(struct ceph_mount_info *cmount, int dirfd, const char *relpath,
  * @param gid the group id to set on the file/directory.
  * @returns 0 on success or negative error code on failure.
  */
-int ceph_chown(struct ceph_mount_info *cmount, const char *path, int uid, int gid);
+int ceph_chown(struct ceph_mount_info *cmount, const char *path, uid_t uid, gid_t gid);
 
 /**
  * Change the ownership of a file from an open file descriptor.
@@ -1159,7 +1159,7 @@ int ceph_chown(struct ceph_mount_info *cmount, const char *path, int uid, int gi
  * @param gid the group id to set on the file/directory.
  * @returns 0 on success or negative error code on failure.
  */
-int ceph_fchown(struct ceph_mount_info *cmount, int fd, int uid, int gid);
+int ceph_fchown(struct ceph_mount_info *cmount, int fd, uid_t uid, gid_t gid);
 
 /**
  * Change the ownership of a file/directory, don't follow symlinks.
@@ -1170,7 +1170,7 @@ int ceph_fchown(struct ceph_mount_info *cmount, int fd, int uid, int gid);
  * @param gid the group id to set on the file/directory.
  * @returns 0 on success or negative error code on failure.
  */
-int ceph_lchown(struct ceph_mount_info *cmount, const char *path, int uid, int gid);
+int ceph_lchown(struct ceph_mount_info *cmount, const char *path, uid_t uid, gid_t gid);
 
 /**
  * Change the ownership of a file/directory releative to a file descriptor.
index 3c3cfe4d35af02be186ebc47356baaa6584837ae..767abb5c833a4e182355bf90c2200194eec75ba2 100644 (file)
@@ -1314,21 +1314,21 @@ extern "C" int ceph_chmodat(struct ceph_mount_info *cmount, int dirfd, const cha
 }
 
 extern "C" int ceph_chown(struct ceph_mount_info *cmount, const char *path,
-                         int uid, int gid)
+                         uid_t uid, gid_t gid)
 {
   if (!cmount->is_mounted())
     return -ENOTCONN;
   return cmount->get_client()->chown(path, uid, gid, cmount->default_perms);
 }
 extern "C" int ceph_fchown(struct ceph_mount_info *cmount, int fd,
-                          int uid, int gid)
+                          uid_t uid, gid_t gid)
 {
   if (!cmount->is_mounted())
     return -ENOTCONN;
   return cmount->get_client()->fchown(fd, uid, gid, cmount->default_perms);
 }
 extern "C" int ceph_lchown(struct ceph_mount_info *cmount, const char *path,
-                          int uid, int gid)
+                          uid_t uid, gid_t gid)
 {
   if (!cmount->is_mounted())
     return -ENOTCONN;
index 9a4b5c778b36cac2b3a29282e36906b3c4650d09..fb81732bea9829e09a6d6d7050c6c6d177863f7c 100644 (file)
@@ -1293,8 +1293,8 @@ cdef class LibCephFS(object):
 
         cdef:
             char* _path = path
-            int _uid = uid
-            int _gid = gid
+            uid_t _uid = uid
+            gid_t _gid = gid
         if follow_symlink:
             with nogil:
                 ret = ceph_chown(self.cluster, _path, _uid, _gid)
@@ -1332,8 +1332,8 @@ cdef class LibCephFS(object):
 
         cdef:
             int _fd = fd
-            int _uid = uid
-            int _gid = gid
+            uid_t _uid = uid
+            gid_t _gid = gid
         with nogil:
             ret = ceph_fchown(self.cluster, _fd, _uid, _gid)
         if ret < 0:
index d20ea87dc9cf0e31eac62e3d51e5e7ad185113ba..cbe31cbf4ba8031b7a17b23edbf06badfb9987d9 100644 (file)
@@ -12,6 +12,8 @@ cdef extern from "<utime.h>":
 cdef extern from "sys/types.h":
     ctypedef unsigned long mode_t
     ctypedef unsigned long dev_t
+    ctypedef unsigned int uid_t;
+    ctypedef unsigned int gid_t;
 
 cdef extern from "sys/time.h":
     cdef struct timeval: