Stop using the legacy path format in fpath

For fbbootlog, fbcon and the disk drivers there is no load bearing use
of the fpath output. And for chan relibc already handles both the legacy
and new format.
This commit is contained in:
bjorn3
2026-07-16 20:16:35 +02:00
parent 6238bb653d
commit 5c6f460bbb
5 changed files with 4 additions and 15 deletions
+1 -1
View File
@@ -197,7 +197,7 @@ impl SchemeSync for FbbootlogScheme {
}
fn fpath(&mut self, _id: usize, buf: &mut [u8], _ctx: &CallerCtx) -> Result<usize> {
FpathWriter::with_legacy(buf, "fbbootlog", |_| Ok(()))
FpathWriter::with(buf, "fbbootlog", |_| Ok(()))
}
fn fsync(&mut self, _id: usize, _ctx: &CallerCtx) -> Result<()> {
+1 -1
View File
@@ -163,7 +163,7 @@ impl SchemeSync for FbconScheme {
}
fn fpath(&mut self, id: usize, buf: &mut [u8], _ctx: &CallerCtx) -> Result<usize> {
FpathWriter::with_legacy(buf, "fbcon", |w| {
FpathWriter::with(buf, "fbcon", |w| {
let handle = self.get_vt_handle_mut(id)?;
write!(w, "{}", handle.vt_i.0).unwrap();
Ok(())
+1 -1
View File
@@ -559,7 +559,7 @@ impl<T: Disk> SchemeAsync for DiskSchemeInner<T> {
}
async fn fpath(&mut self, id: usize, buf: &mut [u8], _ctx: &CallerCtx) -> Result<usize> {
FpathWriter::with_legacy(buf, &self.scheme_name, |w| {
FpathWriter::with(buf, &self.scheme_name, |w| {
match *self.handles.get(id)? {
Handle::List(_) => (),
Handle::Disk(number) => {
+1 -1
View File
@@ -331,7 +331,7 @@ impl<'sock> SchemeSync for ChanScheme<'sock> {
}
}
fn fpath(&mut self, id: usize, buf: &mut [u8], _ctx: &CallerCtx) -> Result<usize> {
FpathWriter::with_legacy(buf, "chan", |w| {
FpathWriter::with(buf, "chan", |w| {
let handle = self.handles.get(&id).ok_or(Error::new(EBADF))?;
if let Extra::SchemeRoot = handle.extra {
return Ok(());
-11
View File
@@ -92,17 +92,6 @@ impl<'a> FpathWriter<'a> {
Ok(w.written)
}
pub fn with_legacy(
buf: &'a mut [u8],
scheme_name: &str,
f: impl FnOnce(&mut Self) -> Result<()>,
) -> Result<usize> {
let mut w = FpathWriter { buf, written: 0 };
write!(w, "{scheme_name}:").unwrap();
f(&mut w)?;
Ok(w.written)
}
pub fn push_str(&mut self, s: &str) {
let count = core::cmp::min(s.len(), self.buf.len() - self.written);
self.buf[self.written..self.written + count].copy_from_slice(&s.as_bytes()[..count]);