Skip to content

Refactoring path resolve APIs#4

Merged
wangfu91 merged 9 commits intomainfrom
fix-fid-to-path-caching
Jun 4, 2025
Merged

Refactoring path resolve APIs#4
wangfu91 merged 9 commits intomainfrom
fix-fid-to-path-caching

Conversation

@wangfu91
Copy link
Owner

@wangfu91 wangfu91 commented Jun 4, 2025

No description provided.

@wangfu91 wangfu91 self-assigned this Jun 4, 2025
@wangfu91 wangfu91 requested a review from Copilot June 4, 2025 03:44
Copy link
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

Refactors time conversion and path resolution APIs to use more idiomatic patterns, unify resolvers, and borrow Volume instead of moving.

  • Replaced manual Windows FILETIME → SystemTime conversion with a chrono-based implementation.
  • Introduced PathResolvableEntry trait and a generic PathResolver, consolidating MFT and USN logic and cache management.
  • Updated Mft and UsnJournal to borrow Volume, added pretty_format helpers, and adapted examples and README.

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/time.rs Switched to chrono for Windows FILETIME handling
src/path.rs Unified path resolution under PathResolver, added generic trait
src/mft.rs Changed Mft to borrow Volume and added pretty_format
src/journal.rs Changed UsnJournal to borrow Volume, renamed and added helpers
src/lib.rs Updated inline examples to pass &volume
examples/*.rs Migrated examples to PathResolver and pretty_format
README.md Updated usage snippets to new borrow-based APIs
Cargo.toml Added chrono dependency
Comments suppressed due to low confidence (5)

src/path.rs:11

  • The code uses NonZeroUsize in new_with_cache but doesn’t import it. Add use std::num::NonZeroUsize; to the imports.
use std::{

src/time.rs:25

  • The function accepts i64 and casts negatives to large u64 values. Change the parameter to u64 to accurately represent FILETIME intervals.
pub(crate) fn filetime_to_systemtime(filetime: i64) -> SystemTime {

src/path.rs:8

  • c_void is imported but never used. Remove it to keep imports clean.
ffi::{OsString, c_void},

src/path.rs:66

  • The doc mentions "drive letter" but the constructor only takes a Volume. Update the comment to remove the drive letter reference.
/// Create a new `PathResolver` for a given NTFS/ReFs volume and drive letter.

src/path.rs:14

  • Foundation is imported but not referenced. Remove this to avoid unused imports.
Foundation::{self},

@wangfu91 wangfu91 merged commit 795ce8c into main Jun 4, 2025
1 check passed
@wangfu91 wangfu91 deleted the fix-fid-to-path-caching branch June 4, 2025 06:12
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.

2 participants