From fdd3a63ab9a24a6e6eb420eb8bfaa7c2f16e0c57 Mon Sep 17 00:00:00 2001 From: Anoop C S Date: Tue, 20 Mar 2018 11:32:20 +0530 Subject: [PATCH] vfs_glusterfs: Adapt to changes in libgfapi signatures VFS module for GlusterFS fails to compile due to recent changes done to some API signatures. Therefore adding missing arguments to those APIs adapting to new signatures. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13330 Signed-off-by: Anoop C S --- source3/modules/vfs_glusterfs.c | 25 +++++++++++++++++++++++++ source3/wscript | 3 +++ 2 files changed, 28 insertions(+) diff --git a/source3/modules/vfs_glusterfs.c b/source3/modules/vfs_glusterfs.c index 38abb78f1f3..319d9a2ca88 100644 --- a/source3/modules/vfs_glusterfs.c +++ b/source3/modules/vfs_glusterfs.c @@ -602,7 +602,12 @@ static ssize_t vfs_gluster_pread(struct vfs_handle_struct *handle, files_struct *fsp, void *data, size_t n, off_t offset) { +#ifdef HAVE_GFAPI_VER_7_4_1 + return glfs_pread(*(glfs_fd_t **)VFS_FETCH_FSP_EXTENSION(handle, fsp), + data, n, offset, 0, NULL); +#else return glfs_pread(*(glfs_fd_t **)VFS_FETCH_FSP_EXTENSION(handle, fsp), data, n, offset, 0); +#endif } struct glusterfs_aio_state; @@ -633,7 +638,12 @@ static int aio_wrapper_destructor(struct glusterfs_aio_wrapper *wrap) * threads once the async IO submitted is complete. To notify * Samba of the completion we use a pipe based queue. */ +#ifdef HAVE_GFAPI_VER_7_4_1 +static void aio_glusterfs_done(glfs_fd_t *fd, ssize_t ret, struct stat *prestat, + struct stat *poststat, void *data) +#else static void aio_glusterfs_done(glfs_fd_t *fd, ssize_t ret, void *data) +#endif { struct glusterfs_aio_state *state = NULL; int sts = 0; @@ -897,7 +907,12 @@ static ssize_t vfs_gluster_pwrite(struct vfs_handle_struct *handle, files_struct *fsp, const void *data, size_t n, off_t offset) { +#ifdef HAVE_GFAPI_VER_7_4_1 + return glfs_pwrite(*(glfs_fd_t **)VFS_FETCH_FSP_EXTENSION(handle, fsp), + data, n, offset, 0, NULL, NULL); +#else return glfs_pwrite(*(glfs_fd_t **)VFS_FETCH_FSP_EXTENSION(handle, fsp), data, n, offset, 0); +#endif } static off_t vfs_gluster_lseek(struct vfs_handle_struct *handle, @@ -934,7 +949,12 @@ static int vfs_gluster_rename(struct vfs_handle_struct *handle, static int vfs_gluster_fsync(struct vfs_handle_struct *handle, files_struct *fsp) { +#ifdef HAVE_GFAPI_VER_7_4_1 + return glfs_fsync(*(glfs_fd_t **)VFS_FETCH_FSP_EXTENSION(handle, fsp), + NULL, NULL); +#else return glfs_fsync(*(glfs_fd_t **)VFS_FETCH_FSP_EXTENSION(handle, fsp)); +#endif } static struct tevent_req *vfs_gluster_fsync_send(struct vfs_handle_struct @@ -1144,7 +1164,12 @@ static int vfs_gluster_ntimes(struct vfs_handle_struct *handle, static int vfs_gluster_ftruncate(struct vfs_handle_struct *handle, files_struct *fsp, off_t offset) { +#ifdef HAVE_GFAPI_VER_7_4_1 + return glfs_ftruncate(*(glfs_fd_t **)VFS_FETCH_FSP_EXTENSION(handle, fsp), + offset, NULL, NULL); +#else return glfs_ftruncate(*(glfs_fd_t **)VFS_FETCH_FSP_EXTENSION(handle, fsp), offset); +#endif } static int vfs_gluster_fallocate(struct vfs_handle_struct *handle, diff --git a/source3/wscript b/source3/wscript index e33ecafb48a..d0b20d0fa06 100644 --- a/source3/wscript +++ b/source3/wscript @@ -1560,6 +1560,9 @@ main() { conf.CHECK_CFG(package='glusterfs-api', args='"glusterfs-api >= 6" --cflags --libs', msg='Checking for glusterfs-api >= 6', uselib_store="GFAPI_VER_6") + conf.CHECK_CFG(package='glusterfs-api', args='"glusterfs-api >= 7.4.1" --cflags --libs', + msg='Checking for glusterfs-api >= 7.4.1', + uselib_store="GFAPI_VER_7_4_1") else: conf.SET_TARGET_TYPE('gfapi', 'EMPTY') conf.undefine('HAVE_GLUSTERFS') -- 2.14.3