diff options
author | Philip Sequeira <phsequei@gmail.com> | 2014-03-11 15:27:50 -0400 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-03-12 00:46:18 +0100 |
commit | ac4b9a47cef7a17e27fb034b787089cf07f6c3d4 (patch) | |
tree | e40c3a1ce5fc69648b706a1504e4ba714027b69d /stream/stream_file.c | |
parent | 14c1816c717b374d1309fd601ae52002d659e415 (diff) | |
download | mpv-ac4b9a47cef7a17e27fb034b787089cf07f6c3d4.tar.bz2 mpv-ac4b9a47cef7a17e27fb034b787089cf07f6c3d4.tar.xz |
stream_file: network file system detection for Linux
Addresses issue #558 on Linux systems.
Signed-off-by: wm4 <wm4@nowhere>
Diffstat (limited to 'stream/stream_file.c')
-rw-r--r-- | stream/stream_file.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/stream/stream_file.c b/stream/stream_file.c index 9d22bd5539..c62249bf76 100644 --- a/stream/stream_file.c +++ b/stream/stream_file.c @@ -39,6 +39,10 @@ #include <sys/mount.h> #endif +#if HAVE_LINUX_FSTATFS +#include <sys/vfs.h> +#endif + #ifdef __MINGW32__ #include <windows.h> #endif @@ -130,6 +134,30 @@ static bool check_stream_network(stream_t *stream) return false; } +#elif HAVE_LINUX_FSTATFS +static bool check_stream_network(stream_t *stream) +{ + struct statfs fs; + const uint32_t stypes[] = { + 0x5346414F /*AFS*/, 0x61756673 /*AUFS*/, 0x00C36400 /*CEPH*/, + 0xFF534D42 /*CIFS*/, 0x73757245 /*CODA*/, 0x19830326 /*FHGFS*/, + 0x65735546 /*FUSEBLK*/,0x65735543 /*FUSECTL*/,0x1161970 /*GFS*/, + 0x47504653 /*GPFS*/, 0x6B414653 /*KAFS*/, 0x0BD00BD0 /*LUSTRE*/, + 0x564C /*NCP*/, 0x6969 /*NFS*/, 0x6E667364 /*NFSD*/, + 0xAAD7AAEA /*PANFS*/, 0x50495045 /*PIPEFS*/, 0x517B /*SMB*/, + 0xBEEFDEAD /*SNFS*/, 0xBACBACBC /*VMHGFS*/, 0x7461636f /*OCFS2*/, + 0 + }; + struct priv *priv = stream->priv; + if (fstatfs(priv->fd, &fs) == 0) { + for (int i=0; stypes[i]; i++) { + if (stypes[i] == fs.f_type) + return true; + } + } + return false; + +} #elif defined(__MINGW32__) static bool check_stream_network(stream_t *stream) { |