mirror of
https://github.com/RGBCube/serenity
synced 2025-05-20 18:15:07 +00:00
Add a String::format() and use that in place of ksprintf() in the Kernel.
You're never gonna be right 100% of the time when guessing how much buffer space you need. This avoids having to make that type of decision in a bunch of cases. :^)
This commit is contained in:
parent
e9b948103d
commit
027d26cd5d
11 changed files with 40 additions and 34 deletions
|
@ -292,16 +292,10 @@ String FileDescriptor::absolute_path()
|
|||
Stopwatch sw("absolute_path");
|
||||
if (is_tty())
|
||||
return tty()->tty_name();
|
||||
if (is_fifo()) {
|
||||
char buf[32];
|
||||
ksprintf(buf, "fifo:%x", m_fifo.ptr());
|
||||
return buf;
|
||||
}
|
||||
if (is_character_device()) {
|
||||
char buf[128];
|
||||
ksprintf(buf, "device:%u,%u (%s)", m_device->major(), m_device->minor(), m_device->class_name());
|
||||
return buf;
|
||||
}
|
||||
if (is_fifo())
|
||||
return String::format("fifo:%x", m_fifo.ptr());
|
||||
if (is_character_device())
|
||||
return String::format("device:%u,%u (%s)", m_device->major(), m_device->minor(), m_device->class_name());
|
||||
ASSERT(m_inode);
|
||||
return VFS::the().absolute_path(*m_inode);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue