2020-01-18 05:38:21 -03:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
|
|
|
|
*
|
2021-04-22 05:24:48 -03:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-01-18 05:38:21 -03:00
|
|
|
*/
|
|
|
|
|
|
2019-08-07 13:06:17 -03:00
|
|
|
#pragma once
|
|
|
|
|
|
2021-08-06 05:45:34 -03:00
|
|
|
#include <Kernel/Memory/InodeVMObject.h>
|
2019-08-07 13:06:17 -03:00
|
|
|
#include <Kernel/UnixTypes.h>
|
|
|
|
|
|
2021-08-06 08:49:36 -03:00
|
|
|
namespace Kernel::Memory {
|
2020-02-15 21:27:42 -03:00
|
|
|
|
2020-02-28 16:20:35 -03:00
|
|
|
class SharedInodeVMObject final : public InodeVMObject {
|
|
|
|
|
AK_MAKE_NONMOVABLE(SharedInodeVMObject);
|
|
|
|
|
|
2019-08-07 13:06:17 -03:00
|
|
|
public:
|
2022-08-19 15:53:40 -03:00
|
|
|
static ErrorOr<NonnullLockRefPtr<SharedInodeVMObject>> try_create_with_inode(Inode&);
|
2022-08-06 15:05:48 -03:00
|
|
|
static ErrorOr<NonnullLockRefPtr<SharedInodeVMObject>> try_create_with_inode_and_range(Inode&, u64 offset, size_t range_size);
|
2022-08-19 15:53:40 -03:00
|
|
|
virtual ErrorOr<NonnullLockRefPtr<VMObject>> try_clone() override;
|
2019-08-07 13:06:17 -03:00
|
|
|
|
2021-11-18 11:54:39 -03:00
|
|
|
ErrorOr<void> sync(off_t offset_in_pages = 0, size_t pages = -1);
|
2021-11-17 15:33:00 -03:00
|
|
|
|
2019-08-07 13:06:17 -03:00
|
|
|
private:
|
2020-03-01 07:08:28 -03:00
|
|
|
virtual bool is_shared_inode() const override { return true; }
|
|
|
|
|
|
2022-08-24 10:56:26 -03:00
|
|
|
explicit SharedInodeVMObject(Inode&, FixedArray<RefPtr<PhysicalPage>>&&, Bitmap dirty_pages);
|
|
|
|
|
explicit SharedInodeVMObject(SharedInodeVMObject const&, FixedArray<RefPtr<PhysicalPage>>&&, Bitmap dirty_pages);
|
2019-08-07 13:06:17 -03:00
|
|
|
|
2021-07-11 12:57:52 -03:00
|
|
|
virtual StringView class_name() const override { return "SharedInodeVMObject"sv; }
|
2020-02-28 16:58:57 -03:00
|
|
|
|
2021-07-21 19:02:34 -03:00
|
|
|
SharedInodeVMObject& operator=(SharedInodeVMObject const&) = delete;
|
2019-08-07 13:06:17 -03:00
|
|
|
};
|
2020-02-15 21:27:42 -03:00
|
|
|
|
|
|
|
|
}
|