private static FileAttributes.CaseSensitivity getLinuxCaseSensitivity(String path) {
    LibC libC;
    try {
      libC = LibC.INSTANCE;
    }
    catch (Throwable t) {
      LOG.warn(t);
      LINUX_CS_API_AVAILABLE = false;
      return FileAttributes.CaseSensitivity.UNKNOWN;
    }
    try {
      Memory buf = new Memory(256);
      if (libC.statfs(path, buf) != 0) {
        if (LOG.isDebugEnabled()) LOG.debug("statfs(" + path + "): error");
      }
      else {
        long fs = Native.LONG_SIZE == 4 ? ((long)buf.getInt(0)) & 0xFFFFFFFFL : buf.getLong(0);
        // Btrfs, XFS
        if (fs == 0x9123683EL || fs == 0x58465342L) {
          return FileAttributes.CaseSensitivity.SENSITIVE;
        }
        // VFAT
        if (fs == 0x4D44L) {
          return FileAttributes.CaseSensitivity.INSENSITIVE;
        }
        // Ext*, F2FS
        if ((fs == 0xEF53L || fs == 0xF2F52010L) && ourLibExt2FsPresent) {
          E2P e2P;
          try {
            e2P = E2P.INSTANCE;
          }
          catch (Throwable t) {
            LOG.warn(t);
            ourLibExt2FsPresent = false;
            return FileAttributes.CaseSensitivity.UNKNOWN;
          }
          LongByReference flags = new LongByReference();
          if (e2P.fgetflags(path, flags) != 0) {
            if (LOG.isDebugEnabled()) LOG.debug("fgetflags(" + path + "): error");
          }
          else {
            // Ext4/F2FS inodes on file systems with "casefold" option enable may have EXT4_CASEFOLD_FL (F2FS_CASEFOLD_FL) attribute
            // see e.g. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b886ee3e778ec2ad43e276fd378ab492cf6819b7
            return (flags.getValue() & E2P.EXT4_CASEFOLD_FL) == 0 ? FileAttributes.CaseSensitivity.SENSITIVE : FileAttributes.CaseSensitivity.INSENSITIVE;
          }
        }
      }
    }
    catch (Throwable t) {
      LOG.warn("path: " + path, t);
    }

    return FileAttributes.CaseSensitivity.UNKNOWN;
  }
private static FileAttributes.CaseSensitivity getLinuxCaseSensitivity(String path)