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