forked from containers/libkrun
-
Notifications
You must be signed in to change notification settings - Fork 2
feat(devices): add overlayfs implementation for macOS #7
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
Merged
Conversation
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
Add an overlay filesystem implementation that combines multiple layers into a single logical filesystem, following OCI image specification's layer filesystem changeset format. This implementation: - Supports multiple read-only lower layers and one writable upper layer - Uses OCI-style whiteout files (.wh. prefix) to mark deleted files - Uses OCI-style opaque directory markers (.wh..wh..opq) to mask directories - Includes comprehensive test suite for layer operations - Adds intaglio and tempfile dependencies for symbol interning and testing The implementation provides a foundation for container image support on macOS by allowing multiple filesystem layers to be combined into a single view.
- Split overlayfs.rs into separate fs.rs and tests.rs modules - Simplify layer root handling by replacing path_to_inode_map with layer_roots - Improve lookup logic to handle whiteouts and opaque directories correctly - Add comprehensive test cases for complex directory structures - Add Debug derive for MultikeyBTreeMap and other structs - Remove unused helper methods and simplify path handling - Add helper functions for volume path construction - Improve error handling consistency The main architectural change is moving from a path-based lookup system to a layer-based traversal system that better handles overlay filesystem semantics like whiteouts and opaque directories.
Adds support for modifying file attributes and copying files from lower layers to the upper layer in the macOS overlayfs implementation. Key changes include: - Add setattr support for changing file permissions, ownership, size and timestamps - Implement copyup functionality to promote files to upper layer when modified - Add extended attribute support for storing overlayfs-specific metadata - Add comprehensive tests for operations - Refactor stat operations to handle overlayfs permission overrides - Make inode data fields public within crate for testing
Implements the unlink operation for the overlayfs filesystem, allowing files to be deleted from any layer. Key changes include: - Add get_top_layer_idx helper method to get index of top layer - Implement do_unlink to handle file deletion and whiteout creation - Refactor do_forget to handle inode reference counting - Add dev_ino_and_name_to_vol_whiteout_path helper for whiteout files - Add comprehensive test suite for unlink functionality including: - Basic file deletion - Whiteout creation for lower layer files - Multi-layer scenarios - Error cases - Complex directory structures
- Add do_rmdir() implementation for directory removal across layers - Fix path_inodes handling in lookup_segment_by_segment - Add whiteout file creation for removed directories - Fix path handling in do_copyup to skip root inode - Add comprehensive test coverage for rmdir functionality
Implement symlink support for the OverlayFs filesystem and add comprehensive test coverage for OverlayFs. Key changes include: - Add do_symlink() implementation in OverlayFs - Add symlink tests covering basic functionality, nested directories, multiple layers, and error cases - Clean up error handling pattern in do_mkdir()
This commit implements the rename operation for the overlayfs filesystem on macOS and adds extensive test coverage. Key changes include: - Implement `do_rename` method to handle file/directory renaming - Add helper method `create_whiteout_for_lower` to handle whiteout creation - Support LINUX_RENAME_WHITEOUT and LINUX_RENAME_EXCHANGE flags - Add comprehensive tests for rename functionality including: - Basic rename operations - Whiteout handling - Multi-layer scenarios - Complex directory structures - Error cases
Adds support for creating hard links in the overlayfs filesystem implementation. Key changes include: - Implement do_link() method to handle hard link creation - Add comprehensive test suite for link functionality including: - Basic link creation - Links across multiple layers - Error handling - Nested directory scenarios - Whiteout handling
This commit adds several key improvements to the overlayfs implementation: - Implements open() and release() operations for files and directories - Adds CachePolicy enum to control FUSE caching behavior - Improves copy-up operation by: - Using clonefile() for COW semantics when available on macOS - Falling back to regular copy when clonefile fails - Extracting copy logic into separate helper method - Adds comprehensive tests for open/release and copy-up operations - Fixes init_handle value to start at 0 - Renames do_copyup to copy_up for consistency The changes improve performance by using COW semantics where possible and add proper file handle management. The new CachePolicy gives users control over how aggressively the FUSE client caches file data.
…ests Implement the read method for the OverlayFS filesystem, allowing files to be read from any layer in the overlay stack. The implementation handles: - Basic file reading with offset and size controls - Reading through copied-up files - Proper handling of whiteout files and opaque directories - Special handling for the init binary when not in EFI mode Add extensive test coverage including: - Basic read functionality - Reading with offsets - Partial reads - Reading through nested directories - Proper handling of whiteouts and opaque directories - Reading after copy-up operations - Error cases with invalid handles
Implements the write method for the overlayfs filesystem, allowing files to be written to and modified. The implementation includes: - Basic write functionality with offset support - Copy-up behavior when writing to files in lower layers - Proper handling of whiteouts and opaque directories - Support for partial writes and multiple write operations Also adds comprehensive test coverage for the write functionality, including: - Basic write operations - Writing with offsets - Partial writes - Copy-up behavior - Invalid handle handling - Multiple sequential writes - Writing to files in nested directories - Interaction with whiteouts and opaque directories Additionally: - Renames NotReallyZeroCopyWriter to TestContainer - Implements ZeroCopyReader for TestContainer to support write tests - Removes commented out test_open_root_directory
…cos overlayfs Implement several filesystem operations for the macOS overlayfs: - Add flush operation that emulates fd close behavior using dup/close - Add fsync operation to synchronize file contents - Implement opendir by reusing existing do_open with O_DIRECTORY flag - Add comprehensive test suite for opendir functionality The tests cover: - Basic directory opening - Handling non-existent directories - Whiteout directory behavior - Copy-up scenarios - Multiple open/release cycles - Various open flags combinations
Previously, the overlayfs implementation would copy files to the top layer even for read-only operations. This was unnecessary overhead since files only need to be in the top layer when they are being modified. This change optimizes the behavior by only performing copy-up when write access is requested. The implementation now checks the O_ACCMODE flags to determine if the file needs to be copied to the top layer. Added test cases to verify: - Opening files read-only keeps them in the bottom layer - Opening directories read-only keeps them in the bottom layer
Add support for extended attributes (xattrs) in the overlayfs implementation: - Implement setxattr, getxattr, listxattr and removexattr operations - Add xattr configuration flag to enable/disable xattr support - Handle copy-up operations when setting xattrs on files in lower layers - Add comprehensive test coverage for xattr operations including: - Basic set/get/list/remove operations - Copy-up behavior for lower layer files - Error handling for invalid operations - Proper handling when xattr support is disabled
…rlayfs - Add create() operation to support creating new files with permissions - Add mknod() operation for special files (as regular files on macOS) - Add access() operation with Unix permission checking logic - Reorganize tests into separate modules The implementation handles file ownership, permissions, security contexts, and parent directory copy-up when needed.
Implements the following filesystem operations for macOS overlayfs: - fallocate: Preallocates space for files - lseek: Repositions file offset with special handling for SEEK_DATA/SEEK_HOLE - setupmapping: Sets up DAX memory mapping between guest and host - removemapping: Removes DAX memory mappings Also fixes comparison of libc function return values to check for < 0 instead of != 0 to properly handle errors.
e7ced2a to
daea9cc
Compare
appcypher
added a commit
that referenced
this pull request
Jun 8, 2025
* feat(devices): add overlayfs implementation for macOS Add an overlay filesystem implementation that combines multiple layers into a single logical filesystem, following OCI image specification's layer filesystem changeset format. This implementation: - Supports multiple read-only lower layers and one writable upper layer - Uses OCI-style whiteout files (.wh. prefix) to mark deleted files - Uses OCI-style opaque directory markers (.wh..wh..opq) to mask directories - Includes comprehensive test suite for layer operations - Adds intaglio and tempfile dependencies for symbol interning and testing The implementation provides a foundation for container image support on macOS by allowing multiple filesystem layers to be combined into a single view. * refactor(overlayfs): improve lookup logic and file organization - Split overlayfs.rs into separate fs.rs and tests.rs modules - Simplify layer root handling by replacing path_to_inode_map with layer_roots - Improve lookup logic to handle whiteouts and opaque directories correctly - Add comprehensive test cases for complex directory structures - Add Debug derive for MultikeyBTreeMap and other structs - Remove unused helper methods and simplify path handling - Add helper functions for volume path construction - Improve error handling consistency The main architectural change is moving from a path-based lookup system to a layer-based traversal system that better handles overlay filesystem semantics like whiteouts and opaque directories. * feat(overlayfs): implement setattr and copyup functionality Adds support for modifying file attributes and copying files from lower layers to the upper layer in the macOS overlayfs implementation. Key changes include: - Add setattr support for changing file permissions, ownership, size and timestamps - Implement copyup functionality to promote files to upper layer when modified - Add extended attribute support for storing overlayfs-specific metadata - Add comprehensive tests for operations - Refactor stat operations to handle overlayfs permission overrides - Make inode data fields public within crate for testing * feat(overlayfs): implement unlink operation and add tests Implements the unlink operation for the overlayfs filesystem, allowing files to be deleted from any layer. Key changes include: - Add get_top_layer_idx helper method to get index of top layer - Implement do_unlink to handle file deletion and whiteout creation - Refactor do_forget to handle inode reference counting - Add dev_ino_and_name_to_vol_whiteout_path helper for whiteout files - Add comprehensive test suite for unlink functionality including: - Basic file deletion - Whiteout creation for lower layer files - Multi-layer scenarios - Error cases - Complex directory structures * feat(overlayfs): implement rmdir and fix lookup path handling - Add do_rmdir() implementation for directory removal across layers - Fix path_inodes handling in lookup_segment_by_segment - Add whiteout file creation for removed directories - Fix path handling in do_copyup to skip root inode - Add comprehensive test coverage for rmdir functionality * feat(overlayfs): implement symlink support for OverlayFs and add tests Implement symlink support for the OverlayFs filesystem and add comprehensive test coverage for OverlayFs. Key changes include: - Add do_symlink() implementation in OverlayFs - Add symlink tests covering basic functionality, nested directories, multiple layers, and error cases - Clean up error handling pattern in do_mkdir() * feat(overlayfs): implement rename operation and add tests This commit implements the rename operation for the overlayfs filesystem on macOS and adds extensive test coverage. Key changes include: - Implement `do_rename` method to handle file/directory renaming - Add helper method `create_whiteout_for_lower` to handle whiteout creation - Support LINUX_RENAME_WHITEOUT and LINUX_RENAME_EXCHANGE flags - Add comprehensive tests for rename functionality including: - Basic rename operations - Whiteout handling - Multi-layer scenarios - Complex directory structures - Error cases * feat(overlayfs): implement hard link support for overlayfs Adds support for creating hard links in the overlayfs filesystem implementation. Key changes include: - Implement do_link() method to handle hard link creation - Add comprehensive test suite for link functionality including: - Basic link creation - Links across multiple layers - Error handling - Nested directory scenarios - Whiteout handling * feat(overlayfs): Implement open/release and improve copy-up operations This commit adds several key improvements to the overlayfs implementation: - Implements open() and release() operations for files and directories - Adds CachePolicy enum to control FUSE caching behavior - Improves copy-up operation by: - Using clonefile() for COW semantics when available on macOS - Falling back to regular copy when clonefile fails - Extracting copy logic into separate helper method - Adds comprehensive tests for open/release and copy-up operations - Fixes init_handle value to start at 0 - Renames do_copyup to copy_up for consistency The changes improve performance by using COW semantics where possible and add proper file handle management. The new CachePolicy gives users control over how aggressively the FUSE client caches file data. * feat(overlayfs): Implement read functionality and add comprehensive tests Implement the read method for the OverlayFS filesystem, allowing files to be read from any layer in the overlay stack. The implementation handles: - Basic file reading with offset and size controls - Reading through copied-up files - Proper handling of whiteout files and opaque directories - Special handling for the init binary when not in EFI mode Add extensive test coverage including: - Basic read functionality - Reading with offsets - Partial reads - Reading through nested directories - Proper handling of whiteouts and opaque directories - Reading after copy-up operations - Error cases with invalid handles * feat(overlayfs): Implement write functionality and add tests Implements the write method for the overlayfs filesystem, allowing files to be written to and modified. The implementation includes: - Basic write functionality with offset support - Copy-up behavior when writing to files in lower layers - Proper handling of whiteouts and opaque directories - Support for partial writes and multiple write operations Also adds comprehensive test coverage for the write functionality, including: - Basic write operations - Writing with offsets - Partial writes - Copy-up behavior - Invalid handle handling - Multiple sequential writes - Writing to files in nested directories - Interaction with whiteouts and opaque directories Additionally: - Renames NotReallyZeroCopyWriter to TestContainer - Implements ZeroCopyReader for TestContainer to support write tests - Removes commented out test_open_root_directory * feat(overlayfs): implement flush, fsync and opendir operations for macos overlayfs Implement several filesystem operations for the macOS overlayfs: - Add flush operation that emulates fd close behavior using dup/close - Add fsync operation to synchronize file contents - Implement opendir by reusing existing do_open with O_DIRECTORY flag - Add comprehensive test suite for opendir functionality The tests cover: - Basic directory opening - Handling non-existent directories - Whiteout directory behavior - Copy-up scenarios - Multiple open/release cycles - Various open flags combinations * feat(overlayfs): Skip copy-up for read-only file operations Previously, the overlayfs implementation would copy files to the top layer even for read-only operations. This was unnecessary overhead since files only need to be in the top layer when they are being modified. This change optimizes the behavior by only performing copy-up when write access is requested. The implementation now checks the O_ACCMODE flags to determine if the file needs to be copied to the top layer. Added test cases to verify: - Opening files read-only keeps them in the bottom layer - Opening directories read-only keeps them in the bottom layer * feat(overlayfs): implement extended attributes support Add support for extended attributes (xattrs) in the overlayfs implementation: - Implement setxattr, getxattr, listxattr and removexattr operations - Add xattr configuration flag to enable/disable xattr support - Handle copy-up operations when setting xattrs on files in lower layers - Add comprehensive test coverage for xattr operations including: - Basic set/get/list/remove operations - Copy-up behavior for lower layer files - Error handling for invalid operations - Proper handling when xattr support is disabled * feat(virtio-fs): implement create, mknod and access ops for macOS overlayfs - Add create() operation to support creating new files with permissions - Add mknod() operation for special files (as regular files on macOS) - Add access() operation with Unix permission checking logic - Reorganize tests into separate modules The implementation handles file ownership, permissions, security contexts, and parent directory copy-up when needed. * feat(overlayfs): implement fs operations for macOS overlayfs Implements the following filesystem operations for macOS overlayfs: - fallocate: Preallocates space for files - lseek: Repositions file offset with special handling for SEEK_DATA/SEEK_HOLE - setupmapping: Sets up DAX memory mapping between guest and host - removemapping: Removes DAX memory mappings Also fixes comparison of libc function return values to check for < 0 instead of != 0 to properly handle errors.
appcypher
added a commit
that referenced
this pull request
Jun 26, 2025
* feat(devices): add overlayfs implementation for macOS Add an overlay filesystem implementation that combines multiple layers into a single logical filesystem, following OCI image specification's layer filesystem changeset format. This implementation: - Supports multiple read-only lower layers and one writable upper layer - Uses OCI-style whiteout files (.wh. prefix) to mark deleted files - Uses OCI-style opaque directory markers (.wh..wh..opq) to mask directories - Includes comprehensive test suite for layer operations - Adds intaglio and tempfile dependencies for symbol interning and testing The implementation provides a foundation for container image support on macOS by allowing multiple filesystem layers to be combined into a single view. * refactor(overlayfs): improve lookup logic and file organization - Split overlayfs.rs into separate fs.rs and tests.rs modules - Simplify layer root handling by replacing path_to_inode_map with layer_roots - Improve lookup logic to handle whiteouts and opaque directories correctly - Add comprehensive test cases for complex directory structures - Add Debug derive for MultikeyBTreeMap and other structs - Remove unused helper methods and simplify path handling - Add helper functions for volume path construction - Improve error handling consistency The main architectural change is moving from a path-based lookup system to a layer-based traversal system that better handles overlay filesystem semantics like whiteouts and opaque directories. * feat(overlayfs): implement setattr and copyup functionality Adds support for modifying file attributes and copying files from lower layers to the upper layer in the macOS overlayfs implementation. Key changes include: - Add setattr support for changing file permissions, ownership, size and timestamps - Implement copyup functionality to promote files to upper layer when modified - Add extended attribute support for storing overlayfs-specific metadata - Add comprehensive tests for operations - Refactor stat operations to handle overlayfs permission overrides - Make inode data fields public within crate for testing * feat(overlayfs): implement unlink operation and add tests Implements the unlink operation for the overlayfs filesystem, allowing files to be deleted from any layer. Key changes include: - Add get_top_layer_idx helper method to get index of top layer - Implement do_unlink to handle file deletion and whiteout creation - Refactor do_forget to handle inode reference counting - Add dev_ino_and_name_to_vol_whiteout_path helper for whiteout files - Add comprehensive test suite for unlink functionality including: - Basic file deletion - Whiteout creation for lower layer files - Multi-layer scenarios - Error cases - Complex directory structures * feat(overlayfs): implement rmdir and fix lookup path handling - Add do_rmdir() implementation for directory removal across layers - Fix path_inodes handling in lookup_segment_by_segment - Add whiteout file creation for removed directories - Fix path handling in do_copyup to skip root inode - Add comprehensive test coverage for rmdir functionality * feat(overlayfs): implement symlink support for OverlayFs and add tests Implement symlink support for the OverlayFs filesystem and add comprehensive test coverage for OverlayFs. Key changes include: - Add do_symlink() implementation in OverlayFs - Add symlink tests covering basic functionality, nested directories, multiple layers, and error cases - Clean up error handling pattern in do_mkdir() * feat(overlayfs): implement rename operation and add tests This commit implements the rename operation for the overlayfs filesystem on macOS and adds extensive test coverage. Key changes include: - Implement `do_rename` method to handle file/directory renaming - Add helper method `create_whiteout_for_lower` to handle whiteout creation - Support LINUX_RENAME_WHITEOUT and LINUX_RENAME_EXCHANGE flags - Add comprehensive tests for rename functionality including: - Basic rename operations - Whiteout handling - Multi-layer scenarios - Complex directory structures - Error cases * feat(overlayfs): implement hard link support for overlayfs Adds support for creating hard links in the overlayfs filesystem implementation. Key changes include: - Implement do_link() method to handle hard link creation - Add comprehensive test suite for link functionality including: - Basic link creation - Links across multiple layers - Error handling - Nested directory scenarios - Whiteout handling * feat(overlayfs): Implement open/release and improve copy-up operations This commit adds several key improvements to the overlayfs implementation: - Implements open() and release() operations for files and directories - Adds CachePolicy enum to control FUSE caching behavior - Improves copy-up operation by: - Using clonefile() for COW semantics when available on macOS - Falling back to regular copy when clonefile fails - Extracting copy logic into separate helper method - Adds comprehensive tests for open/release and copy-up operations - Fixes init_handle value to start at 0 - Renames do_copyup to copy_up for consistency The changes improve performance by using COW semantics where possible and add proper file handle management. The new CachePolicy gives users control over how aggressively the FUSE client caches file data. * feat(overlayfs): Implement read functionality and add comprehensive tests Implement the read method for the OverlayFS filesystem, allowing files to be read from any layer in the overlay stack. The implementation handles: - Basic file reading with offset and size controls - Reading through copied-up files - Proper handling of whiteout files and opaque directories - Special handling for the init binary when not in EFI mode Add extensive test coverage including: - Basic read functionality - Reading with offsets - Partial reads - Reading through nested directories - Proper handling of whiteouts and opaque directories - Reading after copy-up operations - Error cases with invalid handles * feat(overlayfs): Implement write functionality and add tests Implements the write method for the overlayfs filesystem, allowing files to be written to and modified. The implementation includes: - Basic write functionality with offset support - Copy-up behavior when writing to files in lower layers - Proper handling of whiteouts and opaque directories - Support for partial writes and multiple write operations Also adds comprehensive test coverage for the write functionality, including: - Basic write operations - Writing with offsets - Partial writes - Copy-up behavior - Invalid handle handling - Multiple sequential writes - Writing to files in nested directories - Interaction with whiteouts and opaque directories Additionally: - Renames NotReallyZeroCopyWriter to TestContainer - Implements ZeroCopyReader for TestContainer to support write tests - Removes commented out test_open_root_directory * feat(overlayfs): implement flush, fsync and opendir operations for macos overlayfs Implement several filesystem operations for the macOS overlayfs: - Add flush operation that emulates fd close behavior using dup/close - Add fsync operation to synchronize file contents - Implement opendir by reusing existing do_open with O_DIRECTORY flag - Add comprehensive test suite for opendir functionality The tests cover: - Basic directory opening - Handling non-existent directories - Whiteout directory behavior - Copy-up scenarios - Multiple open/release cycles - Various open flags combinations * feat(overlayfs): Skip copy-up for read-only file operations Previously, the overlayfs implementation would copy files to the top layer even for read-only operations. This was unnecessary overhead since files only need to be in the top layer when they are being modified. This change optimizes the behavior by only performing copy-up when write access is requested. The implementation now checks the O_ACCMODE flags to determine if the file needs to be copied to the top layer. Added test cases to verify: - Opening files read-only keeps them in the bottom layer - Opening directories read-only keeps them in the bottom layer * feat(overlayfs): implement extended attributes support Add support for extended attributes (xattrs) in the overlayfs implementation: - Implement setxattr, getxattr, listxattr and removexattr operations - Add xattr configuration flag to enable/disable xattr support - Handle copy-up operations when setting xattrs on files in lower layers - Add comprehensive test coverage for xattr operations including: - Basic set/get/list/remove operations - Copy-up behavior for lower layer files - Error handling for invalid operations - Proper handling when xattr support is disabled * feat(virtio-fs): implement create, mknod and access ops for macOS overlayfs - Add create() operation to support creating new files with permissions - Add mknod() operation for special files (as regular files on macOS) - Add access() operation with Unix permission checking logic - Reorganize tests into separate modules The implementation handles file ownership, permissions, security contexts, and parent directory copy-up when needed. * feat(overlayfs): implement fs operations for macOS overlayfs Implements the following filesystem operations for macOS overlayfs: - fallocate: Preallocates space for files - lseek: Repositions file offset with special handling for SEEK_DATA/SEEK_HOLE - setupmapping: Sets up DAX memory mapping between guest and host - removemapping: Removes DAX memory mappings Also fixes comparison of libc function return values to check for < 0 instead of != 0 to properly handle errors.
appcypher
added a commit
that referenced
this pull request
Jun 26, 2025
* feat(devices): add overlayfs implementation for macOS Add an overlay filesystem implementation that combines multiple layers into a single logical filesystem, following OCI image specification's layer filesystem changeset format. This implementation: - Supports multiple read-only lower layers and one writable upper layer - Uses OCI-style whiteout files (.wh. prefix) to mark deleted files - Uses OCI-style opaque directory markers (.wh..wh..opq) to mask directories - Includes comprehensive test suite for layer operations - Adds intaglio and tempfile dependencies for symbol interning and testing The implementation provides a foundation for container image support on macOS by allowing multiple filesystem layers to be combined into a single view. * refactor(overlayfs): improve lookup logic and file organization - Split overlayfs.rs into separate fs.rs and tests.rs modules - Simplify layer root handling by replacing path_to_inode_map with layer_roots - Improve lookup logic to handle whiteouts and opaque directories correctly - Add comprehensive test cases for complex directory structures - Add Debug derive for MultikeyBTreeMap and other structs - Remove unused helper methods and simplify path handling - Add helper functions for volume path construction - Improve error handling consistency The main architectural change is moving from a path-based lookup system to a layer-based traversal system that better handles overlay filesystem semantics like whiteouts and opaque directories. * feat(overlayfs): implement setattr and copyup functionality Adds support for modifying file attributes and copying files from lower layers to the upper layer in the macOS overlayfs implementation. Key changes include: - Add setattr support for changing file permissions, ownership, size and timestamps - Implement copyup functionality to promote files to upper layer when modified - Add extended attribute support for storing overlayfs-specific metadata - Add comprehensive tests for operations - Refactor stat operations to handle overlayfs permission overrides - Make inode data fields public within crate for testing * feat(overlayfs): implement unlink operation and add tests Implements the unlink operation for the overlayfs filesystem, allowing files to be deleted from any layer. Key changes include: - Add get_top_layer_idx helper method to get index of top layer - Implement do_unlink to handle file deletion and whiteout creation - Refactor do_forget to handle inode reference counting - Add dev_ino_and_name_to_vol_whiteout_path helper for whiteout files - Add comprehensive test suite for unlink functionality including: - Basic file deletion - Whiteout creation for lower layer files - Multi-layer scenarios - Error cases - Complex directory structures * feat(overlayfs): implement rmdir and fix lookup path handling - Add do_rmdir() implementation for directory removal across layers - Fix path_inodes handling in lookup_segment_by_segment - Add whiteout file creation for removed directories - Fix path handling in do_copyup to skip root inode - Add comprehensive test coverage for rmdir functionality * feat(overlayfs): implement symlink support for OverlayFs and add tests Implement symlink support for the OverlayFs filesystem and add comprehensive test coverage for OverlayFs. Key changes include: - Add do_symlink() implementation in OverlayFs - Add symlink tests covering basic functionality, nested directories, multiple layers, and error cases - Clean up error handling pattern in do_mkdir() * feat(overlayfs): implement rename operation and add tests This commit implements the rename operation for the overlayfs filesystem on macOS and adds extensive test coverage. Key changes include: - Implement `do_rename` method to handle file/directory renaming - Add helper method `create_whiteout_for_lower` to handle whiteout creation - Support LINUX_RENAME_WHITEOUT and LINUX_RENAME_EXCHANGE flags - Add comprehensive tests for rename functionality including: - Basic rename operations - Whiteout handling - Multi-layer scenarios - Complex directory structures - Error cases * feat(overlayfs): implement hard link support for overlayfs Adds support for creating hard links in the overlayfs filesystem implementation. Key changes include: - Implement do_link() method to handle hard link creation - Add comprehensive test suite for link functionality including: - Basic link creation - Links across multiple layers - Error handling - Nested directory scenarios - Whiteout handling * feat(overlayfs): Implement open/release and improve copy-up operations This commit adds several key improvements to the overlayfs implementation: - Implements open() and release() operations for files and directories - Adds CachePolicy enum to control FUSE caching behavior - Improves copy-up operation by: - Using clonefile() for COW semantics when available on macOS - Falling back to regular copy when clonefile fails - Extracting copy logic into separate helper method - Adds comprehensive tests for open/release and copy-up operations - Fixes init_handle value to start at 0 - Renames do_copyup to copy_up for consistency The changes improve performance by using COW semantics where possible and add proper file handle management. The new CachePolicy gives users control over how aggressively the FUSE client caches file data. * feat(overlayfs): Implement read functionality and add comprehensive tests Implement the read method for the OverlayFS filesystem, allowing files to be read from any layer in the overlay stack. The implementation handles: - Basic file reading with offset and size controls - Reading through copied-up files - Proper handling of whiteout files and opaque directories - Special handling for the init binary when not in EFI mode Add extensive test coverage including: - Basic read functionality - Reading with offsets - Partial reads - Reading through nested directories - Proper handling of whiteouts and opaque directories - Reading after copy-up operations - Error cases with invalid handles * feat(overlayfs): Implement write functionality and add tests Implements the write method for the overlayfs filesystem, allowing files to be written to and modified. The implementation includes: - Basic write functionality with offset support - Copy-up behavior when writing to files in lower layers - Proper handling of whiteouts and opaque directories - Support for partial writes and multiple write operations Also adds comprehensive test coverage for the write functionality, including: - Basic write operations - Writing with offsets - Partial writes - Copy-up behavior - Invalid handle handling - Multiple sequential writes - Writing to files in nested directories - Interaction with whiteouts and opaque directories Additionally: - Renames NotReallyZeroCopyWriter to TestContainer - Implements ZeroCopyReader for TestContainer to support write tests - Removes commented out test_open_root_directory * feat(overlayfs): implement flush, fsync and opendir operations for macos overlayfs Implement several filesystem operations for the macOS overlayfs: - Add flush operation that emulates fd close behavior using dup/close - Add fsync operation to synchronize file contents - Implement opendir by reusing existing do_open with O_DIRECTORY flag - Add comprehensive test suite for opendir functionality The tests cover: - Basic directory opening - Handling non-existent directories - Whiteout directory behavior - Copy-up scenarios - Multiple open/release cycles - Various open flags combinations * feat(overlayfs): Skip copy-up for read-only file operations Previously, the overlayfs implementation would copy files to the top layer even for read-only operations. This was unnecessary overhead since files only need to be in the top layer when they are being modified. This change optimizes the behavior by only performing copy-up when write access is requested. The implementation now checks the O_ACCMODE flags to determine if the file needs to be copied to the top layer. Added test cases to verify: - Opening files read-only keeps them in the bottom layer - Opening directories read-only keeps them in the bottom layer * feat(overlayfs): implement extended attributes support Add support for extended attributes (xattrs) in the overlayfs implementation: - Implement setxattr, getxattr, listxattr and removexattr operations - Add xattr configuration flag to enable/disable xattr support - Handle copy-up operations when setting xattrs on files in lower layers - Add comprehensive test coverage for xattr operations including: - Basic set/get/list/remove operations - Copy-up behavior for lower layer files - Error handling for invalid operations - Proper handling when xattr support is disabled * feat(virtio-fs): implement create, mknod and access ops for macOS overlayfs - Add create() operation to support creating new files with permissions - Add mknod() operation for special files (as regular files on macOS) - Add access() operation with Unix permission checking logic - Reorganize tests into separate modules The implementation handles file ownership, permissions, security contexts, and parent directory copy-up when needed. * feat(overlayfs): implement fs operations for macOS overlayfs Implements the following filesystem operations for macOS overlayfs: - fallocate: Preallocates space for files - lseek: Repositions file offset with special handling for SEEK_DATA/SEEK_HOLE - setupmapping: Sets up DAX memory mapping between guest and host - removemapping: Removes DAX memory mappings Also fixes comparison of libc function return values to check for < 0 instead of != 0 to properly handle errors.
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.
Add an overlay filesystem implementation that combines multiple layers into a single logical filesystem, following OCI image specification's layer filesystem changeset format. This implementation:
The implementation provides a foundation for container image support on macOS by allowing multiple filesystem layers to be combined into a single view.