Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

VSOCK: constify vmci_transport_notify_ops structures

The vmci_transport_notify_ops structures are never modified, so declare
them as const.

Done with the help of Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Julia Lawall and committed by
David S. Miller
3b22dae3 4dd191bb

+6 -5
+1 -1
net/vmw_vsock/vmci_transport.h
··· 121 121 u64 queue_pair_max_size; 122 122 u32 detach_sub_id; 123 123 union vmci_transport_notify notify; 124 - struct vmci_transport_notify_ops *notify_ops; 124 + const struct vmci_transport_notify_ops *notify_ops; 125 125 struct list_head elem; 126 126 struct sock *sk; 127 127 spinlock_t lock; /* protects sk. */
+1 -1
net/vmw_vsock/vmci_transport_notify.c
··· 661 661 } 662 662 663 663 /* Socket control packet based operations. */ 664 - struct vmci_transport_notify_ops vmci_transport_notify_pkt_ops = { 664 + const struct vmci_transport_notify_ops vmci_transport_notify_pkt_ops = { 665 665 vmci_transport_notify_pkt_socket_init, 666 666 vmci_transport_notify_pkt_socket_destruct, 667 667 vmci_transport_notify_pkt_poll_in,
+3 -2
net/vmw_vsock/vmci_transport_notify.h
··· 77 77 void (*process_negotiate) (struct sock *sk); 78 78 }; 79 79 80 - extern struct vmci_transport_notify_ops vmci_transport_notify_pkt_ops; 81 - extern struct vmci_transport_notify_ops vmci_transport_notify_pkt_q_state_ops; 80 + extern const struct vmci_transport_notify_ops vmci_transport_notify_pkt_ops; 81 + extern const 82 + struct vmci_transport_notify_ops vmci_transport_notify_pkt_q_state_ops; 82 83 83 84 #endif /* __VMCI_TRANSPORT_NOTIFY_H__ */
+1 -1
net/vmw_vsock/vmci_transport_notify_qstate.c
··· 419 419 } 420 420 421 421 /* Socket always on control packet based operations. */ 422 - struct vmci_transport_notify_ops vmci_transport_notify_pkt_q_state_ops = { 422 + const struct vmci_transport_notify_ops vmci_transport_notify_pkt_q_state_ops = { 423 423 vmci_transport_notify_pkt_socket_init, 424 424 vmci_transport_notify_pkt_socket_destruct, 425 425 vmci_transport_notify_pkt_poll_in,