]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
net: pass const to msg_data_left()
authorBreno Leitao <leitao@debian.org>
Tue, 8 Apr 2025 18:32:01 +0000 (11:32 -0700)
committerJakub Kicinski <kuba@kernel.org>
Fri, 11 Apr 2025 01:34:05 +0000 (18:34 -0700)
The msg_data_left() function doesn't modify the struct msghdr parameter,
so mark it as const. This allows the function to be used with const
references, improving type safety and making the API more flexible.

Signed-off-by: Breno Leitao <leitao@debian.org>
Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Link: https://patch.msgid.link/20250408-tcpsendmsg-v3-1-208b87064c28@debian.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
include/linux/socket.h

index c3322eb3d6865d5ef90ea7891d2aa98d3efe4f6d..3b262487ec06032b885cad017ec828cc6a4142db 100644 (file)
@@ -168,7 +168,7 @@ static inline struct cmsghdr * cmsg_nxthdr (struct msghdr *__msg, struct cmsghdr
        return __cmsg_nxthdr(__msg->msg_control, __msg->msg_controllen, __cmsg);
 }
 
-static inline size_t msg_data_left(struct msghdr *msg)
+static inline size_t msg_data_left(const struct msghdr *msg)
 {
        return iov_iter_count(&msg->msg_iter);
 }