diff --git a/include/dwarfs/filesystem_v2.h b/include/dwarfs/filesystem_v2.h index a4ed19b3..f80b19a8 100644 --- a/include/dwarfs/filesystem_v2.h +++ b/include/dwarfs/filesystem_v2.h @@ -103,7 +103,6 @@ class filesystem_v2 { int open(entry_view entry) const { return impl_->open(entry); } -#if 0 ssize_t read(uint32_t inode, char* buf, size_t size, off_t offset) const { return impl_->read(inode, buf, size, offset); } @@ -112,7 +111,6 @@ class filesystem_v2 { readv(uint32_t inode, iovec_read_buf& buf, size_t size, off_t offset) const { return impl_->readv(inode, buf, size, offset); } -#endif class impl { public: @@ -136,12 +134,10 @@ class filesystem_v2 { readlink(entry_view entry) const = 0; virtual int statvfs(struct ::statvfs* stbuf) const = 0; virtual int open(entry_view entry) const = 0; -#if 0 virtual ssize_t read(uint32_t inode, char* buf, size_t size, off_t offset) const = 0; virtual ssize_t readv(uint32_t inode, iovec_read_buf& buf, size_t size, off_t offset) const = 0; -#endif }; private: diff --git a/src/dwarfs/filesystem_v2.cpp b/src/dwarfs/filesystem_v2.cpp index bedc9319..c1b31534 100644 --- a/src/dwarfs/filesystem_v2.cpp +++ b/src/dwarfs/filesystem_v2.cpp @@ -171,12 +171,10 @@ class filesystem_ : public filesystem_v2::impl { readlink(entry_view entry) const override; int statvfs(struct ::statvfs* stbuf) const override; int open(entry_view entry) const override; -#if 0 ssize_t read(uint32_t inode, char* buf, size_t size, off_t offset) const override; ssize_t readv(uint32_t inode, iovec_read_buf& buf, size_t size, off_t offset) const override; -#endif private: log_proxy log_; @@ -310,23 +308,23 @@ int filesystem_::open(entry_view entry) const { return meta_.open(entry); } -#if 0 template ssize_t filesystem_::read(uint32_t inode, char* buf, size_t size, off_t offset) const { - size_t num = 0; - const chunk_type* chunk = meta_.get_chunks(inode, num); - return ir_.read(buf, size, offset, chunk, num); + if (auto chunks = meta_.get_chunks(inode)) { + return ir_.read(buf, size, offset, *chunks); + } + return -1; } template ssize_t filesystem_::readv(uint32_t inode, iovec_read_buf& buf, size_t size, off_t offset) const { - size_t num = 0; - const chunk_type* chunk = meta_.get_chunks(inode, num); - return ir_.readv(buf, size, offset, chunk, num); + if (auto chunks = meta_.get_chunks(inode)) { + return ir_.readv(buf, size, offset, *chunks); + } + return -1; } -#endif } // namespace