|
|
@ -315,18 +315,22 @@ bool Utils::Fs::isNetworkFileSystem(const QString &path) |
|
|
|
|
|
|
|
|
|
|
|
#if defined(Q_OS_MAC) || defined(Q_OS_OPENBSD) |
|
|
|
#if defined(Q_OS_MAC) || defined(Q_OS_OPENBSD) |
|
|
|
// XXX: should we make sure HAVE_STRUCT_FSSTAT_F_FSTYPENAME is defined?
|
|
|
|
// XXX: should we make sure HAVE_STRUCT_FSSTAT_F_FSTYPENAME is defined?
|
|
|
|
return ((strncmp(buf.f_fstypename, "nfs", sizeof(buf.f_fstypename)) == 0) |
|
|
|
return ((strncmp(buf.f_fstypename, "cifs", sizeof(buf.f_fstypename)) == 0) |
|
|
|
|| (strncmp(buf.f_fstypename, "cifs", sizeof(buf.f_fstypename)) == 0) |
|
|
|
|| (strncmp(buf.f_fstypename, "nfs", sizeof(buf.f_fstypename)) == 0) |
|
|
|
|| (strncmp(buf.f_fstypename, "smbfs", sizeof(buf.f_fstypename)) == 0)); |
|
|
|
|| (strncmp(buf.f_fstypename, "smbfs", sizeof(buf.f_fstypename)) == 0)); |
|
|
|
#else |
|
|
|
#else |
|
|
|
// usually defined in /usr/include/linux/magic.h
|
|
|
|
// Magic number references:
|
|
|
|
const unsigned long CIFS_MAGIC_NUMBER = 0xFF534D42; |
|
|
|
// 1. /usr/include/linux/magic.h
|
|
|
|
const unsigned long NFS_SUPER_MAGIC = 0x6969; |
|
|
|
// 2. https://github.com/coreutils/coreutils/blob/master/src/stat.c
|
|
|
|
const unsigned long SMB_SUPER_MAGIC = 0x517B; |
|
|
|
switch (buf.f_type) { |
|
|
|
|
|
|
|
case 0xFF534D42: // CIFS_MAGIC_NUMBER
|
|
|
|
return ((buf.f_type == CIFS_MAGIC_NUMBER) |
|
|
|
case 0x6969: // NFS_SUPER_MAGIC
|
|
|
|
|| (buf.f_type == NFS_SUPER_MAGIC) |
|
|
|
case 0x517B: // SMB_SUPER_MAGIC
|
|
|
|
|| (buf.f_type == SMB_SUPER_MAGIC)); |
|
|
|
case 0xFE534D42: // S_MAGIC_SMB2
|
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
default: |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
} |
|
|
|
} |
|
|
|
#endif |
|
|
|
#endif |
|
|
|