s3: VFS: Remove SMB_VFS_WRITE() function and all implementations.
authorJeremy Allison <jra@samba.org>
Wed, 2 May 2018 23:56:33 +0000 (16:56 -0700)
committerRalph Boehme <slow@samba.org>
Fri, 4 May 2018 23:38:07 +0000 (01:38 +0200)
All code in Samba now uses SMB_VFS_PWRITE or SMB_VFS_PWRITE_SEND.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph B√∂hme <slow@samba.org>
Autobuild-Date(master): Sat May  5 01:38:07 CEST 2018 on sn-devel-144

examples/VFS/skel_opaque.c
examples/VFS/skel_transparent.c
source3/include/vfs.h
source3/include/vfs_macros.h
source3/modules/vfs_ceph.c
source3/modules/vfs_commit.c
source3/modules/vfs_default.c
source3/modules/vfs_full_audit.c
source3/modules/vfs_glusterfs.c
source3/modules/vfs_time_audit.c
source3/smbd/vfs.c

index 3f0e6652c561a5b1e0779c997c196d1b11a4af59..5529ec76aa19c8d34be79e1bb4d51cdf31ffdb7d 100644 (file)
@@ -243,13 +243,6 @@ static ssize_t skel_pread_recv(struct tevent_req *req,
        return -1;
 }
 
-static ssize_t skel_write(vfs_handle_struct *handle, files_struct *fsp,
-                         const void *data, size_t n)
-{
-       errno = ENOSYS;
-       return -1;
-}
-
 static ssize_t skel_pwrite(vfs_handle_struct *handle, files_struct *fsp,
                           const void *data, size_t n, off_t offset)
 {
@@ -945,7 +938,6 @@ struct vfs_fn_pointers skel_opaque_fns = {
        .pread_fn = skel_pread,
        .pread_send_fn = skel_pread_send,
        .pread_recv_fn = skel_pread_recv,
-       .write_fn = skel_write,
        .pwrite_fn = skel_pwrite,
        .pwrite_send_fn = skel_pwrite_send,
        .pwrite_recv_fn = skel_pwrite_recv,
index a56cda500276fa27d2184a5e5113d655b49b62a9..fde24fbc4db8c4f6d28840c577686e352eef770a 100644 (file)
@@ -289,12 +289,6 @@ static ssize_t skel_pread_recv(struct tevent_req *req,
        return state->ret;
 }
 
-static ssize_t skel_write(vfs_handle_struct *handle, files_struct *fsp,
-                         const void *data, size_t n)
-{
-       return SMB_VFS_NEXT_WRITE(handle, fsp, data, n);
-}
-
 static ssize_t skel_pwrite(vfs_handle_struct *handle, files_struct *fsp,
                           const void *data, size_t n, off_t offset)
 {
@@ -1120,7 +1114,6 @@ struct vfs_fn_pointers skel_transparent_fns = {
        .pread_fn = skel_pread,
        .pread_send_fn = skel_pread_send,
        .pread_recv_fn = skel_pread_recv,
-       .write_fn = skel_write,
        .pwrite_fn = skel_pwrite,
        .pwrite_send_fn = skel_pwrite_send,
        .pwrite_recv_fn = skel_pwrite_recv,
index 74029a9edabd7995bd413324d519e1f4dd17d4a4..cc7948a115dcab626805f5581fd67defccbae6de 100644 (file)
                Only implement async versions. */
 /* Version 39 - Remove SMB_VFS_READ
                All users are now pread or async versions. */
+/* Version 39 - Remove SMB_VFS_WRITE
+               All users are now pwrite or async versions. */
 
 #define SMB_VFS_INTERFACE_VERSION 39
 
@@ -695,7 +697,6 @@ struct vfs_fn_pointers {
                                            void *data,
                                            size_t n, off_t offset);
        ssize_t (*pread_recv_fn)(struct tevent_req *req, struct vfs_aio_state *state);
-       ssize_t (*write_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, const void *data, size_t n);
        ssize_t (*pwrite_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, const void *data, size_t n, off_t offset);
        struct tevent_req *(*pwrite_send_fn)(struct vfs_handle_struct *handle,
                                             TALLOC_CTX *mem_ctx,
@@ -1182,9 +1183,6 @@ struct tevent_req *smb_vfs_call_pread_send(struct vfs_handle_struct *handle,
                                           size_t n, off_t offset);
 ssize_t SMB_VFS_PREAD_RECV(struct tevent_req *req, struct vfs_aio_state *state);
 
-ssize_t smb_vfs_call_write(struct vfs_handle_struct *handle,
-                          struct files_struct *fsp, const void *data,
-                          size_t n);
 ssize_t smb_vfs_call_pwrite(struct vfs_handle_struct *handle,
                            struct files_struct *fsp, const void *data,
                            size_t n, off_t offset);
index 5e30f0b484ab8055115565825f39489a400e0193..d483613469763d8b07a815f67fe726319fa4e807 100644 (file)
        smb_vfs_call_pread_send((handle)->next, (mem_ctx), (ev), (fsp), \
                                (data), (n), (off))
 
-#define SMB_VFS_WRITE(fsp, data, n) \
-       smb_vfs_call_write((fsp)->conn->vfs_handles, (fsp), (data), (n))
-#define SMB_VFS_NEXT_WRITE(handle, fsp, data, n) \
-       smb_vfs_call_write((handle)->next, (fsp), (data), (n))
-
 #define SMB_VFS_PWRITE(fsp, data, n, off) \
        smb_vfs_call_pwrite((fsp)->conn->vfs_handles, (fsp), (data), (n), (off))
 #define SMB_VFS_NEXT_PWRITE(handle, fsp, data, n, off) \
index cfb887d4e3cb31ac7c127fa47a4a12b2436ffa4d..e49e7a6be00fa97517e69a5135b6a464f070c8f1 100644 (file)
@@ -471,22 +471,6 @@ static ssize_t cephwrap_pread(struct vfs_handle_struct *handle, files_struct *fs
 }
 
 
-static ssize_t cephwrap_write(struct vfs_handle_struct *handle, files_struct *fsp, const void *data, size_t n)
-{
-       ssize_t result;
-
-       DBG_DEBUG("[CEPH] write(%p, %p, %p, %llu)\n", handle, fsp, data, llu(n));
-
-       result = ceph_write(handle->data, fsp->fh->fd, data, n, -1);
-
-       DBG_DEBUG("[CEPH] write(...) = %llu\n", llu(result));
-       if (result < 0) {
-               WRAP_RETURN(result);
-       }
-       fsp->fh->pos += result;
-       return result;
-}
-
 static ssize_t cephwrap_pwrite(struct vfs_handle_struct *handle, files_struct *fsp, const void *data,
                        size_t n, off_t offset)
 {
@@ -1458,7 +1442,6 @@ static struct vfs_fn_pointers ceph_fns = {
        .open_fn = cephwrap_open,
        .close_fn = cephwrap_close,
        .pread_fn = cephwrap_pread,
-       .write_fn = cephwrap_write,
        .pwrite_fn = cephwrap_pwrite,
        .lseek_fn = cephwrap_lseek,
        .sendfile_fn = cephwrap_sendfile,
index aa9c87db74d1928541349d837d7b278346e3055f..a11f9e2f131a906e65f84f9ebd37d513833424c8 100644 (file)
@@ -248,24 +248,6 @@ static int commit_open(
         return fd;
 }
 
-static ssize_t commit_write(
-        vfs_handle_struct * handle,
-        files_struct *      fsp,
-        const void *        data,
-        size_t              count)
-{
-        ssize_t ret;
-        ret = SMB_VFS_NEXT_WRITE(handle, fsp, data, count);
-
-        if (ret > 0) {
-                if (commit(handle, fsp, fsp->fh->pos, ret) == -1) {
-                        return -1;
-                }
-        }
-
-        return ret;
-}
-
 static ssize_t commit_pwrite(
         vfs_handle_struct * handle,
         files_struct *      fsp,
@@ -395,7 +377,6 @@ static int commit_ftruncate(
 static struct vfs_fn_pointers vfs_commit_fns = {
         .open_fn = commit_open,
         .close_fn = commit_close,
-        .write_fn = commit_write,
         .pwrite_fn = commit_pwrite,
         .pwrite_send_fn = commit_pwrite_send,
         .pwrite_recv_fn = commit_pwrite_recv,
index 0fa9b78b46ef1a09d71d1388965dcf81579ad93c..e335e270650ff256fe1041eb8806e58a641a69f0 100644 (file)
@@ -638,16 +638,6 @@ static ssize_t vfswrap_pread(vfs_handle_struct *handle, files_struct *fsp, void
        return result;
 }
 
-static ssize_t vfswrap_write(vfs_handle_struct *handle, files_struct *fsp, const void *data, size_t n)
-{
-       ssize_t result;
-
-       START_PROFILE_BYTES(syscall_write, n);
-       result = sys_write(fsp->fh->fd, data, n);
-       END_PROFILE_BYTES(syscall_write);
-       return result;
-}
-
 static ssize_t vfswrap_pwrite(vfs_handle_struct *handle, files_struct *fsp, const void *data,
                        size_t n, off_t offset)
 {
@@ -2967,7 +2957,6 @@ static struct vfs_fn_pointers vfs_default_fns = {
        .pread_fn = vfswrap_pread,
        .pread_send_fn = vfswrap_pread_send,
        .pread_recv_fn = vfswrap_pread_recv,
-       .write_fn = vfswrap_write,
        .pwrite_fn = vfswrap_pwrite,
        .pwrite_send_fn = vfswrap_pwrite_send,
        .pwrite_recv_fn = vfswrap_pwrite_recv,
index 6e28a2466524fbfb0714afbd825c6b5f52d256d1..ee8dbbcff2c88847b852b6d8f1db660994aeea17 100644 (file)
@@ -1116,19 +1116,6 @@ static ssize_t smb_full_audit_pread_recv(struct tevent_req *req,
        return state->ret;
 }
 
-static ssize_t smb_full_audit_write(vfs_handle_struct *handle, files_struct *fsp,
-                          const void *data, size_t n)
-{
-       ssize_t result;
-
-       result = SMB_VFS_NEXT_WRITE(handle, fsp, data, n);
-
-       do_log(SMB_VFS_OP_WRITE, (result >= 0), handle, "%s",
-              fsp_str_do_log(fsp));
-
-       return result;
-}
-
 static ssize_t smb_full_audit_pwrite(vfs_handle_struct *handle, files_struct *fsp,
                            const void *data, size_t n,
                            off_t offset)
@@ -2497,7 +2484,6 @@ static struct vfs_fn_pointers vfs_full_audit_fns = {
        .pread_fn = smb_full_audit_pread,
        .pread_send_fn = smb_full_audit_pread_send,
        .pread_recv_fn = smb_full_audit_pread_recv,
-       .write_fn = smb_full_audit_write,
        .pwrite_fn = smb_full_audit_pwrite,
        .pwrite_send_fn = smb_full_audit_pwrite_send,
        .pwrite_recv_fn = smb_full_audit_pwrite_recv,
index 6555fd42545a612deb6edafae045b87256547760..b022e9869fffaec30cb9456ea05cc21343fc00f8 100644 (file)
@@ -881,12 +881,6 @@ static ssize_t vfs_gluster_recv(struct tevent_req *req,
        return ret;
 }
 
-static ssize_t vfs_gluster_write(struct vfs_handle_struct *handle,
-                                files_struct *fsp, const void *data, size_t n)
-{
-       return glfs_write(*(glfs_fd_t **)VFS_FETCH_FSP_EXTENSION(handle, fsp), data, n, 0);
-}
-
 static ssize_t vfs_gluster_pwrite(struct vfs_handle_struct *handle,
                                  files_struct *fsp, const void *data,
                                  size_t n, off_t offset)
@@ -1450,7 +1444,6 @@ static struct vfs_fn_pointers glusterfs_fns = {
        .pread_fn = vfs_gluster_pread,
        .pread_send_fn = vfs_gluster_pread_send,
        .pread_recv_fn = vfs_gluster_recv,
-       .write_fn = vfs_gluster_write,
        .pwrite_fn = vfs_gluster_pwrite,
        .pwrite_send_fn = vfs_gluster_pwrite_send,
        .pwrite_recv_fn = vfs_gluster_recv,
index faa913180fee0a02eb2b37b91c07efc1c6f82638..084c209510db42eee6602cc57ad6d8aad5d4dc35 100644 (file)
@@ -732,26 +732,6 @@ static ssize_t smb_time_audit_pread_recv(struct tevent_req *req,
        return state->ret;
 }
 
-static ssize_t smb_time_audit_write(vfs_handle_struct *handle,
-                                   files_struct *fsp,
-                                   const void *data, size_t n)
-{
-       ssize_t result;
-       struct timespec ts1,ts2;
-       double timediff;
-
-       clock_gettime_mono(&ts1);
-       result = SMB_VFS_NEXT_WRITE(handle, fsp, data, n);
-       clock_gettime_mono(&ts2);
-       timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
-
-       if (timediff > audit_timeout) {
-               smb_time_audit_log_fsp("write", timediff, fsp);
-       }
-
-       return result;
-}
-
 static ssize_t smb_time_audit_pwrite(vfs_handle_struct *handle,
                                     files_struct *fsp,
                                     const void *data, size_t n,
@@ -2661,7 +2641,6 @@ static struct vfs_fn_pointers vfs_time_audit_fns = {
        .pread_fn = smb_time_audit_pread,
        .pread_send_fn = smb_time_audit_pread_send,
        .pread_recv_fn = smb_time_audit_pread_recv,
-       .write_fn = smb_time_audit_write,
        .pwrite_fn = smb_time_audit_pwrite,
        .pwrite_send_fn = smb_time_audit_pwrite_send,
        .pwrite_recv_fn = smb_time_audit_pwrite_recv,
index aa01b1b07f00c3c398d0ee083a7487e864d4c5cb..386e955243f57bc41ab1dc997f429d019f6633f7 100644 (file)
@@ -1729,14 +1729,6 @@ ssize_t SMB_VFS_PREAD_RECV(struct tevent_req *req,
        return state->retval;
 }
 
-ssize_t smb_vfs_call_write(struct vfs_handle_struct *handle,
-                          struct files_struct *fsp, const void *data,
-                          size_t n)
-{
-       VFS_FIND(write);
-       return handle->fns->write_fn(handle, fsp, data, n);
-}
-
 ssize_t smb_vfs_call_pwrite(struct vfs_handle_struct *handle,
                            struct files_struct *fsp, const void *data,
                            size_t n, off_t offset)