-
Notifications
You must be signed in to change notification settings - Fork 161
fuse: Add support for STATX operation #2589
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
This PR modifies files containing For more on why we check whole files, instead of just diffs, check out the Rustonomicon |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds support for the STATX operation in the FUSE filesystem implementation to support the Linux statx system call, which has become the default stat operation in modern Linux distributions.
Key Changes:
- Introduces a new
StatExstruct that represents extended stat information with additional fields like creation time, extended attributes, and device major/minor numbers - Updates the internal
fstat()andlstat()methods to returnStatExinstead ofStat, with automatic conversion toStatwhere needed for backward compatibility - Implements the FUSE STATX protocol including request parsing, session handling, and response generation
Reviewed changes
Copilot reviewed 18 out of 19 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| vm/devices/virtio/virtiofs/src/util.rs | Adds conversion functions from StatEx and StatExTimestamp to FUSE protocol structures |
| vm/devices/virtio/virtiofs/src/lib.rs | Implements get_statx() method to handle STATX requests in VirtioFs |
| vm/devices/virtio/virtiofs/src/inode.rs | Adds get_statx() method to retrieve extended attributes for inodes |
| vm/devices/virtio/virtiofs/src/file.rs | Adds get_statx() method for open files and updates get_attr() to convert StatEx to Stat |
| vm/devices/support/fs/plan9/src/fid.rs | Updates to convert StatEx to Stat for Plan9 filesystem compatibility |
| vm/devices/support/fs/lxutil/src/windows/util.rs | Updates return type and mode casting for StatEx compatibility |
| vm/devices/support/fs/lxutil/src/windows/mod.rs | Changes lstat() and fstat() to return StatEx, with conversions where needed |
| vm/devices/support/fs/lxutil/src/windows/fs.rs | Implements full StatEx construction from Windows file attributes |
| vm/devices/support/fs/lxutil/src/unix/util.rs | Adds conversion function from libc statx to lx::StatEx |
| vm/devices/support/fs/lxutil/src/unix/mod.rs | Updates fstat() to use statx syscall and return StatEx |
| vm/devices/support/fs/lxutil/src/lib.rs | Updates public API for lstat() and fstat(), adds new statx() method |
| vm/devices/support/fs/lx/src/lib.rs | Defines StatEx, StatExMask, StatExAttributes, and StatExTimestamp structures with conversion from StatEx to Stat |
| vm/devices/support/fs/lx/Cargo.toml | Adds dependencies for bitfield-struct, static_assertions, and zerocopy |
| vm/devices/support/fs/fuse/src/session.rs | Handles STATX operation in the FUSE session |
| vm/devices/support/fs/fuse/src/request.rs | Adds STATX operation to request parser with test case |
| vm/devices/support/fs/fuse/src/protocol.rs | Defines FUSE STATX protocol structures including fuse_statx, fuse_sx_time, StatxFlags, fuse_statx_in, and fuse_statx_out |
| vm/devices/support/fs/fuse/src/lib.rs | Adds get_statx() trait method and fuse_statx_out constructor |
| vm/devices/support/fs/fuse/Cargo.toml | Adds bitfield-struct dependency |
| Cargo.lock | Updates lock file with new dependencies |
| pub fn fstat(&self) -> lx::Result<lx::StatEx> { | ||
| self.inner.fstat() |
Copilot
AI
Dec 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The public API of fstat() now returns lx::StatEx instead of lx::Stat. This is a breaking change that will affect any code comparing Stat and StatEx values. Consider whether StatEx should also derive PartialEq and Eq to maintain compatibility with existing patterns, or ensure that all comparison code is updated to convert StatEx to Stat explicitly using .into() when needed.
| pub fn fstat(&self) -> lx::Result<lx::StatEx> { | |
| self.inner.fstat() | |
| pub fn fstat(&self) -> lx::Result<lx::Stat> { | |
| self.inner.fstat().map(Into::into) |
Support STATX opcode which is used to support the linux statx call and has become the default stat operation in modern linux distros.