From e4b09aae2ffc9103202549d08ee5249566a63a62 Mon Sep 17 00:00:00 2001 From: Marcus Holland-Moritz Date: Sat, 19 Aug 2023 22:50:06 +0200 Subject: [PATCH] Remove inode_chunkable --- CMakeLists.txt | 1 - include/dwarfs/inode_chunkable.h | 50 --------------------------- src/dwarfs/inode_chunkable.cpp | 59 -------------------------------- 3 files changed, 110 deletions(-) delete mode 100644 include/dwarfs/inode_chunkable.h delete mode 100644 src/dwarfs/inode_chunkable.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 55495b8d..fdec1069 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -379,7 +379,6 @@ list( src/dwarfs/fstypes.cpp src/dwarfs/fs_section.cpp src/dwarfs/global_entry_data.cpp - src/dwarfs/inode_chunkable.cpp src/dwarfs/inode_element_view.cpp src/dwarfs/inode_fragments.cpp src/dwarfs/inode_manager.cpp diff --git a/include/dwarfs/inode_chunkable.h b/include/dwarfs/inode_chunkable.h deleted file mode 100644 index 58866a70..00000000 --- a/include/dwarfs/inode_chunkable.h +++ /dev/null @@ -1,50 +0,0 @@ -/* vim:set ts=2 sw=2 sts=2 et: */ -/** - * \author Marcus Holland-Moritz (github@mhxnet.de) - * \copyright Copyright (c) Marcus Holland-Moritz - * - * This file is part of dwarfs. - * - * dwarfs is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * dwarfs is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with dwarfs. If not, see . - */ - -#pragma once - -#include - -#include "dwarfs/chunkable.h" - -namespace dwarfs { - -class inode; -class mmif; -class os_access; - -class inode_chunkable : public chunkable { - public: - inode_chunkable(inode& ino, os_access& os); - ~inode_chunkable(); - - size_t size() const override; - std::string description() const override; - std::span span() const override; - void add_chunk(size_t block, size_t offset, size_t size) override; - void release_until(size_t offset) override; - - private: - inode& ino_; - std::unique_ptr mm_; -}; - -} // namespace dwarfs diff --git a/src/dwarfs/inode_chunkable.cpp b/src/dwarfs/inode_chunkable.cpp deleted file mode 100644 index 96edf5fe..00000000 --- a/src/dwarfs/inode_chunkable.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/* vim:set ts=2 sw=2 sts=2 et: */ -/** - * \author Marcus Holland-Moritz (github@mhxnet.de) - * \copyright Copyright (c) Marcus Holland-Moritz - * - * This file is part of dwarfs. - * - * dwarfs is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * dwarfs is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with dwarfs. If not, see . - */ - -#include - -#include "dwarfs/entry.h" -#include "dwarfs/inode.h" -#include "dwarfs/inode_chunkable.h" -#include "dwarfs/mmap.h" -#include "dwarfs/os_access.h" - -namespace dwarfs { - -inode_chunkable::inode_chunkable(inode& ino, os_access& os) - : ino_{ino} { - auto e = ino_.any(); - if (auto size = e->size(); size > 0) { - mm_ = os.map_file(e->fs_path(), size); - } -} - -inode_chunkable::~inode_chunkable() = default; - -size_t inode_chunkable::size() const { return ino_.any()->size(); } - -std::string inode_chunkable::description() const { - return fmt::format("inode {} [{}] - size: {}", ino_.num(), ino_.any()->name(), - ino_.any()->size()); -} - -std::span inode_chunkable::span() const { return mm_->span(); } - -void inode_chunkable::add_chunk(size_t block, size_t offset, size_t size) { - ino_.add_chunk(block, offset, size); -} - -void inode_chunkable::release_until(size_t offset) { - mm_->release_until(offset); -} - -} // namespace dwarfs