vm_sockets_get_local_cid() is only used in virtio_transport_common.c. We can replace it calling the virtio_transport_get_ops() and using the get_local_cid() callback registered by the transport.
Unified · Split
| @@ -10,6 +10,4 @@ · 9 unmodified lines | ||
| 10 | 10 | |
| 11 | 11 | #include <uapi/linux/vm_sockets.h> |
| 12 | 12 | |
| 13 | −int vm_sockets_get_local_cid(void); | |
| 14 | − | |
| 15 | 13 | #endif /* _VM_SOCKETS_H */ |
| @@ -129,16 +129,6 @@ static struct proto vsock_proto = { · 128 unmodified lines | ||
| 129 | 129 | static const struct vsock_transport *transport; |
| 130 | 130 | static DEFINE_MUTEX(vsock_register_mutex); |
| 131 | 131 | |
| 132 | −/**** EXPORTS ****/ | |
| 133 | − | |
| 134 | −/* Get the ID of the local context. This is transport dependent. */ | |
| 135 | − | |
| 136 | −int vm_sockets_get_local_cid(void) | |
| 137 | −{ | |
| 138 | − return transport->get_local_cid(); | |
| 139 | −} | |
| 140 | −EXPORT_SYMBOL_GPL(vm_sockets_get_local_cid); | |
| 141 | − | |
| 142 | 132 | /**** UTILS ****/ |
| 143 | 133 | |
| 144 | 134 | /* Each bound VSocket is stored in the bind hash table and each connected |
| @@ -168,7 +168,7 @@ static int virtio_transport_send_pkt_info(struct vsock_sock *vsk, · 167 unmodified lines | ||
| 168 | 168 | struct virtio_vsock_pkt *pkt; |
| 169 | 169 | u32 pkt_len = info->pkt_len; |
| 170 | 170 | |
| 171 | − src_cid = vm_sockets_get_local_cid(); | |
| 171 | + src_cid = virtio_transport_get_ops()->transport.get_local_cid(); | |
| 172 | 172 | src_port = vsk->local_addr.svm_port; |
| 173 | 173 | if (!info->remote_cid) { |
| 174 | 174 | dst_cid = vsk->remote_addr.svm_cid; |