summaryrefslogtreecommitdiff
path: root/source3/modules
diff options
context:
space:
mode:
Diffstat (limited to 'source3/modules')
-rw-r--r--source3/modules/vfs_cacheprime.c21
-rw-r--r--source3/modules/vfs_commit.c3
-rw-r--r--source3/modules/vfs_default.c31
-rw-r--r--source3/modules/vfs_full_audit.c30
-rw-r--r--source3/modules/vfs_readahead.c14
5 files changed, 45 insertions, 54 deletions
diff --git a/source3/modules/vfs_cacheprime.c b/source3/modules/vfs_cacheprime.c
index 6eb74e66ed..be934f6bd6 100644
--- a/source3/modules/vfs_cacheprime.c
+++ b/source3/modules/vfs_cacheprime.c
@@ -48,7 +48,6 @@ static void * g_readbuf = NULL;
static bool prime_cache(
struct vfs_handle_struct * handle,
files_struct * fsp,
- int fd,
SMB_OFF_T offset,
size_t count)
{
@@ -75,7 +74,7 @@ static bool prime_cache(
MODULE, (long long)g_readsz, (long long)*last,
fsp->fsp_name));
- nread = sys_pread(fd, g_readbuf, g_readsz, *last);
+ nread = sys_pread(fsp->fh->fd, g_readbuf, g_readsz, *last);
if (nread < 0) {
*last = -1;
return False;
@@ -125,36 +124,34 @@ static int cprime_connect(
static ssize_t cprime_sendfile(
struct vfs_handle_struct * handle,
int tofd,
- files_struct * fsp,
- int fromfd,
+ files_struct * fromfsp,
const DATA_BLOB * header,
SMB_OFF_T offset,
size_t count)
{
if (g_readbuf && offset == 0) {
- prime_cache(handle, fsp, fromfd, offset, count);
+ prime_cache(handle, fromfsp, offset, count);
}
- return SMB_VFS_NEXT_SENDFILE(handle, tofd, fsp, fromfd,
+ return SMB_VFS_NEXT_SENDFILE(handle, tofd, fromfsp,
header, offset, count);
}
static ssize_t cprime_read(
vfs_handle_struct * handle,
files_struct * fsp,
- int fd,
void * data,
size_t count)
{
SMB_OFF_T offset;
- offset = SMB_VFS_LSEEK(fsp, fd, 0, SEEK_CUR);
+ offset = SMB_VFS_LSEEK(fsp, 0, SEEK_CUR);
if (offset >= 0 && g_readbuf) {
- prime_cache(handle, fsp, fd, offset, count);
- SMB_VFS_LSEEK(fsp, fd, offset, SEEK_SET);
+ prime_cache(handle, fsp, offset, count);
+ SMB_VFS_LSEEK(fsp, offset, SEEK_SET);
}
- return SMB_VFS_NEXT_READ(handle, fsp, fd, data, count);
+ return SMB_VFS_NEXT_READ(handle, fsp, data, count);
}
static ssize_t cprime_pread(
@@ -165,7 +162,7 @@ static ssize_t cprime_pread(
SMB_OFF_T offset)
{
if (g_readbuf) {
- prime_cache(handle, fsp, fsp->fh->fd, offset, count);
+ prime_cache(handle, fsp, offset, count);
}
return SMB_VFS_NEXT_PREAD(handle, fsp, data, count, offset);
diff --git a/source3/modules/vfs_commit.c b/source3/modules/vfs_commit.c
index fe7324122f..ac391cf007 100644
--- a/source3/modules/vfs_commit.c
+++ b/source3/modules/vfs_commit.c
@@ -229,12 +229,11 @@ static int commit_open(
static ssize_t commit_write(
vfs_handle_struct * handle,
files_struct * fsp,
- int fd,
void * data,
size_t count)
{
ssize_t ret;
- ret = SMB_VFS_NEXT_WRITE(handle, fsp, fd, data, count);
+ ret = SMB_VFS_NEXT_WRITE(handle, fsp, data, count);
if (ret > 0) {
if (commit(handle, fsp, fsp->fh->pos, ret) == -1) {
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index 97138bdacf..e21136ccee 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -208,12 +208,12 @@ static int vfswrap_close(vfs_handle_struct *handle, files_struct *fsp, int fd)
return result;
}
-static ssize_t vfswrap_read(vfs_handle_struct *handle, files_struct *fsp, int fd, void *data, size_t n)
+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(fd, data, n);
+ result = sys_read(fsp->fh->fd, data, n);
END_PROFILE(syscall_read);
return result;
}
@@ -230,7 +230,7 @@ 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, fsp->fh->fd, data, n);
+ result = SMB_VFS_READ(fsp, data, n);
fsp->fh->pos = 0;
}
@@ -241,7 +241,7 @@ static ssize_t vfswrap_pread(vfs_handle_struct *handle, files_struct *fsp, void
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, fsp->fh->fd, data, n);
+ result = SMB_VFS_READ(fsp, data, n);
fsp->fh->pos = 0;
return result;
}
@@ -251,7 +251,7 @@ static ssize_t vfswrap_pread(vfs_handle_struct *handle, files_struct *fsp, void
}
errno = 0;
- result = SMB_VFS_READ(fsp, fsp->fh->fd, data, n);
+ result = SMB_VFS_READ(fsp, data, n);
lerrno = errno;
SMB_VFS_LSEEK(fsp, curr, SEEK_SET);
@@ -262,12 +262,12 @@ 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, int fd, const void *data, size_t n)
+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(fd, data, n);
+ result = sys_write(fsp->fh->fd, data, n);
END_PROFILE(syscall_write);
return result;
}
@@ -284,7 +284,7 @@ static ssize_t vfswrap_pwrite(vfs_handle_struct *handle, files_struct *fsp, cons
if (result == -1 && errno == ESPIPE) {
/* Maintain the fiction that pipes can be sought on. */
- result = SMB_VFS_WRITE(fsp, fsp->fh->fd, data, n);
+ result = SMB_VFS_WRITE(fsp, data, n);
}
#else /* HAVE_PWRITE */
@@ -300,7 +300,7 @@ static ssize_t vfswrap_pwrite(vfs_handle_struct *handle, files_struct *fsp, cons
return -1;
}
- result = SMB_VFS_WRITE(fsp, fsp->fh->fd, data, n);
+ result = SMB_VFS_WRITE(fsp, data, n);
lerrno = errno;
SMB_VFS_LSEEK(fsp, curr, SEEK_SET);
@@ -337,28 +337,27 @@ static SMB_OFF_T vfswrap_lseek(vfs_handle_struct *handle, files_struct *fsp, SMB
return result;
}
-static ssize_t vfswrap_sendfile(vfs_handle_struct *handle, int tofd, files_struct *fsp, int fromfd, const DATA_BLOB *hdr,
+static ssize_t vfswrap_sendfile(vfs_handle_struct *handle, int tofd, files_struct *fromfsp, const DATA_BLOB *hdr,
SMB_OFF_T offset, size_t n)
{
ssize_t result;
START_PROFILE_BYTES(syscall_sendfile, n);
- result = sys_sendfile(tofd, fromfd, hdr, offset, n);
+ result = sys_sendfile(tofd, fromfsp->fh->fd, hdr, offset, n);
END_PROFILE(syscall_sendfile);
return result;
}
static ssize_t vfswrap_recvfile(vfs_handle_struct *handle,
int fromfd,
- files_struct *fsp,
- int tofd,
+ files_struct *tofsp,
SMB_OFF_T offset,
size_t n)
{
ssize_t result;
START_PROFILE_BYTES(syscall_recvfile, n);
- result = sys_recvfile(fromfd, tofd, offset, n);
+ result = sys_recvfile(fromfd, tofsp->fh->fd, offset, n);
END_PROFILE(syscall_recvfile);
return result;
}
@@ -712,7 +711,7 @@ static int strict_allocate_ftruncate(vfs_handle_struct *handle, files_struct *fs
SMB_OFF_T retlen;
SMB_OFF_T current_len_to_write = MIN(sizeof(zero_space),space_to_write);
- retlen = SMB_VFS_WRITE(fsp,fsp->fh->fd,(char *)zero_space,current_len_to_write);
+ retlen = SMB_VFS_WRITE(fsp,(char *)zero_space,current_len_to_write);
if (retlen <= 0)
return -1;
@@ -787,7 +786,7 @@ static int vfswrap_ftruncate(vfs_handle_struct *handle, files_struct *fsp, SMB_O
if (SMB_VFS_LSEEK(fsp, len-1, SEEK_SET) != len -1)
goto done;
- if (SMB_VFS_WRITE(fsp, fsp->fh->fd, &c, 1)!=1)
+ if (SMB_VFS_WRITE(fsp, &c, 1)!=1)
goto done;
/* Seek to where we were */
diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c
index 95fdc17d56..5aa9bab5b5 100644
--- a/source3/modules/vfs_full_audit.c
+++ b/source3/modules/vfs_full_audit.c
@@ -113,22 +113,22 @@ static int smb_full_audit_open(vfs_handle_struct *handle,
const char *fname, files_struct *fsp, int flags, mode_t mode);
static int smb_full_audit_close(vfs_handle_struct *handle, files_struct *fsp, int fd);
static ssize_t smb_full_audit_read(vfs_handle_struct *handle, files_struct *fsp,
- int fd, void *data, size_t n);
+ void *data, size_t n);
static ssize_t smb_full_audit_pread(vfs_handle_struct *handle, files_struct *fsp,
void *data, size_t n, SMB_OFF_T offset);
static ssize_t smb_full_audit_write(vfs_handle_struct *handle, files_struct *fsp,
- int fd, const void *data, size_t n);
+ const void *data, size_t n);
static ssize_t smb_full_audit_pwrite(vfs_handle_struct *handle, files_struct *fsp,
const void *data, size_t n,
SMB_OFF_T offset);
static SMB_OFF_T smb_full_audit_lseek(vfs_handle_struct *handle, files_struct *fsp,
SMB_OFF_T offset, int whence);
static ssize_t smb_full_audit_sendfile(vfs_handle_struct *handle, int tofd,
- files_struct *fsp, int fromfd,
+ files_struct *fromfsp,
const DATA_BLOB *hdr, SMB_OFF_T offset,
size_t n);
static ssize_t smb_full_audit_recvfile(vfs_handle_struct *handle, int fromfd,
- files_struct *fsp, int tofd,
+ files_struct *tofsp,
SMB_OFF_T offset,
size_t n);
static int smb_full_audit_rename(vfs_handle_struct *handle,
@@ -1087,11 +1087,11 @@ static int smb_full_audit_close(vfs_handle_struct *handle, files_struct *fsp, in
}
static ssize_t smb_full_audit_read(vfs_handle_struct *handle, files_struct *fsp,
- int fd, void *data, size_t n)
+ void *data, size_t n)
{
ssize_t result;
- result = SMB_VFS_NEXT_READ(handle, fsp, fd, data, n);
+ result = SMB_VFS_NEXT_READ(handle, fsp, data, n);
do_log(SMB_VFS_OP_READ, (result >= 0), handle, "%s", fsp->fsp_name);
@@ -1111,11 +1111,11 @@ static ssize_t smb_full_audit_pread(vfs_handle_struct *handle, files_struct *fsp
}
static ssize_t smb_full_audit_write(vfs_handle_struct *handle, files_struct *fsp,
- int fd, const void *data, size_t n)
+ const void *data, size_t n)
{
ssize_t result;
- result = SMB_VFS_NEXT_WRITE(handle, fsp, fd, data, n);
+ result = SMB_VFS_NEXT_WRITE(handle, fsp, data, n);
do_log(SMB_VFS_OP_WRITE, (result >= 0), handle, "%s", fsp->fsp_name);
@@ -1149,33 +1149,31 @@ static SMB_OFF_T smb_full_audit_lseek(vfs_handle_struct *handle, files_struct *f
}
static ssize_t smb_full_audit_sendfile(vfs_handle_struct *handle, int tofd,
- files_struct *fsp, int fromfd,
+ files_struct *fromfsp,
const DATA_BLOB *hdr, SMB_OFF_T offset,
size_t n)
{
ssize_t result;
- result = SMB_VFS_NEXT_SENDFILE(handle, tofd, fsp, fromfd, hdr,
- offset, n);
+ result = SMB_VFS_NEXT_SENDFILE(handle, tofd, fromfsp, hdr, offset, n);
do_log(SMB_VFS_OP_SENDFILE, (result >= 0), handle,
- "%s", fsp->fsp_name);
+ "%s", fromfsp->fsp_name);
return result;
}
static ssize_t smb_full_audit_recvfile(vfs_handle_struct *handle, int fromfd,
- files_struct *fsp, int tofd,
+ files_struct *tofsp,
SMB_OFF_T offset,
size_t n)
{
ssize_t result;
- result = SMB_VFS_NEXT_RECVFILE(handle, fromfd, fsp, tofd,
- offset, n);
+ result = SMB_VFS_NEXT_RECVFILE(handle, fromfd, tofsp, offset, n);
do_log(SMB_VFS_OP_RECVFILE, (result >= 0), handle,
- "%s", fsp->fsp_name);
+ "%s", tofsp->fsp_name);
return result;
}
diff --git a/source3/modules/vfs_readahead.c b/source3/modules/vfs_readahead.c
index b3642d558f..df75814b72 100644
--- a/source3/modules/vfs_readahead.c
+++ b/source3/modules/vfs_readahead.c
@@ -35,8 +35,7 @@ struct readahead_data {
static ssize_t readahead_sendfile(struct vfs_handle_struct *handle,
int tofd,
- files_struct *fsp,
- int fromfd,
+ files_struct *fromfsp,
const DATA_BLOB *header,
SMB_OFF_T offset,
size_t count)
@@ -45,16 +44,16 @@ static ssize_t readahead_sendfile(struct vfs_handle_struct *handle,
if ( offset % rhd->off_bound == 0) {
#if defined(HAVE_LINUX_READAHEAD)
- int err = readahead(fromfd, offset, (size_t)rhd->len);
+ int err = readahead(fromfsp->fh->fd, offset, (size_t)rhd->len);
DEBUG(10,("readahead_sendfile: readahead on fd %u, offset %llu, len %u returned %d\n",
- (unsigned int)fromfd,
+ (unsigned int)fromfsp->fh->fd,
(unsigned long long)offset,
(unsigned int)rhd->len,
err ));
#elif defined(HAVE_POSIX_FADVISE)
- int err = posix_fadvise(fromfd, offset, (off_t)rhd->len, POSIX_FADV_WILLNEED);
+ int err = posix_fadvise(fromfsp->fh->fd, offset, (off_t)rhd->len, POSIX_FADV_WILLNEED);
DEBUG(10,("readahead_sendfile: posix_fadvise on fd %u, offset %llu, len %u returned %d\n",
- (unsigned int)fromfd,
+ (unsigned int)fromfsp->fh->fd,
(unsigned long long)offset,
(unsigned int)rhd->len,
err ));
@@ -67,8 +66,7 @@ static ssize_t readahead_sendfile(struct vfs_handle_struct *handle,
}
return SMB_VFS_NEXT_SENDFILE(handle,
tofd,
- fsp,
- fromfd,
+ fromfsp,
header,
offset,
count);