s3:libsmb: move cli_state->fd to cli_state->conn.fd
authorStefan Metzmacher <metze@samba.org>
Fri, 22 Jul 2011 07:39:52 +0000 (09:39 +0200)
committerStefan Metzmacher <metze@samba.org>
Fri, 22 Jul 2011 15:06:07 +0000 (17:06 +0200)
metze

source3/include/client.h
source3/libsmb/async_smb.c
source3/libsmb/clientgen.c
source3/libsmb/clierror.c
source3/libsmb/smb2cli_base.c

index 26b8fcb4056751486b315b965bedef4d0d46089b..4043774e22eab15d8879741e1a420971ed2a2b95 100644 (file)
@@ -51,7 +51,6 @@ struct cli_state {
         * A list of subsidiary connections for DFS.
         */
         struct cli_state *prev, *next;
-       int fd;
        int protocol;
        int sec_mode;
        int rap_error;
@@ -125,6 +124,7 @@ struct cli_state {
        char *dfs_mountpoint;
 
        struct {
+               int fd;
                struct tevent_queue *outgoing;
                struct tevent_req **pending;
        } conn;
index 724e8b7d4f41ee57e5eb6e372ea2ffd239c2d5a5..87614bd3265381ab818aa030aa71c4a1ccfb9ac1 100644 (file)
@@ -215,7 +215,7 @@ bool cli_smb_req_set_pending(struct tevent_req *req)
         * We're the first ones, add the read_smb request that waits for the
         * answer from the server
         */
-       subreq = read_smb_send(cli->conn.pending, state->ev, cli->fd);
+       subreq = read_smb_send(cli->conn.pending, state->ev, cli->conn.fd);
        if (subreq == NULL) {
                cli_smb_req_unset_pending(req);
                return false;
@@ -431,7 +431,7 @@ static NTSTATUS cli_smb_req_iov_send(struct tevent_req *req,
                iov_count = 1;
        }
        subreq = writev_send(state, state->ev, state->cli->conn.outgoing,
-                            state->cli->fd, false, iov, iov_count);
+                            state->cli->conn.fd, false, iov, iov_count);
        if (subreq == NULL) {
                return NT_STATUS_NO_MEMORY;
        }
@@ -649,7 +649,7 @@ static void cli_smb_received(struct tevent_req *subreq)
                 */
                state = tevent_req_data(cli->conn.pending[0],
                                        struct cli_smb_state);
-               subreq = read_smb_send(cli->conn.pending, state->ev, cli->fd);
+               subreq = read_smb_send(cli->conn.pending, state->ev, cli->conn.fd);
                if (subreq == NULL) {
                        status = NT_STATUS_NO_MEMORY;
                        goto fail;
index 7a417ec6c02e13acd1fada3374820909391254c5..ca6201e6bb8c231cc4acdeb46e6dd768a07ef6a2 100644 (file)
@@ -187,7 +187,6 @@ struct cli_state *cli_state_create(TALLOC_CTX *mem_ctx,
        if (!cli->dfs_mountpoint) {
                goto error;
        }
-       cli->fd = -1;
        cli->raw_status = NT_STATUS_INTERNAL_ERROR;
        cli->protocol = PROTOCOL_NT1;
        cli->timeout = 20000; /* Timeout is in milliseconds. */
@@ -244,7 +243,7 @@ struct cli_state *cli_state_create(TALLOC_CTX *mem_ctx,
                goto error;
        }
 
-       cli->fd = fd;
+       cli->conn.fd = fd;
 
        ss_length = sizeof(cli->src_ss);
        ret = getsockname(fd,
@@ -364,7 +363,7 @@ void cli_shutdown(struct cli_state *cli)
 
 void cli_sockopt(struct cli_state *cli, const char *options)
 {
-       set_socket_options(cli->fd, options);
+       set_socket_options(cli->conn.fd, options);
 }
 
 uint16_t cli_state_get_vc_num(struct cli_state *cli)
index 92c2cc28154ed97ae1ab810fab941146cc7c49e8..4ff5d9193b2ed4728a0644a7ef020035e3ad0d72 100644 (file)
@@ -187,7 +187,7 @@ bool cli_state_is_connected(struct cli_state *cli)
                return false;
        }
 
-       if (cli->fd == -1) {
+       if (cli->conn.fd == -1) {
                return false;
        }
 
@@ -196,8 +196,8 @@ bool cli_state_is_connected(struct cli_state *cli)
 
 void cli_state_disconnect(struct cli_state *cli)
 {
-       if (cli->fd != -1) {
-               close(cli->fd);
+       if (cli->conn.fd != -1) {
+               close(cli->conn.fd);
        }
-       cli->fd = -1;
+       cli->conn.fd = -1;
 }
index a1ecfb4e38928b56a53b7548f6e2ae97b41f7059..88b890438ab328e69c6defd17bbcc7725f36c1a7 100644 (file)
@@ -132,7 +132,7 @@ static bool smb2cli_req_set_pending(struct tevent_req *req)
         * We're the first ones, add the read_smb request that waits for the
         * answer from the server
         */
-       subreq = read_smb_send(cli->conn.pending, state->ev, cli->fd);
+       subreq = read_smb_send(cli->conn.pending, state->ev, cli->conn.fd);
        if (subreq == NULL) {
                smb2cli_req_unset_pending(req);
                return false;
@@ -143,10 +143,10 @@ static bool smb2cli_req_set_pending(struct tevent_req *req)
 
 static void smb2cli_notify_pending(struct cli_state *cli, NTSTATUS status)
 {
-       if (cli->fd != -1) {
-               close(cli->fd);
-               cli->fd = -1;
+       if (cli->conn.fd != -1) {
+               close(cli->conn.fd);
        }
+       cli->conn.fd = -1;
 
        /*
         * Cancel all pending requests. We don't do a for-loop walking
@@ -294,7 +294,7 @@ NTSTATUS smb2cli_req_compound_submit(struct tevent_req **reqs,
        iov[0].iov_len  = sizeof(state->nbt);
 
        subreq = writev_send(state, state->ev, state->cli->conn.outgoing,
-                            state->cli->fd, false, iov, num_iov);
+                            state->cli->conn.fd, false, iov, num_iov);
        if (subreq == NULL) {
                return NT_STATUS_NO_MEMORY;
        }
@@ -572,7 +572,7 @@ static void smb2cli_inbuf_received(struct tevent_req *subreq)
         * add the read_smb request that waits for the
         * next answer from the server
         */
-       subreq = read_smb_send(cli->conn.pending, state->ev, cli->fd);
+       subreq = read_smb_send(cli->conn.pending, state->ev, cli->conn.fd);
        if (subreq == NULL) {
                smb2cli_notify_pending(cli, NT_STATUS_NO_MEMORY);
                return;