69 lines
2.8 KiB
Diff
69 lines
2.8 KiB
Diff
From 6b1d29cd25daf1fdfd27897b7d43f1b8756aa2bc Mon Sep 17 00:00:00 2001
|
|
From: Stephan Sundermann <stephansundermann@gmail.com>
|
|
Date: Sun, 15 Dec 2024 04:03:03 +0100
|
|
Subject: [PATCH] [depends] Update to libnfs 6.0.2
|
|
|
|
---
|
|
tools/depends/target/libnfs/LIBNFS-VERSION | 4 ++--
|
|
xbmc/filesystem/NFSFile.cpp | 14 ++++++++++++--
|
|
2 files changed, 14 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/tools/depends/target/libnfs/LIBNFS-VERSION b/tools/depends/target/libnfs/LIBNFS-VERSION
|
|
index 892aa7afcfd48..699a31c70fcae 100644
|
|
--- a/tools/depends/target/libnfs/LIBNFS-VERSION
|
|
+++ b/tools/depends/target/libnfs/LIBNFS-VERSION
|
|
@@ -1,6 +1,6 @@
|
|
LIBNAME=libnfs
|
|
-VERSION=5.0.2
|
|
+VERSION=6.0.2
|
|
ARCHIVE=$(LIBNAME)-$(VERSION).tar.gz
|
|
-SHA512=6dcf4ea8a01b35beb53694625d20fbebd858a88725c2742671878ad6fe7877999f93d262fb58a435b00c283c3e6fb6fa7222d04bb4540bf674b7ce196e9424f5
|
|
+SHA512=539790ab98aac7b2f25755b745d1f5e016518f1adb3748b8c58df187048bc31e091915d59e6359bb95c49dd986361cbbf2536edcda02598b0fac236762b61a46
|
|
BYPRODUCT=libnfs.a
|
|
BYPRODUCT_WIN=nfs.lib
|
|
diff --git a/xbmc/filesystem/NFSFile.cpp b/xbmc/filesystem/NFSFile.cpp
|
|
index b96b2bc4fad4b..0dd311a694d16 100644
|
|
--- a/xbmc/filesystem/NFSFile.cpp
|
|
+++ b/xbmc/filesystem/NFSFile.cpp
|
|
@@ -477,7 +477,11 @@ void CNfsConnection::keepAlive(const std::string& _exportPath, struct nfsfh* _pF
|
|
|
|
nfs_lseek(pContext, _pFileHandle, 0, SEEK_CUR, &offset);
|
|
|
|
+#ifdef LIBNFS_API_V2
|
|
+ int bytes = nfs_read(pContext, _pFileHandle, buffer, sizeof(buffer));
|
|
+#else
|
|
int bytes = nfs_read(pContext, _pFileHandle, 32, buffer);
|
|
+#endif
|
|
if (bytes < 0)
|
|
{
|
|
CLog::LogF(LOGERROR, "nfs_read - Error ({}, {})", bytes, nfs_get_error(pContext));
|
|
@@ -741,9 +745,11 @@ ssize_t CNFSFile::Read(void *lpBuf, size_t uiBufSize)
|
|
|
|
if (m_pFileHandle == NULL || m_pNfsContext == NULL )
|
|
return -1;
|
|
-
|
|
+#ifdef LIBNFS_API_V2
|
|
+ numberOfBytesRead = nfs_read(m_pNfsContext, m_pFileHandle, lpBuf, uiBufSize);
|
|
+#else
|
|
numberOfBytesRead = nfs_read(m_pNfsContext, m_pFileHandle, uiBufSize, (char *)lpBuf);
|
|
-
|
|
+#endif
|
|
lock.unlock(); //no need to keep the connection lock after that
|
|
|
|
gNfsConnection.resetKeepAlive(m_exportPath, m_pFileHandle);//triggers keep alive timer reset for this filehandle
|
|
@@ -843,10 +849,14 @@ ssize_t CNFSFile::Write(const void* lpBuf, size_t uiBufSize)
|
|
}
|
|
//write chunk
|
|
//! @bug libnfs < 2.0.0 isn't const correct
|
|
+#ifdef LIBNFS_API_V2
|
|
+ writtenBytes = nfs_write(m_pNfsContext, m_pFileHandle, lpBuf + numberOfBytesWritten, chunkSize);
|
|
+#else
|
|
writtenBytes = nfs_write(m_pNfsContext,
|
|
m_pFileHandle,
|
|
chunkSize,
|
|
const_cast<char*>((const char *)lpBuf) + numberOfBytesWritten);
|
|
+#endif
|
|
//decrease left bytes
|
|
leftBytes-= writtenBytes;
|
|
//increase overall written bytes
|