Skip to content

Commit 8a681a2

Browse files
committed
virtio/vsock: Fix clippy warnings
Signed-off-by: Tyler Fanelli <[email protected]>
1 parent 2e5d828 commit 8a681a2

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/devices/src/virtio/vsock/device.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ pub(crate) const EVQ_INDEX: usize = 2;
3333
/// - VIRTIO_F_VERSION_1: the device conforms to at least version 1.0 of the VirtIO spec.
3434
/// - VIRTIO_F_IN_ORDER: the device returns used buffers in the same order that the driver makes
3535
/// them available.
36-
pub(crate) const AVAIL_FEATURES: u64 = 1 << uapi::VIRTIO_F_VERSION_1 as u64
37-
| 1 << uapi::VIRTIO_F_IN_ORDER as u64
38-
| 1 << uapi::VIRTIO_VSOCK_F_DGRAM;
36+
pub(crate) const AVAIL_FEATURES: u64 = (1 << uapi::VIRTIO_F_VERSION_1 as u64)
37+
| (1 << uapi::VIRTIO_F_IN_ORDER as u64)
38+
| (1 << uapi::VIRTIO_VSOCK_F_DGRAM);
3939

4040
pub struct Vsock {
4141
cid: u64,

src/devices/src/virtio/vsock/muxer.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ impl VsockMuxer {
273273
match req._type {
274274
defs::SOCK_STREAM => {
275275
debug!("vsock: proxy create stream");
276-
let id = (req.peer_port as u64) << 32 | defs::TSI_PROXY_PORT as u64;
276+
let id = ((req.peer_port as u64) << 32) | (defs::TSI_PROXY_PORT as u64);
277277
match TcpProxy::new(
278278
id,
279279
self.cid,
@@ -295,7 +295,7 @@ impl VsockMuxer {
295295
}
296296
defs::SOCK_DGRAM => {
297297
debug!("vsock: proxy create dgram");
298-
let id = (req.peer_port as u64) << 32 | defs::TSI_PROXY_PORT as u64;
298+
let id = ((req.peer_port as u64) << 32) | (defs::TSI_PROXY_PORT as u64);
299299
match UdpProxy::new(
300300
id,
301301
self.cid,
@@ -321,7 +321,7 @@ impl VsockMuxer {
321321
fn process_connect(&self, pkt: &VsockPacket) {
322322
debug!("vsock: proxy connect request");
323323
if let Some(req) = pkt.read_connect_req() {
324-
let id = (req.peer_port as u64) << 32 | defs::TSI_PROXY_PORT as u64;
324+
let id = ((req.peer_port as u64) << 32) | (defs::TSI_PROXY_PORT as u64);
325325
debug!("vsock: proxy connect request: id={}", id);
326326
let update = self
327327
.proxy_map
@@ -339,7 +339,7 @@ impl VsockMuxer {
339339
fn process_getname(&self, pkt: &VsockPacket) {
340340
debug!("vsock: new getname request");
341341
if let Some(req) = pkt.read_getname_req() {
342-
let id = (req.peer_port as u64) << 32 | (req.local_port as u64);
342+
let id = ((req.peer_port as u64) << 32) | (req.local_port as u64);
343343
debug!(
344344
"vsock: new getname request: id={}, peer_port={}, local_port={}",
345345
id, req.peer_port, req.local_port
@@ -354,7 +354,7 @@ impl VsockMuxer {
354354
fn process_sendto_addr(&self, pkt: &VsockPacket) {
355355
debug!("vsock: new DGRAM sendto addr: src={}", pkt.src_port());
356356
if let Some(req) = pkt.read_sendto_addr() {
357-
let id = (req.peer_port as u64) << 32 | defs::TSI_PROXY_PORT as u64;
357+
let id = ((req.peer_port as u64) << 32) | (defs::TSI_PROXY_PORT as u64);
358358
debug!("vsock: new DGRAM sendto addr: id={}", id);
359359
let update = self
360360
.proxy_map
@@ -370,7 +370,7 @@ impl VsockMuxer {
370370
}
371371

372372
fn process_sendto_data(&self, pkt: &VsockPacket) {
373-
let id = (pkt.src_port() as u64) << 32 | defs::TSI_PROXY_PORT as u64;
373+
let id = ((pkt.src_port() as u64) << 32) | (defs::TSI_PROXY_PORT as u64);
374374
debug!("vsock: DGRAM sendto data: id={} src={}", id, pkt.src_port());
375375
if let Some(proxy) = self.proxy_map.read().unwrap().get(&id) {
376376
proxy.lock().unwrap().sendto_data(pkt);

0 commit comments

Comments
 (0)