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