Open
Conversation
Open
Contributor
|
Could we separate the platform specific code? For example, src/platform/linux.rs and src/platform/macos.rs behind a src/platform/mod.rs that re-exports the right impl via #[cfg]. Move into it:
|
congwang-mk
reviewed
Mar 20, 2026
Contributor
congwang-mk
left a comment
There was a problem hiding this comment.
Thanks for your update. Some additional reviews
| let options = vec![ | ||
| let mut options = vec![ | ||
| MountOption::FSName("branchfs".to_string()), | ||
| MountOption::DefaultPermissions, |
Contributor
There was a problem hiding this comment.
Is this also removed for Linux?
| crtime: UNIX_EPOCH, | ||
| kind: FileType::RegularFile, | ||
| perm: 0o600, | ||
| perm: 0o777, |
Contributor
There was a problem hiding this comment.
Is this perm change expected?
| // Report a non-zero size so the kernel issues read() calls. | ||
| // The actual content length is determined by the read handler. | ||
| let size = if ino == CTL_INO { 256 } else { 0 }; | ||
| let size = 0; |
| let mut buf = [0u8; 128]; | ||
| let ret = libc::ioctl(fd, FS_IOC_BRANCH_CREATE as libc::c_ulong, buf.as_mut_ptr()); | ||
| if ret < 0 { | ||
| #[cfg(any(target_os = "macos", target_os = "ios", target_os = "watchos", target_os = "tvos", target_os = "freebsd", target_os = "dragonfly", target_os = "openbsd", target_os = "netbsd"))] |
| if ret < 0 { | ||
| #[cfg(any(target_os = "macos", target_os = "ios", target_os = "watchos", target_os = "tvos", target_os = "freebsd", target_os = "dragonfly", target_os = "openbsd", target_os = "netbsd"))] | ||
| return Err(unsafe { *libc::__error() }); | ||
| #[cfg(not(any(target_os = "macos", target_os = "ios", target_os = "watchos", target_os = "tvos", target_os = "freebsd", target_os = "dragonfly", target_os = "openbsd", target_os = "netbsd")))] |
| #[cfg(target_os = "linux")] | ||
| pub use linux::*; | ||
|
|
||
| #[cfg(not(target_os = "linux"))] |
|
|
||
| #[cfg(not(target_os = "linux"))] | ||
| mod macos; | ||
| #[cfg(not(target_os = "linux"))] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Port branchfs to macOS with verified integration tests and stable control interface
Testing
All existing tests pass