mirror of
https://github.com/mhx/dwarfs.git
synced 2025-09-14 06:48:39 -04:00
Remove inode_chunkable
This commit is contained in:
parent
978f689f8f
commit
e4b09aae2f
@ -379,7 +379,6 @@ list(
|
|||||||
src/dwarfs/fstypes.cpp
|
src/dwarfs/fstypes.cpp
|
||||||
src/dwarfs/fs_section.cpp
|
src/dwarfs/fs_section.cpp
|
||||||
src/dwarfs/global_entry_data.cpp
|
src/dwarfs/global_entry_data.cpp
|
||||||
src/dwarfs/inode_chunkable.cpp
|
|
||||||
src/dwarfs/inode_element_view.cpp
|
src/dwarfs/inode_element_view.cpp
|
||||||
src/dwarfs/inode_fragments.cpp
|
src/dwarfs/inode_fragments.cpp
|
||||||
src/dwarfs/inode_manager.cpp
|
src/dwarfs/inode_manager.cpp
|
||||||
|
@ -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 <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
#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<uint8_t const> 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<mmif> mm_;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace dwarfs
|
|
@ -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 <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <fmt/format.h>
|
|
||||||
|
|
||||||
#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<uint8_t const> 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
|
|
Loading…
x
Reference in New Issue
Block a user