lib/nfs/FileReader: move code to ReadCallback()

This commit is contained in:
Max Kellermann 2024-05-15 05:39:12 +02:00
parent 98f53b6d3d
commit 0ac24e5a24
2 changed files with 8 additions and 4 deletions

View File

@ -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<const std::byte *>(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<const std::byte *>(data),
static_cast<std::size_t>(status),
});
ReadCallback(static_cast<std::size_t>(status), data);
break;
}
}

View File

@ -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;