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