From: Anoop C S Date: Tue, 16 Jan 2024 06:17:27 +0000 (+0530) Subject: vfs_ceph: Use ceph_fdopendir() when available for SMB_VFS_FDOPENDIR X-Git-Tag: talloc-2.4.2~7 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6e6d8384f369e2b850921c7b4d54742f501c115c;p=thirdparty%2Fsamba.git vfs_ceph: Use ceph_fdopendir() when available for SMB_VFS_FDOPENDIR Signed-off-by: Anoop C S Reviewed-by: Guenther Deschner Autobuild-User(master): Günther Deschner Autobuild-Date(master): Sat Jan 27 00:01:12 UTC 2024 on atb-devel-224 --- diff --git a/source3/modules/vfs_ceph.c b/source3/modules/vfs_ceph.c index 4387918198e..c9ee5414f03 100644 --- a/source3/modules/vfs_ceph.c +++ b/source3/modules/vfs_ceph.c @@ -438,9 +438,15 @@ static DIR *cephwrap_fdopendir(struct vfs_handle_struct *handle, { int ret = 0; struct ceph_dir_result *result = NULL; - DBG_DEBUG("[CEPH] fdopendir(%p, %p)\n", handle, fsp); +#ifdef HAVE_CEPH_FDOPENDIR + int dirfd = fsp_get_io_fd(fsp); + DBG_DEBUG("[CEPH] fdopendir(%p, %d)\n", handle, dirfd); + ret = ceph_fdopendir(handle->data, dirfd, &result); +#else + DBG_DEBUG("[CEPH] fdopendir(%p, %p)\n", handle, fsp); ret = ceph_opendir(handle->data, fsp->fsp_name->base_name, &result); +#endif if (ret < 0) { result = NULL; errno = -ret; /* We return result which is NULL in this case */ diff --git a/source3/wscript b/source3/wscript index b76ced59aa4..83aeb763ec4 100644 --- a/source3/wscript +++ b/source3/wscript @@ -1681,7 +1681,8 @@ int main(void) { headers='cephfs/libcephfs.h') conf.DEFINE('HAVE_MANDATORY_CEPH_API', '1') for api in ['ceph_mkdirat', 'ceph_openat', 'ceph_unlinkat', - 'ceph_symlinkat', 'ceph_readlinkat', 'ceph_statxat']: + 'ceph_symlinkat', 'ceph_readlinkat', 'ceph_statxat', + 'ceph_fdopendir']: if not conf.CHECK_FUNCS_IN(api, 'cephfs', headers='cephfs/libcephfs.h'): conf.undefine('HAVE_MANDATORY_CEPH_API')