diff options
author | Tim Potter <tpot@samba.org> | 2004-02-08 00:51:07 +0000 |
---|---|---|
committer | Tim Potter <tpot@samba.org> | 2004-02-08 00:51:07 +0000 |
commit | 4639eb5a58f8c0906afdc8e8f8f67f82e9547f75 (patch) | |
tree | 2115d25166961cea7d49836d53a05e98c796ff8a /source4/libcli/clireadwrite.c | |
parent | f0c9a54b30cfa627b4ddcbc24fe943b21472df34 (diff) | |
download | samba-4639eb5a58f8c0906afdc8e8f8f67f82e9547f75.tar.gz samba-4639eb5a58f8c0906afdc8e8f8f67f82e9547f75.tar.bz2 samba-4639eb5a58f8c0906afdc8e8f8f67f82e9547f75.zip |
Convert libcli routines to use cli_tree instead of cli_state. Port
smbtorture to use the new interface.
Part 2 will be to eliminate cli_state from smbtorture as this is now
the only place where it is used.
(This used to be commit db1cc96af62ea42837d60592877fc3f93cef143b)
Diffstat (limited to 'source4/libcli/clireadwrite.c')
-rw-r--r-- | source4/libcli/clireadwrite.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/source4/libcli/clireadwrite.c b/source4/libcli/clireadwrite.c index 1e6c0fc064..7b47281e2c 100644 --- a/source4/libcli/clireadwrite.c +++ b/source4/libcli/clireadwrite.c @@ -24,7 +24,8 @@ /**************************************************************************** Read size bytes at offset offset using SMBreadX. ****************************************************************************/ -ssize_t cli_read(struct cli_state *cli, int fnum, char *buf, off_t offset, size_t size) +ssize_t cli_read(struct cli_tree *tree, int fnum, char *buf, off_t offset, + size_t size) { union smb_read parms; int readsize; @@ -41,7 +42,8 @@ ssize_t cli_read(struct cli_state *cli, int fnum, char *buf, off_t offset, size_ * Set readsize to the maximum size we can handle in one readX, * rounded down to a multiple of 1024. */ - readsize = (cli->transport->negotiate.max_xmit - (MIN_SMB_SIZE+32)) & ~1023; + readsize = (tree->session->transport->negotiate.max_xmit - + (MIN_SMB_SIZE+32)) & ~1023; if (readsize > 0xFFFF) readsize = 0xFFFF; while (total < size) { @@ -55,7 +57,7 @@ ssize_t cli_read(struct cli_state *cli, int fnum, char *buf, off_t offset, size_ parms.readx.in.remaining = size - total; parms.readx.out.data = buf + total; - status = smb_raw_read(cli->tree, &parms); + status = smb_raw_read(tree, &parms); if (!NT_STATUS_IS_OK(status)) { return -1; @@ -80,12 +82,12 @@ ssize_t cli_read(struct cli_state *cli, int fnum, char *buf, off_t offset, size_ 0x0004 use raw named pipe protocol 0x0008 start of message mode named pipe protocol ****************************************************************************/ -ssize_t cli_write(struct cli_state *cli, +ssize_t cli_write(struct cli_tree *tree, int fnum, uint16 write_mode, const char *buf, off_t offset, size_t size) { union smb_write parms; - int block = (cli->transport->negotiate.max_xmit - (MIN_SMB_SIZE+32)) & ~1023; + int block = (tree->session->transport->negotiate.max_xmit - (MIN_SMB_SIZE+32)) & ~1023; ssize_t total = 0; if (size == 0) { @@ -109,7 +111,7 @@ ssize_t cli_write(struct cli_state *cli, parms.writex.in.count = block; parms.writex.in.data = buf; - status = smb_raw_write(cli->tree, &parms); + status = smb_raw_write(tree, &parms); if (!NT_STATUS_IS_OK(status)) { return -1; @@ -126,7 +128,7 @@ ssize_t cli_write(struct cli_state *cli, /**************************************************************************** write to a file using a SMBwrite and not bypassing 0 byte writes ****************************************************************************/ -ssize_t cli_smbwrite(struct cli_state *cli, +ssize_t cli_smbwrite(struct cli_tree *tree, int fnum, char *buf, off_t offset, size_t size1) { union smb_write parms; @@ -136,7 +138,7 @@ ssize_t cli_smbwrite(struct cli_state *cli, parms.write.in.remaining = 0; do { - size_t size = MIN(size1, cli->transport->negotiate.max_xmit - 48); + size_t size = MIN(size1, tree->session->transport->negotiate.max_xmit - 48); if (size > 0xFFFF) size = 0xFFFF; parms.write.in.fnum = fnum; @@ -144,7 +146,7 @@ ssize_t cli_smbwrite(struct cli_state *cli, parms.write.in.count = size; parms.write.in.data = buf + total; - if (NT_STATUS_IS_ERR(smb_raw_write(cli->tree, &parms))) + if (NT_STATUS_IS_ERR(smb_raw_write(tree, &parms))) return -1; size = parms.write.out.nwritten; |