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 | |
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>
-rwxr-xr-x | old-configure | 1 | ||||
-rw-r--r-- | stream/stream_file.c | 28 | ||||
-rw-r--r-- | wscript | 5 |
3 files changed, 34 insertions, 0 deletions
diff --git a/old-configure b/old-configure index b438f8b33e..42897f3c15 100755 --- a/old-configure +++ b/old-configure @@ -3400,6 +3400,7 @@ cat > $TMPH << EOF /* we didn't bother to add actual config checks for this */ #define HAVE_BSD_FSTATFS 0 +#define HAVE_LINUX_FSTATFS 0 /* system headers */ $def_mman_h 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) { @@ -202,6 +202,11 @@ iconv support use --disable-iconv.", 'func': check_statement(['sys/param.h', 'sys/mount.h'], 'struct statfs fs; fstatfs(0, &fs)') }, { + 'name': 'linux-fstatfs', + 'desc': "Linux's fstatfs()", + 'func': check_statement('sys/vfs.h', + 'struct statfs fs; fstatfs(0, &fs); fs.f_namelen') + }, { 'name': 'sys-sysinfo-h', 'desc': 'sys/sysinfo.h', 'func': check_statement('sys/sysinfo.h', |