Skip to content

Commit

Permalink
fix(mmserver): turn down the heat on udevfs logging
Browse files Browse the repository at this point in the history
  • Loading branch information
colinmarc committed Feb 5, 2025
1 parent ad3cdca commit 53f448e
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions mm-server/src/session/input/udevfs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use std::{
use fuser as fuse;
use libc::EBADF;
use parking_lot::Mutex;
use tracing::{trace, warn};
use tracing::{debug, trace};

use super::DeviceState;

Expand Down Expand Up @@ -218,13 +218,13 @@ impl fuse::Filesystem for UdevFs {
reply: fuse::ReplyEntry,
) {
let Some(name) = name.to_str() else {
warn!(?name, "invalid lookup name");
debug!(?name, "invalid lookup name");
return reply.error(ENOENT);
};

let inodes = &mut self.tree;
let Some((parent_path, dev)) = inodes.lookup_name(parent) else {
warn!(?parent, ?name, "lookup failed");
debug!(?parent, ?name, "lookup failed");
return reply.error(ENOENT);
};

Expand All @@ -244,7 +244,7 @@ impl fuse::Filesystem for UdevFs {
.device_by_eventname(name)
.map(|dev| dev.id)
else {
warn!(name, "device not found in /sys/class/input");
debug!(name, "device not found in /sys/class/input");
return reply.error(ENOENT);
};

Expand Down Expand Up @@ -272,7 +272,7 @@ impl fuse::Filesystem for UdevFs {
),
("/sys/devices/virtual/input", name, _) => {
let Some(dev) = self.state.lock().device_by_devname(name).map(|dev| dev.id) else {
warn!(name, "device not found in /sys/devices/virtual/input");
debug!(name, "device not found in /sys/devices/virtual/input");
return reply.error(ENOENT);
};

Expand All @@ -285,7 +285,7 @@ impl fuse::Filesystem for UdevFs {
(p, "uevent", Some(dev)) if p.starts_with("/sys/devices/virtual/input") => {
let guard = self.state.lock();
let Some(dev) = guard.device_by_id(dev) else {
warn!(?p, dev, "device not found in /sys/devices/virtual/input");
debug!(?p, dev, "device not found in /sys/devices/virtual/input");
return reply.error(ENOENT);
};

Expand All @@ -309,7 +309,7 @@ impl fuse::Filesystem for UdevFs {
{
make_evdev_uevent(dev)
} else {
warn!(?parent_path, "unrecognized uevent path");
debug!(?parent_path, "unrecognized uevent path");
return reply.error(ENOENT);
};

Expand Down Expand Up @@ -368,11 +368,11 @@ impl fuse::Filesystem for UdevFs {
}
}

warn!(?name, "no device found in /run/udev/data");
debug!(?name, "no device found in /run/udev/data");
reply.error(ENOENT);
}
(parent_name, name, dev) => {
warn!(parent_name, name, dev, "udevfs lookup failed");
debug!(parent_name, name, dev, "udevfs lookup failed");
reply.error(ENOENT);
}
}
Expand All @@ -386,7 +386,7 @@ impl fuse::Filesystem for UdevFs {
reply: fuse::ReplyAttr,
) {
let Some(entry) = self.tree.inodes.get(&ino) else {
warn!(ino, "lookup failed");
debug!(ino, "lookup failed");
return reply.error(ENOENT);
};

Expand All @@ -395,15 +395,15 @@ impl fuse::Filesystem for UdevFs {

fn readlink(&mut self, _req: &fuse::Request<'_>, ino: u64, reply: fuse::ReplyData) {
let Some(entry) = self.tree.inodes.get(&ino) else {
warn!(ino, "lookup failed");
debug!(ino, "lookup failed");
return reply.error(ENOENT);
};

trace!(path = ?entry.path, "readlink");
if let Some(name) = matches_prefix_with_name(&entry.path, "/sys/class/input") {
let guard = self.state.lock();
let Some(dev) = guard.device_by_eventname(name) else {
warn!(eventname = ?name, "device not found in /sys/devices/virtual/input");
debug!(eventname = ?name, "device not found in /sys/devices/virtual/input");
return reply.error(ENOENT);
};

Expand All @@ -416,7 +416,7 @@ impl fuse::Filesystem for UdevFs {
{
reply.data(b"/sys/class/input");
} else {
warn!(path = ?entry.path, dev = ?entry.dev, "readlink failed");
debug!(path = ?entry.path, dev = ?entry.dev, "readlink failed");
reply.error(ENOENT);
}
}
Expand All @@ -433,7 +433,7 @@ impl fuse::Filesystem for UdevFs {
reply: fuse::ReplyData,
) {
let Some(entry) = self.tree.inodes.get(&ino) else {
warn!(ino, "lookup failed");
debug!(ino, "lookup failed");
return reply.error(EBADF);
};

Expand All @@ -447,7 +447,7 @@ impl fuse::Filesystem for UdevFs {
{
let guard = self.state.lock();
let Some(dev) = guard.device_by_id(entry.dev.unwrap()) else {
warn!(dev = ?entry.dev, "device lookup failed");
debug!(dev = ?entry.dev, "device lookup failed");
return reply.error(EBADF);
};

Expand All @@ -459,11 +459,11 @@ impl fuse::Filesystem for UdevFs {
} else if parent_path.file_name() == Some(&dev.devname) {
reply.data(&make_input_uevent(dev))
} else {
warn!(?entry.path, "bad uevent path");
debug!(?entry.path, "bad uevent path");
reply.error(EBADF);
}
} else {
warn!(path = ?entry.path, dev = entry.dev, "read failed");
debug!(path = ?entry.path, dev = entry.dev, "read failed");
reply.error(EBADF);
}
}
Expand All @@ -478,7 +478,7 @@ impl fuse::Filesystem for UdevFs {
) {
let inodes = &mut self.tree;
let Some(Entry { path, dev, .. }) = inodes.inodes.get(&ino).cloned() else {
warn!(ino, "lookup failed");
debug!(ino, "lookup failed");
return reply.error(EBADF);
};

Expand Down Expand Up @@ -549,7 +549,7 @@ impl fuse::Filesystem for UdevFs {
// Note: this seems not to happen.
}
_ => {
warn!(?path, ?dev, "readdir failed");
debug!(?path, ?dev, "readdir failed");
reply.error(ENOENT);
}
}
Expand Down

0 comments on commit 53f448e

Please sign in to comment.