Files
LibretroAdmin 5627044718 vfs: a file's volume - read-only, change-time kept, mount, drive kind
retro_vfs_file_volume_impl() tells, for an open stream, what its
volume is; retro_vfs_stat_volume_impl() the same for a path, following
links. The caller says what it wants, as each part costs a query of its
own on some platforms:

- WANT_FLAGS: mounted read-only, and whether the filesystem's kernel
  alone sets change times (so no user can forge one). One fstatfs()
  answers both on Linux (statfs's f_flags, ST_VALID since 2.6.36, with
  a statvfs fallback before that), macOS and the BSDs; statvfs()
  elsewhere on POSIX. Windows reads FILE_READ_ONLY_VOLUME through
  GetVolumeInformationByHandleW, looked up by name once, lock-free.
- WANT_MOUNT (Linux): the mount id, from statx's STATX_MNT_ID through
  syscall(), else /proc/self/fdinfo.
- WANT_KIND (Windows): the drive type of the path's drive letter -
  fixed, removable, remote or RAM.

Purely additive: nothing existing calls it. UWP answers "can't be
told"; the backend parity check agrees on all 44 symbols.
vfs_stable_test checks it against statfs/statvfs and /proc's mnt_id,
two opens of a file against each other and the path lookup, /proc as
another mount, and Windows' drive kind and flags (under wine, 64-bit,
64-bit stdio and 32-bit). The fdinfo fallback was run with statx
refused.
2026-11-16 16:01:16 +01:00
..