From: Jeremy Allison Date: Mon, 30 Apr 2018 17:15:49 +0000 (-0700) Subject: s3: VFS: Default. Move vfs_read_data() out of source3/smbd/vfs.c to the printing... X-Git-Tag: ldb-1.4.0~464 X-Git-Url: http://git.samba.org/?a=commitdiff_plain;h=0c78aa1f3a6eb9c08c2fdd10c304d6192cb1b6c2;p=samba.git 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 Reviewed-by: Ralph Boehme Autobuild-User(master): Ralph Böhme Autobuild-Date(master): Wed May 2 22:20:23 CEST 2018 on sn-devel-144 --- diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c index 54357b787f3..bf54fd4e6b3 100644 --- a/source3/printing/nt_printing.c +++ b/source3/printing/nt_printing.c @@ -311,6 +311,34 @@ const char *get_short_archi(const char *long_archi) return archi_table[i].short_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 diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index 4417595df3a..81350469c28 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 f659c8f2783..47abf45496b 100644 --- a/source3/smbd/vfs.c +++ b/source3/smbd/vfs.c @@ -398,31 +398,6 @@ NTSTATUS vfs_file_exist(connection_struct *conn, struct smb_filename *smb_fname) return NT_STATUS_OBJECT_NAME_NOT_FOUND; } -/**************************************************************************** - 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. ****************************************************************************/