From 0ac24e5a241c0069402816f25fa8fbe21c8702d6 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 15 May 2024 05:39:12 +0200 Subject: [PATCH] lib/nfs/FileReader: move code to ReadCallback() --- src/lib/nfs/FileReader.cxx | 11 +++++++---- src/lib/nfs/FileReader.hxx | 1 + 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/lib/nfs/FileReader.cxx b/src/lib/nfs/FileReader.cxx index 8e33b1a3d..84a756a3b 100644 --- a/src/lib/nfs/FileReader.cxx +++ b/src/lib/nfs/FileReader.cxx @@ -197,6 +197,12 @@ NfsFileReader::StatCallback(const struct nfs_stat_64 *st) noexcept OnNfsFileOpen(st->nfs_size); } +inline void +NfsFileReader::ReadCallback(std::size_t nbytes, const void *data) noexcept +{ + OnNfsFileRead({static_cast(data), nbytes}); +} + void NfsFileReader::OnNfsCallback(unsigned status, void *data) noexcept { @@ -217,10 +223,7 @@ NfsFileReader::OnNfsCallback(unsigned status, void *data) noexcept break; case State::READ: - OnNfsFileRead({ - static_cast(data), - static_cast(status), - }); + ReadCallback(static_cast(status), data); break; } } diff --git a/src/lib/nfs/FileReader.hxx b/src/lib/nfs/FileReader.hxx index 4c05e5184..10caa4f03 100644 --- a/src/lib/nfs/FileReader.hxx +++ b/src/lib/nfs/FileReader.hxx @@ -126,6 +126,7 @@ private: void OpenCallback(nfsfh *_fh) noexcept; void StatCallback(const struct nfs_stat_64 *st) noexcept; + void ReadCallback(std::size_t nbytes, const void *data) noexcept; /* virtual methods from NfsLease */ void OnNfsConnectionReady() noexcept final;