The branch, master has been updated
       via  0c78aa1 s3: VFS: Default. Move vfs_read_data() out of 
source3/smbd/vfs.c to the printing code, which is the only caller.
       via  c68cfbc s3: VFS: default: Remove recursion into the VFS inside the 
default pread call.
       via  ff3a23e s3: VFS: default: Remove fallback if we don't have 
HAVE_PREAD set. Samba doesn't work without pread.
      from  bc71cd0 s3: VFS: Remove fsync_fn() from the VFS and all modules. 
VFS ABI change.

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 0c78aa1f3a6eb9c08c2fdd10c304d6192cb1b6c2
Author: Jeremy Allison <[email protected]>
Date:   Mon Apr 30 10:15:49 2018 -0700

    s3: VFS: Default. Move vfs_read_data() out of source3/smbd/vfs.c to the 
printing code, which is the only caller.
    
    Make static.
    
    Signed-off-by: Jeremy Allison <[email protected]>
    Reviewed-by: Ralph Boehme <[email protected]>
    
    Autobuild-User(master): Ralph Böhme <[email protected]>
    Autobuild-Date(master): Wed May  2 22:20:23 CEST 2018 on sn-devel-144

commit c68cfbcee6a19a19401893706d72994725b05ef5
Author: Jeremy Allison <[email protected]>
Date:   Mon Apr 30 09:51:34 2018 -0700

    s3: VFS: default: Remove recursion into the VFS inside the default pread 
call.
    
    We already know we're at the POSIX level here.
    
    Signed-off-by: Jeremy Allison <[email protected]>
    Reviewed-by: Ralph Boehme <[email protected]>

commit ff3a23e90f85508de39610eb3503562b76c22773
Author: Jeremy Allison <[email protected]>
Date:   Mon Apr 30 09:50:04 2018 -0700

    s3: VFS: default: Remove fallback if we don't have HAVE_PREAD set. Samba 
doesn't work without pread.
    
    Start of the changes to remove synchronous VFS read.
    
    Signed-off-by: Jeremy Allison <[email protected]>
    Reviewed-by: Ralph Boehme <[email protected]>

-----------------------------------------------------------------------

Summary of changes:
 source3/modules/vfs_default.c  | 26 +++-----------------------
 source3/printing/nt_printing.c | 28 ++++++++++++++++++++++++++++
 source3/smbd/proto.h           |  1 -
 source3/smbd/vfs.c             | 25 -------------------------
 4 files changed, 31 insertions(+), 49 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index 6de0329..56dd5c7 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -636,33 +636,13 @@ static ssize_t vfswrap_pread(vfs_handle_struct *handle, 
files_struct *fsp, void
 
        if (result == -1 && errno == ESPIPE) {
                /* Maintain the fiction that pipes can be seeked (sought?) on. 
*/
-               result = SMB_VFS_READ(fsp, data, n);
+               result = sys_read(fsp->fh->fd, data, n);
                fsp->fh->pos = 0;
        }
 
 #else /* HAVE_PREAD */
-       off_t   curr;
-       int lerrno;
-
-       curr = SMB_VFS_LSEEK(fsp, 0, SEEK_CUR);
-       if (curr == -1 && errno == ESPIPE) {
-               /* Maintain the fiction that pipes can be seeked (sought?) on. 
*/
-               result = SMB_VFS_READ(fsp, data, n);
-               fsp->fh->pos = 0;
-               return result;
-       }
-
-       if (SMB_VFS_LSEEK(fsp, offset, SEEK_SET) == -1) {
-               return -1;
-       }
-
-       errno = 0;
-       result = SMB_VFS_READ(fsp, data, n);
-       lerrno = errno;
-
-       SMB_VFS_LSEEK(fsp, curr, SEEK_SET);
-       errno = lerrno;
-
+       errno = ENOSYS;
+       result = -1;
 #endif /* HAVE_PREAD */
 
        return result;
diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c
index 54357b7..bf54fd4 100644
--- a/source3/printing/nt_printing.c
+++ b/source3/printing/nt_printing.c
@@ -312,6 +312,34 @@ const char *get_short_archi(const char *long_archi)
 }
 
 /****************************************************************************
+ Read data from fsp on the vfs.
+ (note: EINTR re-read differs from vfs_write_data)
+****************************************************************************/
+
+static ssize_t vfs_read_data(files_struct *fsp, char *buf, size_t byte_count)
+{
+       size_t total=0;
+
+       while (total < byte_count) {
+               ssize_t ret = SMB_VFS_READ(fsp, buf + total,
+                                       byte_count - total);
+
+               if (ret == 0) {
+                       return total;
+               }
+               if (ret == -1) {
+                       if (errno == EINTR) {
+                               continue;
+                       } else {
+                               return -1;
+                       }
+               }
+               total += ret;
+       }
+       return (ssize_t)total;
+}
+
+/****************************************************************************
  Version information in Microsoft files is held in a VS_VERSION_INFO structure.
  There are two case to be covered here: PE (Portable Executable) and NE (New
  Executable) files. Both files support the same INFO structure, but PE files
diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h
index 4417595..8135046 100644
--- a/source3/smbd/proto.h
+++ b/source3/smbd/proto.h
@@ -1228,7 +1228,6 @@ void sys_utmp_yield(const char *username, const char 
*hostname,
 bool vfs_init_custom(connection_struct *conn, const char *vfs_object);
 bool smbd_vfs_init(connection_struct *conn);
 NTSTATUS vfs_file_exist(connection_struct *conn, struct smb_filename 
*smb_fname);
-ssize_t vfs_read_data(files_struct *fsp, char *buf, size_t byte_count);
 ssize_t vfs_write_data(struct smb_request *req,
                        files_struct *fsp,
                        const char *buffer,
diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c
index f659c8f..47abf45 100644
--- a/source3/smbd/vfs.c
+++ b/source3/smbd/vfs.c
@@ -399,31 +399,6 @@ NTSTATUS vfs_file_exist(connection_struct *conn, struct 
smb_filename *smb_fname)
 }
 
 /****************************************************************************
- Read data from fsp on the vfs. (note: EINTR re-read differs from 
vfs_write_data)
-****************************************************************************/
-
-ssize_t vfs_read_data(files_struct *fsp, char *buf, size_t byte_count)
-{
-       size_t total=0;
-
-       while (total < byte_count)
-       {
-               ssize_t ret = SMB_VFS_READ(fsp, buf + total,
-                                          byte_count - total);
-
-               if (ret == 0) return total;
-               if (ret == -1) {
-                       if (errno == EINTR)
-                               continue;
-                       else
-                               return -1;
-               }
-               total += ret;
-       }
-       return (ssize_t)total;
-}
-
-/****************************************************************************
  Write data to a fd on the vfs.
 ****************************************************************************/
 


-- 
Samba Shared Repository

Reply via email to