From: Shachar Sharon Date: Mon, 24 Jun 2024 10:33:05 +0000 (+0300) Subject: vfs_ceph_new: use low-level APIs for readdir ops X-Git-Tag: tdb-1.4.12~70 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=99c7179e5da6d201f03b1a04dbe2a6722090783d;p=thirdparty%2Fsamba.git vfs_ceph_new: use low-level APIs for readdir ops Implement readdir and rewinddir operations using libcephfs' low-level APIs. Casts the opaque DIR pointer into struct vfs_ceph_dirp (the first member of struct vfs_ceph_fh) to resolve the ceph_dir_result pointer which libcephfs expects for readdir operations. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15686 Signed-off-by: Shachar Sharon Reviewed-by: Guenther Deschner Reviewed-by: Anoop C S --- diff --git a/source3/modules/vfs_ceph_new.c b/source3/modules/vfs_ceph_new.c index 6ca80893afb..9259d597ffb 100644 --- a/source3/modules/vfs_ceph_new.c +++ b/source3/modules/vfs_ceph_new.c @@ -720,6 +720,18 @@ static int vfs_ceph_ll_opendir(const struct vfs_handle_struct *handle, cfh->uperm); } +static struct dirent *vfs_ceph_ll_readdir(const struct vfs_handle_struct *hndl, + const struct vfs_ceph_fh *dircfh) +{ + return ceph_readdir(cmount_of(hndl), dircfh->dirp.cdr); +} + +static void vfs_ceph_ll_rewinddir(const struct vfs_handle_struct *handle, + const struct vfs_ceph_fh *dircfh) +{ + ceph_rewinddir(cmount_of(handle), dircfh->dirp.cdr); +} + static int vfs_ceph_ll_mkdirat(const struct vfs_handle_struct *handle, const struct vfs_ceph_fh *dircfh, const char *name, @@ -971,11 +983,11 @@ static struct dirent *vfs_ceph_readdir(struct vfs_handle_struct *handle, struct files_struct *dirfsp, DIR *dirp) { + const struct vfs_ceph_fh *dircfh = (const struct vfs_ceph_fh *)dirp; struct dirent *result = NULL; DBG_DEBUG("[CEPH] readdir(%p, %p)\n", handle, dirp); - result = ceph_readdir(cmount_of(handle), - (struct ceph_dir_result *)dirp); + result = vfs_ceph_ll_readdir(handle, dircfh); DBG_DEBUG("[CEPH] readdir(...) = %p\n", result); return result; @@ -983,8 +995,10 @@ static struct dirent *vfs_ceph_readdir(struct vfs_handle_struct *handle, static void vfs_ceph_rewinddir(struct vfs_handle_struct *handle, DIR *dirp) { + const struct vfs_ceph_fh *dircfh = (const struct vfs_ceph_fh *)dirp; + DBG_DEBUG("[CEPH] rewinddir(%p, %p)\n", handle, dirp); - ceph_rewinddir(cmount_of(handle), (struct ceph_dir_result *)dirp); + vfs_ceph_ll_rewinddir(handle, dircfh); } static int vfs_ceph_mkdirat(struct vfs_handle_struct *handle,