1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

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 <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>

Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Wed May  2 22:20:23 CEST 2018 on sn-devel-144
This commit is contained in:
Jeremy Allison 2018-04-30 10:15:49 -07:00 committed by Ralph Boehme
parent c68cfbcee6
commit 0c78aa1f3a
3 changed files with 28 additions and 26 deletions

View File

@ -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

View File

@ -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,

View File

@ -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.
****************************************************************************/