OSDN Git Service

[Support] Provide linux/magic.h fallback for older kernels
authorMichal Gorny <mgorny@gentoo.org>
Wed, 22 Feb 2017 18:09:15 +0000 (18:09 +0000)
committerMichal Gorny <mgorny@gentoo.org>
Wed, 22 Feb 2017 18:09:15 +0000 (18:09 +0000)
commit39b10e911b615f21226fd8f61136ba6a5cec5e27
tree305e8d092181dbb5b6bd321c561f08e1c791a3ed
parent437bff4b03e50d5ff8870e251f8f04d14053da64
[Support] Provide linux/magic.h fallback for older kernels

The function for distinguishing local and remote files added in r295768
unconditionally uses linux/magic.h header to provide necessary
filesystem magic numbers. However, in kernel headers predating 2.6.18
the magic numbers are spread throughout multiple include files.
Furthermore, LLVM did not require kernel headers being installed so far.

To increase the portability across different versions of Linux kernel
and different Linux systems, add CMake header checks for linux/magic.h
and -- if it is missing -- the linux/nfs_fs.h and linux/smb.h headers
which contained the numbers previously.

Furthermore, since the numbers are static and the feature does not seem
critical enough to make LLVM require kernel headers at all, add fallback
constants for the case when none of the necessary headers is available.

Differential Revision: https://reviews.llvm.org/D30261

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295854 91177308-0d34-0410-b5e6-96231b3b80d8
cmake/config-ix.cmake
lib/Support/Unix/Path.inc