ladybird/Kernel/FileSystem/ISO9660FS/DirectoryEntry.h
Liav A 7c0540a229 Everywhere: Move global Kernel pattern code to Kernel/Library directory
This has KString, KBuffer, DoubleBuffer, KBufferBuilder, IOWindow,
UserOrKernelBuffer and ScopedCritical classes being moved to the
Kernel/Library subdirectory.

Also, move the panic and assertions handling code to that directory.
2023-06-04 21:32:34 +02:00

42 lines
1.0 KiB
C++

/*
* Copyright (c) 2021, sin-ack <sin-ack@protonmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/Types.h>
#include <Kernel/Library/KBuffer.h>
namespace Kernel {
struct ISO9660FSDirectoryEntry final : public AtomicRefCounted<ISO9660FSDirectoryEntry> {
u32 extent { 0 };
u32 length { 0 };
// NOTE: This can never be empty if we read the directory successfully.
// We need it as an OwnPtr to default-construct this struct.
OwnPtr<KBuffer> blocks;
static ErrorOr<NonnullLockRefPtr<ISO9660FSDirectoryEntry>> try_create(u32 extent, u32 length, OwnPtr<KBuffer> blocks)
{
return adopt_nonnull_lock_ref_or_enomem(new (nothrow) ISO9660FSDirectoryEntry(extent, length, move(blocks)));
}
private:
ISO9660FSDirectoryEntry(u32 extent, u32 length, OwnPtr<KBuffer> blocks)
: extent(extent)
, length(length)
, blocks(move(blocks))
{
}
};
struct ISO9660FSDirectoryState {
LockRefPtr<ISO9660FSDirectoryEntry> entry;
u32 offset { 0 };
};
}