summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2008-01-10 13:30:43 +0100
committerMichael Adam <obnox@samba.org>2008-01-10 13:30:46 +0100
commit5661ac6a389620ac543a384832de9ee9b64893c7 (patch)
tree0d606250a2d50ae2a5617697f67dfa775bd77674 /source3/smbd
parent9f67ee6334f36f30ddfc2e86459cb764bccf1edf (diff)
downloadsamba-5661ac6a389620ac543a384832de9ee9b64893c7.tar.gz
samba-5661ac6a389620ac543a384832de9ee9b64893c7.tar.bz2
samba-5661ac6a389620ac543a384832de9ee9b64893c7.zip
Correctly abstract the transfer_file mechanism with callbacks and void ptrs.
This removes the in_fsp and out_fsp global variables hack from smbd/vfs.c. Michael (This used to be commit b2e7cdc6e899ca3c16edbb6c8786ff9aa999fa6e)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/vfs.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c
index bb4e77ed31..b6b6b1c0f1 100644
--- a/source3/smbd/vfs.c
+++ b/source3/smbd/vfs.c
@@ -662,25 +662,23 @@ int vfs_fill_sparse(files_struct *fsp, SMB_OFF_T len)
Transfer some data (n bytes) between two file_struct's.
****************************************************************************/
-static files_struct *in_fsp;
-static files_struct *out_fsp;
-
-static ssize_t read_fn(int fd, void *buf, size_t len)
+static ssize_t vfs_read_fn(void *file, void *buf, size_t len)
{
- return SMB_VFS_READ(in_fsp, fd, buf, len);
+ struct files_struct *fsp = (struct files_struct *)file;
+
+ return SMB_VFS_READ(fsp, fsp->fh->fd, buf, len);
}
-static ssize_t write_fn(int fd, const void *buf, size_t len)
+static ssize_t vfs_write_fn(void *file, const void *buf, size_t len)
{
- return SMB_VFS_WRITE(out_fsp, fd, buf, len);
+ struct files_struct *fsp = (struct files_struct *)file;
+
+ return SMB_VFS_WRITE(fsp, fsp->fh->fd, buf, len);
}
SMB_OFF_T vfs_transfer_file(files_struct *in, files_struct *out, SMB_OFF_T n)
{
- in_fsp = in;
- out_fsp = out;
-
- return transfer_file_internal(in_fsp->fh->fd, out_fsp->fh->fd, n, read_fn, write_fn);
+ return transfer_file_internal(in, out, n, vfs_read_fn, vfs_write_fn);
}
/*******************************************************************