]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smb2_server: move struct msghdr to smbd_smb2_request_read_state
authorStefan Metzmacher <metze@samba.org>
Thu, 15 Apr 2021 07:53:03 +0000 (09:53 +0200)
committerJeremy Allison <jra@samba.org>
Wed, 6 Sep 2023 19:30:35 +0000 (19:30 +0000)
This makes the code a little bit faster, but the main reason
is the preparation of io_uring support, as it can't be on the
stack for async operations.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/smbd/globals.h
source3/smbd/smb2_server.c

index 69023fcc50a192647640a8edecec59124346aad7..d071dc4c23b4dcbabf82c32d59040c06d4e83fe1 100644 (file)
@@ -463,6 +463,7 @@ struct smbXsrv_connection {
                                bool done;
                        } hdr;
                        struct iovec vector;
+                       struct msghdr msg;
                        bool doing_receivefile;
                        size_t min_recv_size;
                        size_t pktfull;
index 2dbb89d4b5830ba649f79fc61ee3719152c5cca9..b0a475ec8c1cb0d75f4c2891f128ac5b35ff2577 100644 (file)
@@ -4888,7 +4888,6 @@ static NTSTATUS smbd_smb2_io_handler(struct smbXsrv_connection *xconn,
        bool retry;
        NTSTATUS status;
        NTTIME now;
-       struct msghdr msg;
 
        if (!NT_STATUS_IS_OK(xconn->transport.status)) {
                /*
@@ -4923,7 +4922,7 @@ again:
                state->vector.iov_len = NBT_HDR_SIZE;
        }
 
-       msg = (struct msghdr) {
+       state->msg = (struct msghdr) {
                .msg_iov = &state->vector,
                .msg_iovlen = 1,
        };
@@ -4935,7 +4934,7 @@ again:
        recvmsg_flags |= MSG_DONTWAIT;
 #endif
 
-       ret = recvmsg(xconn->transport.sock, &msg, recvmsg_flags);
+       ret = recvmsg(xconn->transport.sock, &state->msg, recvmsg_flags);
        if (ret == 0) {
                /* propagate end of file */
                status = NT_STATUS_END_OF_FILE;