Skip to content

Commit

Permalink
fixing build with recent libnfs
Browse files Browse the repository at this point in the history
  • Loading branch information
elfmz authored Dec 14, 2024
1 parent e13a9e2 commit bbf73ee
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion NetRocks/src/Protocol/NFS/ProtocolNFS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,11 @@ class NFSFileIO : public IFileReader, public IFileWriter

virtual size_t Read(void *buf, size_t len)
{
#ifdef LIBNFS_API_V2
const auto rc = nfs_read(_nfs->ctx, _file, (char *)buf, len);
#else
const auto rc = nfs_read(_nfs->ctx, _file, len, (char *)buf);
#endif
if (rc < 0)
throw ProtocolError("Read file error", errno);
// uncomment to simulate connection stuck if ( (rand()%100) == 0) sleep(60);
Expand All @@ -518,7 +522,11 @@ class NFSFileIO : public IFileReader, public IFileWriter
virtual void Write(const void *buf, size_t len)
{
if (len > 0) for (;;) {
const auto rc = nfs_write(_nfs->ctx, _file, len, (char *)buf);
#ifdef LIBNFS_API_V2
const auto rc = nfs_write(_nfs->ctx, _file, (const char *)buf, len);
#else
const auto rc = nfs_write(_nfs->ctx, _file, len, (const char *)buf);
#endif
if (rc <= 0)
throw ProtocolError("Write file error", errno);
if ((size_t)rc >= len)
Expand Down

0 comments on commit bbf73ee

Please sign in to comment.