s3:libsmb: remove unused cli_readall*
authorStefan Metzmacher <metze@samba.org>
Tue, 13 Aug 2013 16:23:55 +0000 (18:23 +0200)
committerStefan Metzmacher <metze@samba.org>
Thu, 15 Aug 2013 07:07:06 +0000 (09:07 +0200)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/libsmb/clireadwrite.c

index dd5d4c2865b2a4c4ced67be79bf6d529cbb42da0..10dc79b0397b1cbfe04fc38e76caa7bec5e0fa17 100644 (file)
@@ -269,125 +269,6 @@ NTSTATUS cli_read_andx_recv(struct tevent_req *req, ssize_t *received,
        return NT_STATUS_OK;
 }
 
-struct cli_readall_state {
-       struct tevent_context *ev;
-       struct cli_state *cli;
-       uint16_t fnum;
-       off_t start_offset;
-       size_t size;
-       size_t received;
-       uint8_t *buf;
-};
-
-static void cli_readall_done(struct tevent_req *subreq);
-
-static struct tevent_req *cli_readall_send(TALLOC_CTX *mem_ctx,
-                                          struct tevent_context *ev,
-                                          struct cli_state *cli,
-                                          uint16_t fnum,
-                                          off_t offset, size_t size)
-{
-       struct tevent_req *req, *subreq;
-       struct cli_readall_state *state;
-
-       req = tevent_req_create(mem_ctx, &state, struct cli_readall_state);
-       if (req == NULL) {
-               return NULL;
-       }
-       state->ev = ev;
-       state->cli = cli;
-       state->fnum = fnum;
-       state->start_offset = offset;
-       state->size = size;
-       state->received = 0;
-       state->buf = NULL;
-
-       subreq = cli_read_andx_send(state, ev, cli, fnum, offset, size);
-       if (tevent_req_nomem(subreq, req)) {
-               return tevent_req_post(req, ev);
-       }
-       tevent_req_set_callback(subreq, cli_readall_done, req);
-       return req;
-}
-
-static void cli_readall_done(struct tevent_req *subreq)
-{
-       struct tevent_req *req = tevent_req_callback_data(
-               subreq, struct tevent_req);
-       struct cli_readall_state *state = tevent_req_data(
-               req, struct cli_readall_state);
-       ssize_t received;
-       uint8_t *buf;
-       NTSTATUS status;
-
-       status = cli_read_andx_recv(subreq, &received, &buf);
-       if (tevent_req_nterror(req, status)) {
-               return;
-       }
-
-       if (received == 0) {
-               /* EOF */
-               tevent_req_done(req);
-               return;
-       }
-
-       if ((state->received == 0) && (received == state->size)) {
-               /* Ideal case: Got it all in one run */
-               state->buf = buf;
-               state->received += received;
-               tevent_req_done(req);
-               return;
-       }
-
-       /*
-        * We got a short read, issue a read for the
-        * rest. Unfortunately we have to allocate the buffer
-        * ourselves now, as our caller expects to receive a single
-        * buffer. cli_read_andx does it from the buffer received from
-        * the net, but with a short read we have to put it together
-        * from several reads.
-        */
-
-       if (state->buf == NULL) {
-               state->buf = talloc_array(state, uint8_t, state->size);
-               if (tevent_req_nomem(state->buf, req)) {
-                       return;
-               }
-       }
-       memcpy(state->buf + state->received, buf, received);
-       state->received += received;
-
-       TALLOC_FREE(subreq);
-
-       if (state->received >= state->size) {
-               tevent_req_done(req);
-               return;
-       }
-
-       subreq = cli_read_andx_send(state, state->ev, state->cli, state->fnum,
-                                   state->start_offset + state->received,
-                                   state->size - state->received);
-       if (tevent_req_nomem(subreq, req)) {
-               return;
-       }
-       tevent_req_set_callback(subreq, cli_readall_done, req);
-}
-
-static NTSTATUS cli_readall_recv(struct tevent_req *req, ssize_t *received,
-                                uint8_t **rcvbuf)
-{
-       struct cli_readall_state *state = tevent_req_data(
-               req, struct cli_readall_state);
-       NTSTATUS status;
-
-       if (tevent_req_is_nterror(req, &status)) {
-               return status;
-       }
-       *received = state->received;
-       *rcvbuf = state->buf;
-       return NT_STATUS_OK;
-}
-
 struct cli_pull_chunk;
 
 struct cli_pull_state {