/* * Copyright (c) 2020, Andreas Kling * * SPDX-License-Identifier: BSD-2-Clause */ #include #include namespace Kernel { NonnullRefPtr SharedInodeVMObject::create_with_inode(Inode& inode) { size_t size = inode.size(); if (auto shared_vmobject = inode.shared_vmobject()) return shared_vmobject.release_nonnull(); auto vmobject = adopt_ref(*new SharedInodeVMObject(inode, size)); vmobject->inode().set_shared_vmobject(*vmobject); return vmobject; } RefPtr SharedInodeVMObject::clone() { return adopt_ref(*new SharedInodeVMObject(*this)); } SharedInodeVMObject::SharedInodeVMObject(Inode& inode, size_t size) : InodeVMObject(inode, size) { } SharedInodeVMObject::SharedInodeVMObject(const SharedInodeVMObject& other) : InodeVMObject(other) { } }