Skip to content

Commit 53ef9b1

Browse files
committed
Merge PR ceph#62934 into main
* refs/pull/62934/head: libcephfs / pybind: use uid_t and gid_t instead of int Reviewed-by: Dhairya Parmar <[email protected]> Reviewed-by: Venky Shankar <[email protected]>
2 parents 63db0db + 65328ac commit 53ef9b1

File tree

4 files changed

+12
-10
lines changed

4 files changed

+12
-10
lines changed

src/include/cephfs/libcephfs.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,7 +1148,7 @@ int ceph_chmodat(struct ceph_mount_info *cmount, int dirfd, const char *relpath,
11481148
* @param gid the group id to set on the file/directory.
11491149
* @returns 0 on success or negative error code on failure.
11501150
*/
1151-
int ceph_chown(struct ceph_mount_info *cmount, const char *path, int uid, int gid);
1151+
int ceph_chown(struct ceph_mount_info *cmount, const char *path, uid_t uid, gid_t gid);
11521152

11531153
/**
11541154
* 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
11591159
* @param gid the group id to set on the file/directory.
11601160
* @returns 0 on success or negative error code on failure.
11611161
*/
1162-
int ceph_fchown(struct ceph_mount_info *cmount, int fd, int uid, int gid);
1162+
int ceph_fchown(struct ceph_mount_info *cmount, int fd, uid_t uid, gid_t gid);
11631163

11641164
/**
11651165
* 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);
11701170
* @param gid the group id to set on the file/directory.
11711171
* @returns 0 on success or negative error code on failure.
11721172
*/
1173-
int ceph_lchown(struct ceph_mount_info *cmount, const char *path, int uid, int gid);
1173+
int ceph_lchown(struct ceph_mount_info *cmount, const char *path, uid_t uid, gid_t gid);
11741174

11751175
/**
11761176
* Change the ownership of a file/directory releative to a file descriptor.

src/libcephfs.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1314,21 +1314,21 @@ extern "C" int ceph_chmodat(struct ceph_mount_info *cmount, int dirfd, const cha
13141314
}
13151315

13161316
extern "C" int ceph_chown(struct ceph_mount_info *cmount, const char *path,
1317-
int uid, int gid)
1317+
uid_t uid, gid_t gid)
13181318
{
13191319
if (!cmount->is_mounted())
13201320
return -ENOTCONN;
13211321
return cmount->get_client()->chown(path, uid, gid, cmount->default_perms);
13221322
}
13231323
extern "C" int ceph_fchown(struct ceph_mount_info *cmount, int fd,
1324-
int uid, int gid)
1324+
uid_t uid, gid_t gid)
13251325
{
13261326
if (!cmount->is_mounted())
13271327
return -ENOTCONN;
13281328
return cmount->get_client()->fchown(fd, uid, gid, cmount->default_perms);
13291329
}
13301330
extern "C" int ceph_lchown(struct ceph_mount_info *cmount, const char *path,
1331-
int uid, int gid)
1331+
uid_t uid, gid_t gid)
13321332
{
13331333
if (!cmount->is_mounted())
13341334
return -ENOTCONN;

src/pybind/cephfs/cephfs.pyx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1293,8 +1293,8 @@ cdef class LibCephFS(object):
12931293

12941294
cdef:
12951295
char* _path = path
1296-
int _uid = uid
1297-
int _gid = gid
1296+
uid_t _uid = uid
1297+
gid_t _gid = gid
12981298
if follow_symlink:
12991299
with nogil:
13001300
ret = ceph_chown(self.cluster, _path, _uid, _gid)
@@ -1332,8 +1332,8 @@ cdef class LibCephFS(object):
13321332

13331333
cdef:
13341334
int _fd = fd
1335-
int _uid = uid
1336-
int _gid = gid
1335+
uid_t _uid = uid
1336+
gid_t _gid = gid
13371337
with nogil:
13381338
ret = ceph_fchown(self.cluster, _fd, _uid, _gid)
13391339
if ret < 0:

src/pybind/cephfs/types.pxd

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ cdef extern from "<utime.h>":
1212
cdef extern from "sys/types.h":
1313
ctypedef unsigned long mode_t
1414
ctypedef unsigned long dev_t
15+
ctypedef unsigned int uid_t;
16+
ctypedef unsigned int gid_t;
1517

1618
cdef extern from "sys/time.h":
1719
cdef struct timeval:

0 commit comments

Comments
 (0)