1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:48:10 +00:00

Kernel/SysFS: Rename Devices code folder => DeviceIdentifiers

This folder in the SysFS code represents everything related to /sys/dev,
which is a directory meant to be a convenient interface to track all IDs
of all block and character devices (ID = major:minor numbers).
This commit is contained in:
Liav A 2022-04-22 15:51:45 +03:00 committed by Andreas Kling
parent 4ad437f3a7
commit 6ff1aeb64d
12 changed files with 31 additions and 31 deletions

View file

@ -0,0 +1,27 @@
/*
* Copyright (c) 2022, Liav A. <liavalb@hotmail.co.il>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <Kernel/Devices/Device.h>
#include <Kernel/FileSystem/SysFS/Subsystems/DeviceIdentifiers/DeviceComponent.h>
#include <Kernel/Sections.h>
namespace Kernel {
NonnullRefPtr<SysFSDeviceComponent> SysFSDeviceComponent::must_create(Device const& device)
{
// FIXME: Handle allocation failure gracefully
auto device_name = MUST(KString::formatted("{}:{}", device.major(), device.minor()));
return adopt_ref_if_nonnull(new SysFSDeviceComponent(move(device_name), device)).release_nonnull();
}
SysFSDeviceComponent::SysFSDeviceComponent(NonnullOwnPtr<KString> major_minor_formatted_device_name, Device const& device)
: SysFSComponent()
, m_block_device(device.is_block_device())
, m_major_minor_formatted_device_name(move(major_minor_formatted_device_name))
{
VERIFY(device.is_block_device() || device.is_character_device());
}
}