|
|
@@ -0,0 +1,177 @@ |
|
|
From 23ce80d7f303aa3fb282a67b973c20a2e84e48d2 Mon Sep 17 00:00:00 2001 |
|
|
From: Memphiz <memphis@machzwo.de> |
|
|
Date: Fri, 4 May 2012 19:19:26 +0200 |
|
|
Subject: [PATCH 2/2] [nfs] - make impl compatible with latest libnfs and |
|
|
avoid usage of off64_t and size_t |
|
|
|
|
|
--- |
|
|
xbmc/filesystem/DllLibNfs.h | 36 ++++++++++++++++++------------------ |
|
|
xbmc/filesystem/NFSFile.cpp | 10 +++++----- |
|
|
xbmc/filesystem/NFSFile.h | 8 ++++---- |
|
|
3 files changed, 27 insertions(+), 27 deletions(-) |
|
|
|
|
|
diff --git a/xbmc/filesystem/DllLibNfs.h b/xbmc/filesystem/DllLibNfs.h |
|
|
index 37dfc9c..54c6872 100644 |
|
|
--- a/xbmc/filesystem/DllLibNfs.h |
|
|
+++ b/xbmc/filesystem/DllLibNfs.h |
|
|
@@ -44,8 +44,8 @@ class DllLibNfsInterface |
|
|
virtual void free_nfs_srvr_list(struct nfs_server_list *srv)=0; |
|
|
virtual struct nfs_context *nfs_init_context(void)=0; |
|
|
virtual void nfs_destroy_context(struct nfs_context *nfs)=0; |
|
|
- virtual size_t nfs_get_readmax(struct nfs_context *nfs)=0; |
|
|
- virtual size_t nfs_get_writemax(struct nfs_context *nfs)=0; |
|
|
+ virtual uint64_t nfs_get_readmax(struct nfs_context *nfs)=0; |
|
|
+ virtual uint64_t nfs_get_writemax(struct nfs_context *nfs)=0; |
|
|
virtual char *nfs_get_error(struct nfs_context *nfs)=0; |
|
|
virtual int nfs_close(struct nfs_context *nfs, struct nfsfh *nfsfh)=0; |
|
|
virtual int nfs_fsync(struct nfs_context *nfs, struct nfsfh *nfsfh)=0; |
|
|
@@ -57,8 +57,8 @@ class DllLibNfsInterface |
|
|
virtual int nfs_mount(struct nfs_context *nfs, const char *server, const char *exportname)=0; |
|
|
virtual int nfs_stat(struct nfs_context *nfs, const char *path, struct stat *st)=0; |
|
|
virtual int nfs_fstat(struct nfs_context *nfs, struct nfsfh *nfsfh, struct stat *st)=0; |
|
|
- virtual int nfs_truncate(struct nfs_context *nfs, const char *path, off64_t length)=0; |
|
|
- virtual int nfs_ftruncate(struct nfs_context *nfs, struct nfsfh *nfsfh, off64_t length)=0; |
|
|
+ virtual int nfs_truncate(struct nfs_context *nfs, const char *path, uint64_t length)=0; |
|
|
+ virtual int nfs_ftruncate(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t length)=0; |
|
|
virtual int nfs_opendir(struct nfs_context *nfs, const char *path, struct nfsdir **nfsdir)=0; |
|
|
virtual int nfs_statvfs(struct nfs_context *nfs, const char *path, struct statvfs *svfs)=0; |
|
|
virtual int nfs_chmod(struct nfs_context *nfs, const char *path, int mode)=0; |
|
|
@@ -73,12 +73,12 @@ class DllLibNfsInterface |
|
|
virtual int nfs_chown(struct nfs_context *nfs, const char *path, int uid, int gid)=0; |
|
|
virtual int nfs_fchown(struct nfs_context *nfs, struct nfsfh *nfsfh, int uid, int gid)=0; |
|
|
virtual int nfs_open(struct nfs_context *nfs, const char *path, int mode, struct nfsfh **nfsfh)=0; |
|
|
- virtual int nfs_read(struct nfs_context *nfs, struct nfsfh *nfsfh, size_t count, char *buf)=0; |
|
|
- virtual int nfs_write(struct nfs_context *nfs, struct nfsfh *nfsfh, size_t count, char *buf)=0; |
|
|
+ virtual int nfs_read(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t count, char *buf)=0; |
|
|
+ virtual int nfs_write(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t count, char *buf)=0; |
|
|
virtual int nfs_creat(struct nfs_context *nfs, const char *path, int mode, struct nfsfh **nfsfh)=0; |
|
|
- virtual int nfs_pread(struct nfs_context *nfs, struct nfsfh *nfsfh, off64_t offset, size_t count, char *buf)=0; |
|
|
- virtual int nfs_pwrite(struct nfs_context *nfs, struct nfsfh *nfsfh, off64_t offset, size_t count, char *buf)=0; |
|
|
- virtual int nfs_lseek(struct nfs_context *nfs, struct nfsfh *nfsfh, off64_t offset, int whence, off64_t *current_offset)=0; |
|
|
+ virtual int nfs_pread(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t offset, uint64_t count, char *buf)=0; |
|
|
+ virtual int nfs_pwrite(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t offset, uint64_t count, char *buf)=0; |
|
|
+ virtual int nfs_lseek(struct nfs_context *nfs, struct nfsfh *nfsfh, uint64_t offset, int whence, uint64_t *current_offset)=0; |
|
|
}; |
|
|
|
|
|
class DllLibNfs : public DllDynamic, DllLibNfsInterface |
|
|
@@ -90,8 +90,8 @@ class DllLibNfs : public DllDynamic, DllLibNfsInterface |
|
|
DEFINE_METHOD1(struct exportnode *, mount_getexports, (const char *p1)) |
|
|
DEFINE_METHOD1(void, mount_free_export_list, (struct exportnode *p1)) |
|
|
DEFINE_METHOD1(void, nfs_destroy_context, (struct nfs_context *p1)) |
|
|
- DEFINE_METHOD1(size_t, nfs_get_readmax, (struct nfs_context *p1)) |
|
|
- DEFINE_METHOD1(size_t, nfs_get_writemax, (struct nfs_context *p1)) |
|
|
+ DEFINE_METHOD1(uint64_t, nfs_get_readmax, (struct nfs_context *p1)) |
|
|
+ DEFINE_METHOD1(uint64_t, nfs_get_writemax, (struct nfs_context *p1)) |
|
|
DEFINE_METHOD1(char *, nfs_get_error, (struct nfs_context *p1)) |
|
|
DEFINE_METHOD2(struct nfsdirent *, nfs_readdir, (struct nfs_context *p1, struct nfsdir *p2)) |
|
|
DEFINE_METHOD2(int, nfs_fsync, (struct nfs_context *p1, struct nfsfh *p2)) |
|
|
@@ -103,8 +103,8 @@ class DllLibNfs : public DllDynamic, DllLibNfsInterface |
|
|
DEFINE_METHOD3(int, nfs_mount, (struct nfs_context *p1, const char *p2, const char *p3)) |
|
|
DEFINE_METHOD3(int, nfs_stat, (struct nfs_context *p1, const char *p2, struct stat *p3)) |
|
|
DEFINE_METHOD3(int, nfs_fstat, (struct nfs_context *p1, struct nfsfh *p2, struct stat *p3)) |
|
|
- DEFINE_METHOD3(int, nfs_truncate, (struct nfs_context *p1, const char *p2, off64_t p3)) |
|
|
- DEFINE_METHOD3(int, nfs_ftruncate, (struct nfs_context *p1, struct nfsfh *p2, off64_t p3)) |
|
|
+ DEFINE_METHOD3(int, nfs_truncate, (struct nfs_context *p1, const char *p2, uint64_t p3)) |
|
|
+ DEFINE_METHOD3(int, nfs_ftruncate, (struct nfs_context *p1, struct nfsfh *p2, uint64_t p3)) |
|
|
DEFINE_METHOD3(int, nfs_opendir, (struct nfs_context *p1, const char *p2, struct nfsdir **p3)) |
|
|
DEFINE_METHOD3(int, nfs_statvfs, (struct nfs_context *p1, const char *p2, struct statvfs *p3)) |
|
|
DEFINE_METHOD3(int, nfs_chmod, (struct nfs_context *p1, const char *p2, int p3)) |
|
|
@@ -116,15 +116,15 @@ class DllLibNfs : public DllDynamic, DllLibNfsInterface |
|
|
DEFINE_METHOD3(int, nfs_rename, (struct nfs_context *p1, const char *p2, const char *p3)) |
|
|
DEFINE_METHOD3(int, nfs_link, (struct nfs_context *p1, const char *p2, const char *p3)) |
|
|
DEFINE_METHOD4(int, nfs_open, (struct nfs_context *p1, const char *p2, int p3, struct nfsfh **p4)) |
|
|
- DEFINE_METHOD4(int, nfs_read, (struct nfs_context *p1, struct nfsfh *p2, size_t p3, char *p4)) |
|
|
- DEFINE_METHOD4(int, nfs_write, (struct nfs_context *p1, struct nfsfh *p2, size_t p3, char *p4)) |
|
|
+ DEFINE_METHOD4(int, nfs_read, (struct nfs_context *p1, struct nfsfh *p2, uint64_t p3, char *p4)) |
|
|
+ DEFINE_METHOD4(int, nfs_write, (struct nfs_context *p1, struct nfsfh *p2, uint64_t p3, char *p4)) |
|
|
DEFINE_METHOD4(int, nfs_creat, (struct nfs_context *p1, const char *p2, int p3, struct nfsfh **p4)) |
|
|
DEFINE_METHOD4(int, nfs_readlink, (struct nfs_context *p1, const char *p2, char *p3, int p4)) |
|
|
DEFINE_METHOD4(int, nfs_chown, (struct nfs_context *p1, const char *p2, int p3, int p4)) |
|
|
DEFINE_METHOD4(int, nfs_fchown, (struct nfs_context *p1, struct nfsfh *p2, int p3, int p4)) |
|
|
- DEFINE_METHOD5(int, nfs_pread, (struct nfs_context *p1, struct nfsfh *p2, off64_t p3, size_t p4, char *p5)) |
|
|
- DEFINE_METHOD5(int, nfs_pwrite, (struct nfs_context *p1, struct nfsfh *p2, off64_t p3, size_t p4, char *p5)) |
|
|
- DEFINE_METHOD5(int, nfs_lseek, (struct nfs_context *p1, struct nfsfh *p2, off64_t p3, int p4, off64_t *p5)) |
|
|
+ DEFINE_METHOD5(int, nfs_pread, (struct nfs_context *p1, struct nfsfh *p2, uint64_t p3, uint64_t p4, char *p5)) |
|
|
+ DEFINE_METHOD5(int, nfs_pwrite, (struct nfs_context *p1, struct nfsfh *p2, uint64_t p3, uint64_t p4, char *p5)) |
|
|
+ DEFINE_METHOD5(int, nfs_lseek, (struct nfs_context *p1, struct nfsfh *p2, uint64_t p3, int p4, uint64_t *p5)) |
|
|
|
|
|
|
|
|
|
|
|
diff --git a/xbmc/filesystem/FileNFS.cpp b/xbmc/filesystem/FileNFS.cpp |
|
|
index 2f820f7..751eb54 100644 |
|
|
--- a/xbmc/filesystem/FileNFS.cpp |
|
|
+++ b/xbmc/filesystem/FileNFS.cpp |
|
|
@@ -375,7 +375,7 @@ void CNfsConnection::resetKeepAlive(struct nfsfh *_pFileHandle) |
|
|
//we were before |
|
|
void CNfsConnection::keepAlive(struct nfsfh *_pFileHandle) |
|
|
{ |
|
|
- off64_t offset = 0; |
|
|
+ uint64_t offset = 0; |
|
|
char buffer[32]; |
|
|
CLog::Log(LOGNOTICE, "NFS: sending keep alive after %i s.",KEEP_ALIVE_TIMEOUT/2); |
|
|
CSingleLock lock(*this); |
|
|
@@ -461,7 +461,7 @@ void CNfsConnection::AddIdleConnection() |
|
|
int64_t CNFSFile::GetPosition() |
|
|
{ |
|
|
int ret = 0; |
|
|
- off64_t offset = 0; |
|
|
+ uint64_t offset = 0; |
|
|
CSingleLock lock(gNfsConnection); |
|
|
|
|
|
if (gNfsConnection.GetNfsContext() == NULL || m_pFileHandle == NULL) return 0; |
|
|
@@ -587,7 +587,7 @@ unsigned int CNFSFile::Read(void *lpBuf, int64_t uiBufSize) |
|
|
|
|
|
if (m_pFileHandle == NULL || m_pNfsContext == NULL ) return 0; |
|
|
|
|
|
- numberOfBytesRead = gNfsConnection.GetImpl()->nfs_read(m_pNfsContext, m_pFileHandle, (size_t)uiBufSize, (char *)lpBuf); |
|
|
+ numberOfBytesRead = gNfsConnection.GetImpl()->nfs_read(m_pNfsContext, m_pFileHandle, uiBufSize, (char *)lpBuf); |
|
|
|
|
|
lock.Leave();//no need to keep the connection lock after that |
|
|
|
|
|
@@ -605,7 +605,7 @@ unsigned int CNFSFile::Read(void *lpBuf, int64_t uiBufSize) |
|
|
int64_t CNFSFile::Seek(int64_t iFilePosition, int iWhence) |
|
|
{ |
|
|
int ret = 0; |
|
|
- off64_t offset = 0; |
|
|
+ uint64_t offset = 0; |
|
|
|
|
|
CSingleLock lock(gNfsConnection); |
|
|
if (m_pFileHandle == NULL || m_pNfsContext == NULL) return -1; |
|
|
@@ -667,7 +667,7 @@ int CNFSFile::Write(const void* lpBuf, int64_t uiBufSize) |
|
|
//write chunk |
|
|
writtenBytes = gNfsConnection.GetImpl()->nfs_write(m_pNfsContext, |
|
|
m_pFileHandle, |
|
|
- (size_t)chunkSize, |
|
|
+ chunkSize, |
|
|
(char *)lpBuf + numberOfBytesWritten); |
|
|
//decrease left bytes |
|
|
leftBytes-= writtenBytes; |
|
|
diff --git a/xbmc/filesystem/FileNFS.h b/xbmc/filesystem/FileNFS.h |
|
|
index 47d8d4a..df131b0 100644 |
|
|
--- a/xbmc/filesystem/FileNFS.h |
|
|
+++ b/xbmc/filesystem/FileNFS.h |
|
|
@@ -65,8 +65,8 @@ class CNfsConnection : public CCriticalSection |
|
|
~CNfsConnection(); |
|
|
bool Connect(const CURL &url, CStdString &relativePath); |
|
|
struct nfs_context *GetNfsContext(){return m_pNfsContext;} |
|
|
- size_t GetMaxReadChunkSize(){return m_readChunkSize;} |
|
|
- size_t GetMaxWriteChunkSize(){return m_writeChunkSize;} |
|
|
+ uint64_t GetMaxReadChunkSize(){return m_readChunkSize;} |
|
|
+ uint64_t GetMaxWriteChunkSize(){return m_writeChunkSize;} |
|
|
DllLibNfs *GetImpl(){return m_pLibNfs;} |
|
|
std::list<CStdString> GetExportList(const CURL &url); |
|
|
//this functions splits the url into the exportpath (feed to mount) and the rest of the path |
|
|
@@ -96,8 +96,8 @@ class CNfsConnection : public CCriticalSection |
|
|
CStdString m_exportPath;//current connected export path |
|
|
CStdString m_hostName;//current connected host |
|
|
CStdString m_resolvedHostName;//current connected host - as ip |
|
|
- size_t m_readChunkSize;//current read chunksize of connected server |
|
|
- size_t m_writeChunkSize;//current write chunksize of connected server |
|
|
+ uint64_t m_readChunkSize;//current read chunksize of connected server |
|
|
+ uint64_t m_writeChunkSize;//current write chunksize of connected server |
|
|
int m_OpenConnections;//number of open connections |
|
|
unsigned int m_IdleTimeout;//timeout for idle connection close and dyunload |
|
|
tFileKeepAliveMap m_KeepAliveTimeouts;//mapping filehandles to its idle timeout |
|
|
-- |
|
|
1.7.10 |
|
|
|