summaryrefslogtreecommitdiff
path: root/Kernel/FileSystem/DevFS.cpp
AgeCommit message (Collapse)Author
2021-05-02Kernel: Change Inode::{read/write}_bytes interface to KResultOr<ssize_t>Brian Gianforcaro
The error handling in all these cases was still using the old style negative values to indicate errors. We have a nicer solution for this now with KResultOr<T>. This change switches the interface and then all implementers to use the new style.
2021-05-01Kernel: Harden DevFS Vector usage against OOM.Brian Gianforcaro
The dance here is not complicated, but it is something that should be taken note of. Since we append to both lists, we don't want to orphan the new Inode in the m_links/m_subfolders Vector in the event that the append to m_parent_fs.m_nodes fails.
2021-04-25Kernel: Remove the now defunct `LOCKER(..)` macro.Brian Gianforcaro
2021-04-23AK: Rename adopt() to adopt_ref()Andreas Kling
This makes it more symmetrical with adopt_own() (which is used to create a NonnullOwnPtr from the result of a naked new.)
2021-04-22Everything: Move to SPDX license identifiers in all files.Brian Gianforcaro
SPDX License Identifiers are a more compact / standardized way of representing file license information. See: https://spdx.dev/resources/use/#identifiers This was done with the `ambr` search and replace tool. ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-03-15Kernel: Return 0 to indicate EOF when reading from end-of-file of deviceLiav A
If we happen to read with offset that is after the end of file of a device, return 0 to indicate EOF. If we return a negative value, userspace will think that something bad happened when it's really not the case.
2021-03-15Kernel: When writing to device node, use can_write for checkingLiav A
Instead of can_read which is wrong, use can_write.
2021-03-12Kernel: Remove debug spam in DevFSAndreas Kling
2021-02-23Everywhere: Rename ASSERT => VERIFYAndreas Kling
(...and ASSERT_NOT_REACHED => VERIFY_NOT_REACHED) Since all of these checks are done in release builds as well, let's rename them to VERIFY to prevent confusion, as everyone is used to assertions being compiled out in release. We can introduce a new ASSERT macro that is specifically for debug checks, but I'm doing this wholesale conversion first since we've accumulated thousands of these already, and it's not immediately obvious which ones are suitable for ASSERT.
2021-02-12DevFS: Use strongly typed InodeIndexAndreas Kling
Also add an assertion for the DevFS inode index allocator overflowing.
2021-01-22Kernel: Make device generate their own namesJean-Baptiste Boric
Besides removing the monolithic DevFSDeviceInode::determine_name() method, being able to determine a device's name inside the /dev hierarchy outside of DevFS has its uses.
2021-01-22Kernel: Hook Ramdisk devices inside DevFSJean-Baptiste Boric
2021-01-20Kernel+LibC: Turn errno codes into a strongly typed enumAndreas Kling
..and allow implicit creation of KResult and KResultOr from ErrnoCode. This means that kernel functions that return those types can finally do "return EINVAL;" and it will just work. There's a handful of functions that still deal with signed integers that should be converted to return KResults.
2021-01-11Kernel: Convert a bunch of String::format() => String::formatted()Andreas Kling
2021-01-09Everywhere: Replace a bundle of dbg with dbgln.asynts
These changes are arbitrarily divided into multiple commits to make it easier to find potentially introduced bugs with git bisect.Everything: The modifications in this commit were automatically made using the following command: find . -name '*.cpp' -exec sed -i -E 's/dbg\(\) << ("[^"{]*");/dbgln\(\1\);/' {} \;
2020-12-27Kernel: Introduce a new partitioning subsystemLiav A
The partitioning code was very outdated, and required a full refactor. The new subsystem removes duplicated code and uses more AK containers. The most important change is that all implementations of the PartitionTable class conform to one interface, which made it possible to remove unnecessary code in the EBRPartitionTable class. Finding partitions is now done in the StorageManagement singleton, instead of doing so in init.cpp. Also, now we don't try to find partitions on demand - the kernel will try to detect if a StorageDevice is partitioned, and if so, will check what is the partition table, which could be MBR, GUID or EBR. Then, it will create DiskPartitionMetadata object for each partition that is available in the partition table. This object will be used by the partition enumeration code to create a DiskPartition with the correct minor number.
2020-12-27Kernel: Introduce the DevFSLiav A
The DevFS along with DevPtsFS give a complete solution for populating device nodes in /dev. The main purpose of DevFS is to eliminate the need of device nodes generation when building the system. Later on, DevFS will assist with exposing disk partition nodes.