s3: VFS: Remove SMB_VFS_READ() function and all implementations.
authorJeremy Allison <jra@samba.org>
Tue, 1 May 2018 19:05:44 +0000 (12:05 -0700)
committerRalph Boehme <slow@samba.org>
Fri, 4 May 2018 20:34:25 +0000 (22:34 +0200)
All code in Samba now uses SMB_VFS_PREAD or SMB_VFS_PREAD_SEND.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
examples/VFS/skel_opaque.c
examples/VFS/skel_transparent.c
source3/include/vfs.h
source3/include/vfs_macros.h
source3/modules/vfs_cacheprime.c
source3/modules/vfs_ceph.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 41215cc..3f0e665 100644 (file)
@@ -220,13 +220,6 @@ static int skel_close_fn(vfs_handle_struct *handle, files_struct *fsp)
        return -1;
 }
 
-static ssize_t skel_vfs_read(vfs_handle_struct *handle, files_struct *fsp,
-                            void *data, size_t n)
-{
-       errno = ENOSYS;
-       return -1;
-}
-
 static ssize_t skel_pread(vfs_handle_struct *handle, files_struct *fsp,
                          void *data, size_t n, off_t offset)
 {
@@ -949,7 +942,6 @@ struct vfs_fn_pointers skel_opaque_fns = {
        .open_fn = skel_open,
        .create_file_fn = skel_create_file,
        .close_fn = skel_close_fn,
-       .read_fn = skel_vfs_read,
        .pread_fn = skel_pread,
        .pread_send_fn = skel_pread_send,
        .pread_recv_fn = skel_pread_recv,
index 7a82a55..a56cda5 100644 (file)
@@ -229,12 +229,6 @@ static int skel_close_fn(vfs_handle_struct *handle, files_struct *fsp)
        return SMB_VFS_NEXT_CLOSE(handle, fsp);
 }
 
-static ssize_t skel_vfs_read(vfs_handle_struct *handle, files_struct *fsp,
-                            void *data, size_t n)
-{
-       return SMB_VFS_NEXT_READ(handle, fsp, data, n);
-}
-
 static ssize_t skel_pread(vfs_handle_struct *handle, files_struct *fsp,
                          void *data, size_t n, off_t offset)
 {
@@ -1123,7 +1117,6 @@ struct vfs_fn_pointers skel_transparent_fns = {
        .open_fn = skel_open,
        .create_file_fn = skel_create_file,
        .close_fn = skel_close_fn,
-       .read_fn = skel_vfs_read,
        .pread_fn = skel_pread,
        .pread_send_fn = skel_pread_send,
        .pread_recv_fn = skel_pread_recv,
index 6f940ed..74029a9 100644 (file)
 /* Version 38 - Remove SMB_VFS_INIT_SEARCH_OP */
 /* Version 39 - Remove SMB_VFS_FSYNC
                Only implement async versions. */
+/* Version 39 - Remove SMB_VFS_READ
+               All users are now pread or async versions. */
 
 #define SMB_VFS_INTERFACE_VERSION 39
 
@@ -685,7 +687,6 @@ struct vfs_fn_pointers {
                                   const struct smb2_create_blobs *in_context_blobs,
                                   struct smb2_create_blobs *out_context_blobs);
        int (*close_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp);
-       ssize_t (*read_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, void *data, size_t n);
        ssize_t (*pread_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, void *data, size_t n, off_t offset);
        struct tevent_req *(*pread_send_fn)(struct vfs_handle_struct *handle,
                                            TALLOC_CTX *mem_ctx,
@@ -1170,8 +1171,6 @@ NTSTATUS smb_vfs_call_create_file(struct vfs_handle_struct *handle,
                                  struct smb2_create_blobs *out_context_blobs);
 int smb_vfs_call_close(struct vfs_handle_struct *handle,
                       struct files_struct *fsp);
-ssize_t smb_vfs_call_read(struct vfs_handle_struct *handle,
-                         struct files_struct *fsp, void *data, size_t n);
 ssize_t smb_vfs_call_pread(struct vfs_handle_struct *handle,
                           struct files_struct *fsp, void *data, size_t n,
                           off_t offset);
index dcf788e..5e30f0b 100644 (file)
 #define SMB_VFS_NEXT_CLOSE(handle, fsp) \
        smb_vfs_call_close((handle)->next, (fsp))
 
-#define SMB_VFS_READ(fsp, data, n) \
-       smb_vfs_call_read((fsp)->conn->vfs_handles, (fsp), (data), (n))
-#define SMB_VFS_NEXT_READ(handle, fsp, data, n) \
-       smb_vfs_call_read((handle)->next, (fsp), (data), (n))
-
 #define SMB_VFS_PREAD(fsp, data, n, off) \
        smb_vfs_call_pread((fsp)->conn->vfs_handles, (fsp), (data), (n), (off))
 #define SMB_VFS_NEXT_PREAD(handle, fsp, data, n, off) \
index 5a8b8e0..c8b33d6 100644 (file)
@@ -146,23 +146,6 @@ static ssize_t cprime_sendfile(
                                      header, offset, count);
 }
 
-static ssize_t cprime_read(
-                vfs_handle_struct * handle,
-                files_struct *      fsp,
-                void *              data,
-                size_t              count)
-{
-        off_t offset;
-
-        offset = SMB_VFS_LSEEK(fsp, 0, SEEK_CUR);
-        if (offset >= 0 && g_readbuf)  {
-                prime_cache(handle, fsp, offset, count);
-                SMB_VFS_LSEEK(fsp, offset, SEEK_SET);
-        }
-
-        return SMB_VFS_NEXT_READ(handle, fsp, data, count);
-}
-
 static ssize_t cprime_pread(
                 vfs_handle_struct * handle,
                 files_struct *      fsp,
@@ -180,7 +163,6 @@ static ssize_t cprime_pread(
 static struct vfs_fn_pointers vfs_cacheprime_fns = {
     .sendfile_fn = cprime_sendfile,
     .pread_fn = cprime_pread,
-    .read_fn = cprime_read,
     .connect_fn = cprime_connect,
 };
 
index 2062fe4..2f50aa6 100644 (file)
@@ -458,18 +458,6 @@ static int cephwrap_close(struct vfs_handle_struct *handle, files_struct *fsp)
        WRAP_RETURN(result);
 }
 
-static ssize_t cephwrap_read(struct vfs_handle_struct *handle, files_struct *fsp, void *data, size_t n)
-{
-       ssize_t result;
-
-       DBG_DEBUG("[CEPH] read(%p, %p, %p, %llu)\n", handle, fsp, data, llu(n));
-
-       /* Using -1 for the offset means read/write rather than pread/pwrite */
-       result = ceph_read(handle->data, fsp->fh->fd, data, n, -1);
-       DBG_DEBUG("[CEPH] read(...) = %llu\n", llu(result));
-       WRAP_RETURN(result);
-}
-
 static ssize_t cephwrap_pread(struct vfs_handle_struct *handle, files_struct *fsp, void *data,
                        size_t n, off_t offset)
 {
@@ -1474,7 +1462,6 @@ static struct vfs_fn_pointers ceph_fns = {
 
        .open_fn = cephwrap_open,
        .close_fn = cephwrap_close,
-       .read_fn = cephwrap_read,
        .pread_fn = cephwrap_pread,
        .write_fn = cephwrap_write,
        .pwrite_fn = cephwrap_pwrite,
index 56dd5c7..7c93d9a 100644 (file)
@@ -614,16 +614,6 @@ static int vfswrap_close(vfs_handle_struct *handle, files_struct *fsp)
        return result;
 }
 
-static ssize_t vfswrap_read(vfs_handle_struct *handle, files_struct *fsp, void *data, size_t n)
-{
-       ssize_t result;
-
-       START_PROFILE_BYTES(syscall_read, n);
-       result = sys_read(fsp->fh->fd, data, n);
-       END_PROFILE_BYTES(syscall_read);
-       return result;
-}
-
 static ssize_t vfswrap_pread(vfs_handle_struct *handle, files_struct *fsp, void *data,
                        size_t n, off_t offset)
 {
@@ -2990,7 +2980,6 @@ static struct vfs_fn_pointers vfs_default_fns = {
        .open_fn = vfswrap_open,
        .create_file_fn = vfswrap_create_file,
        .close_fn = vfswrap_close,
-       .read_fn = vfswrap_read,
        .pread_fn = vfswrap_pread,
        .pread_send_fn = vfswrap_pread_send,
        .pread_recv_fn = vfswrap_pread_recv,
index 45d6544..6e28a24 100644 (file)
@@ -1032,19 +1032,6 @@ static int smb_full_audit_close(vfs_handle_struct *handle, files_struct *fsp)
        return result;
 }
 
-static ssize_t smb_full_audit_read(vfs_handle_struct *handle, files_struct *fsp,
-                         void *data, size_t n)
-{
-       ssize_t result;
-
-       result = SMB_VFS_NEXT_READ(handle, fsp, data, n);
-
-       do_log(SMB_VFS_OP_READ, (result >= 0), handle, "%s",
-              fsp_str_do_log(fsp));
-
-       return result;
-}
-
 static ssize_t smb_full_audit_pread(vfs_handle_struct *handle, files_struct *fsp,
                           void *data, size_t n, off_t offset)
 {
@@ -2507,7 +2494,6 @@ static struct vfs_fn_pointers vfs_full_audit_fns = {
        .open_fn = smb_full_audit_open,
        .create_file_fn = smb_full_audit_create_file,
        .close_fn = smb_full_audit_close,
-       .read_fn = smb_full_audit_read,
        .pread_fn = smb_full_audit_pread,
        .pread_send_fn = smb_full_audit_pread_send,
        .pread_recv_fn = smb_full_audit_pread_recv,
index 5878c14..6555fd4 100644 (file)
@@ -592,12 +592,6 @@ static int vfs_gluster_close(struct vfs_handle_struct *handle,
        return glfs_close(glfd);
 }
 
-static ssize_t vfs_gluster_read(struct vfs_handle_struct *handle,
-                               files_struct *fsp, void *data, size_t n)
-{
-       return glfs_read(*(glfs_fd_t **)VFS_FETCH_FSP_EXTENSION(handle, fsp), data, n, 0);
-}
-
 static ssize_t vfs_gluster_pread(struct vfs_handle_struct *handle,
                                 files_struct *fsp, void *data, size_t n,
                                 off_t offset)
@@ -1453,7 +1447,6 @@ static struct vfs_fn_pointers glusterfs_fns = {
        .open_fn = vfs_gluster_open,
        .create_file_fn = NULL,
        .close_fn = vfs_gluster_close,
-       .read_fn = vfs_gluster_read,
        .pread_fn = vfs_gluster_pread,
        .pread_send_fn = vfs_gluster_pread_send,
        .pread_recv_fn = vfs_gluster_recv,
index 383f49b..faa9131 100644 (file)
@@ -648,25 +648,6 @@ static int smb_time_audit_close(vfs_handle_struct *handle, files_struct *fsp)
        return result;
 }
 
-static ssize_t smb_time_audit_read(vfs_handle_struct *handle,
-                                  files_struct *fsp, void *data, size_t n)
-{
-       ssize_t result;
-       struct timespec ts1,ts2;
-       double timediff;
-
-       clock_gettime_mono(&ts1);
-       result = SMB_VFS_NEXT_READ(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("read", timediff, fsp);
-       }
-
-       return result;
-}
-
 static ssize_t smb_time_audit_pread(vfs_handle_struct *handle,
                                    files_struct *fsp,
                                    void *data, size_t n, off_t offset)
@@ -2677,7 +2658,6 @@ static struct vfs_fn_pointers vfs_time_audit_fns = {
        .open_fn = smb_time_audit_open,
        .create_file_fn = smb_time_audit_create_file,
        .close_fn = smb_time_audit_close,
-       .read_fn = smb_time_audit_read,
        .pread_fn = smb_time_audit_pread,
        .pread_send_fn = smb_time_audit_pread_send,
        .pread_recv_fn = smb_time_audit_pread_recv,
index 47abf45..9e9a9e8 100644 (file)
@@ -1704,13 +1704,6 @@ int smb_vfs_call_close(struct vfs_handle_struct *handle,
        return handle->fns->close_fn(handle, fsp);
 }
 
-ssize_t smb_vfs_call_read(struct vfs_handle_struct *handle,
-                         struct files_struct *fsp, void *data, size_t n)
-{
-       VFS_FIND(read);
-       return handle->fns->read_fn(handle, fsp, data, n);
-}
-
 ssize_t smb_vfs_call_pread(struct vfs_handle_struct *handle,
                           struct files_struct *fsp, void *data, size_t n,
                           off_t offset)