Skip to content

add the module structure to src/op.rs#241

Open
ubnt-intrepid wants to merge 2 commits into
mainfrom
split-op-files
Open

add the module structure to src/op.rs#241
ubnt-intrepid wants to merge 2 commits into
mainfrom
split-op-files

Conversation

@ubnt-intrepid
Copy link
Copy Markdown
Owner

No description provided.

@ubnt-intrepid ubnt-intrepid requested a review from Copilot October 13, 2025 15:01
@codecov
Copy link
Copy Markdown

codecov Bot commented Oct 13, 2025

Codecov Report

❌ Patch coverage is 0% with 491 lines in your changes missing coverage. Please review.
✅ Project coverage is 35.67%. Comparing base (40d8be1) to head (f52556a).

Files with missing lines Patch % Lines
src/op/file.rs 0.00% 137 Missing ⚠️
src/op/inode.rs 0.00% 94 Missing ⚠️
src/op.rs 0.00% 48 Missing ⚠️
src/op/lock.rs 0.00% 41 Missing ⚠️
src/op/forget.rs 0.00% 40 Missing ⚠️
src/op/xattr.rs 0.00% 35 Missing ⚠️
src/op/dir.rs 0.00% 31 Missing ⚠️
src/op/attr.rs 0.00% 29 Missing ⚠️
src/op/copy_file_range.rs 0.00% 12 Missing ⚠️
src/op/create.rs 0.00% 9 Missing ⚠️
... and 2 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #241      +/-   ##
==========================================
- Coverage   37.36%   35.67%   -1.70%     
==========================================
  Files          14       25      +11     
  Lines        2676     2803     +127     
  Branches     2676     2803     +127     
==========================================
  Hits         1000     1000              
- Misses       1628     1755     +127     
  Partials       48       48              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Refactor to modularize src/op.rs by splitting operations into dedicated modules and implementing a shared decoding mechanism.

  • Split monolithic op.rs into focused modules (attr, file, dir, inode, lock, xattr, etc.)
  • Introduced Context and an Op trait to delegate request decoding per module
  • Re-exported key operation types from op.rs to preserve the external API surface

Reviewed Changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/op.rs Central dispatcher updated to use Context and Op::decode; re-exports added for module types.
src/op/attr.rs Added Getattr/Setattr and SetAttrTime with decode implementations.
src/op/file.rs Added file-related ops (Open/Read/Write/etc.), flags, and OpenOptions with decode implementations.
src/op/dir.rs Added directory ops (Opendir/Readdir/etc.) with decode implementations.
src/op/inode.rs Added inode-related ops (Lookup/Mknod/Mkdir/Rename/etc.) and RenameFlags.
src/op/lock.rs Added Getlk/Setlk/Flock and SetlkKind decoder.
src/op/xattr.rs Added xattr ops (Setxattr/Getxattr/Listxattr/Removexattr).
src/op/forget.rs Added Forgets/Forget and batch/single decode.
src/op/notify_reply.rs Added NotifyReply decode.
src/op/copy_file_range.rs Added CopyFileRange decode.
src/op/create.rs Added Create op with doc links.
Comments suppressed due to low confidence (1)

src/op/inode.rs:1

  • Corrected wording in the documentation.
use crate::types::{DeviceID, FileMode, FilePermissions, NodeID};

Comment thread src/op.rs
Comment on lines +13 to +28
pub use attr::{Getattr, SetAttrTime, Setattr};
pub use copy_file_range::CopyFileRange;
pub use create::Create;
pub use dir::{Fsyncdir, Opendir, Readdir, ReaddirMode, Releasedir};
pub use file::{
AccessMode, Fallocate, Flush, Fsync, Lseek, Open, OpenFlags, OpenOptions, Poll, Read, Release,
ReleaseFlags, Write,
};
pub use forget::{Forget, Forgets};
pub use inode::{
Access, Bmap, Link, Lookup, Mkdir, Mknod, Readlink, Rename, Rmdir, Statfs, Symlink, Unlink,
};
pub use interrupt::Interrupt;
pub use lock::{Flock, FlockOp, Getlk, Setlk};
pub use notify_reply::NotifyReply;
pub use xattr::{Getxattr, Listxattr, Removexattr, Setxattr, SetxattrFlags};
Copy link

Copilot AI Oct 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Types used in public struct fields are not re-exported, resulting in private types in the public API. Specifically, Rename.flags uses RenameFlags, Fallocate.mode uses FallocateFlags, and Lseek.whence uses Whence, but these types are not re-exported from op.rs. Re-export them to avoid E0446 and keep the API stable. For example: add RenameFlags to the inode re-exports, and FallocateFlags and Whence to the file re-exports.

Copilot uses AI. Check for mistakes.
Comment thread src/op/lock.rs
@@ -0,0 +1,149 @@
use polyfuse_kernel::{fuse_lk_in, fuse_opcode, FUSE_LK_FLOCK};
use rustix::thread::Pid;
Copy link

Copilot AI Oct 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pid is provided by rustix::process in current rustix releases; using rustix::thread::Pid will fail to compile. Replace with rustix::process::Pid to match the rest of the codebase and the API used elsewhere.

Suggested change
use rustix::thread::Pid;
use rustix::process::Pid;

Copilot uses AI. Check for mistakes.
Comment thread src/op/create.rs
/// See also [`Mknod::parent`].
pub parent: NodeID,

/// The file name to crate.
Copy link

Copilot AI Oct 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected spelling in the documentation.

Suggested change
/// The file name to crate.
/// The file name to create.

Copilot uses AI. Check for mistakes.
@codecov-commenter
Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 0% with 491 lines in your changes missing coverage. Please review.
✅ Project coverage is 35.67%. Comparing base (40d8be1) to head (f52556a).
⚠️ Report is 46 commits behind head on main.

Files with missing lines Patch % Lines
src/op/file.rs 0.00% 137 Missing ⚠️
src/op/inode.rs 0.00% 94 Missing ⚠️
src/op.rs 0.00% 48 Missing ⚠️
src/op/lock.rs 0.00% 41 Missing ⚠️
src/op/forget.rs 0.00% 40 Missing ⚠️
src/op/xattr.rs 0.00% 35 Missing ⚠️
src/op/dir.rs 0.00% 31 Missing ⚠️
src/op/attr.rs 0.00% 29 Missing ⚠️
src/op/copy_file_range.rs 0.00% 12 Missing ⚠️
src/op/create.rs 0.00% 9 Missing ⚠️
... and 2 more
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #241      +/-   ##
==========================================
- Coverage   37.36%   35.67%   -1.70%     
==========================================
  Files          14       25      +11     
  Lines        2676     2803     +127     
  Branches     2676     2803     +127     
==========================================
  Hits         1000     1000              
- Misses       1628     1755     +127     
  Partials       48       48              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants