Skip to contentSkip to conversation

af_unix: move proto info out of CONFIG_BPF_SYSCALL

PATCH In review Ben Dooks 2 participants 2 messages Jun 23 – Jun 24

Subsystems (3)
lore
Share & tools
lore

Ben Dooks

author
#0 lore raw

PATCH 1/1 af_unix: move proto info out of CONFIG_BPF_SYSCALL

These two structs are defined even if CONFIG_BPF_SYSCALL but the header does not export them, so declare them anyway and move the check for CONFIG_BPF_SYSCALL lower into the file.

This removes the two sparse warnings:
net/unix/af_unix.c:1060:14: warning: symbol 'unix_dgram_proto' was not declared. Should it be static? net/unix/af_unix.c:1071:14: warning: symbol 'unix_stream_proto' was not declared. Should it be static?

This change is less complicated than trying to make those two structs static based on the CONFIG_BPF_SYSCALL configuration.

---
 net/unix/af_unix.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/unix/af_unix.h +1 -1
index 8119dbeef3a3..2a6a26b3a2db 100644
@@ -55,10 +55,10 @@ static inline void unix_sysctl_unregister(struct net *net)
 int __unix_dgram_recvmsg(struct sock *sk, struct msghdr *msg, size_t size, int flags);
 int __unix_stream_recvmsg(struct sock *sk, struct msghdr *msg, size_t size, int flags);
 
-#ifdef CONFIG_BPF_SYSCALL
 extern struct proto unix_dgram_proto;
 extern struct proto unix_stream_proto;
 
+#ifdef CONFIG_BPF_SYSCALL
 int unix_dgram_bpf_update_proto(struct sock *sk, struct sk_psock *psock, bool restore);
 int unix_stream_bpf_update_proto(struct sock *sk, struct sk_psock *psock, bool restore);
 void __init unix_bpf_build_proto(void);
Signature · 1 line
2.37.2.352.g3c44437643
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Ben Dooks

These two structs are defined even if CONFIG_BPF_SYSCALL but the header does not export them, so declare them anyway and move the check for CONFIG_BPF_SYSCALL lower into the file.

Quoted 8 lines

This removes the two sparse warnings:
net/unix/af_unix.c:1060:14: warning: symbol 'unix_dgram_proto' was not declared. Should it be static? net/unix/af_unix.c:1071:14: warning: symbol 'unix_stream_proto' was not declared. Should it be static?

This change is less complicated than trying to make those two structs static based on the CONFIG_BPF_SYSCALL configuration.

Probably this is net-next material and if so should be reposted once net-next reopens next week.