mirror of
https://github.com/JotaRandom/hfsutils.git
synced 2026-01-26 22:16:06 +00:00
- Add comprehensive manual pages for filesystem utilities: * mkfs.hfs.8 - HFS filesystem creation * mkfs.hfs+.8 - HFS+ filesystem creation * fsck.hfs.8 - HFS filesystem checking * fsck.hfs+.8 - HFS+ filesystem checking * Symlinks for .hfsplus variants - Update Makefile to install section 8 manual pages - Remove '(Apple Silicon fork)' from version strings - Update .gitignore for filesystem utility symlinks - Enhance CI workflow with installation testing - Add comprehensive GitHub Copilot instructions All manual pages include proper examples, options, and cross-references. Installation now includes both man1 and man8 sections correctly.
3.9 KiB
3.9 KiB
GitHub Copilot Instructions for hfsutils
Project Overview
hfsutils is a modern collection of tools for manipulating Hierarchical File System (HFS and HFS+) volumes. This is a modernized version of the original hfsutils by Robert Leslie, with additional HFS+ support and Unix standard filesystem utilities.
Key Components
Core Binaries
hfsutil- Main unified binary containing all HFS utilitieshfsck/hfsck- HFS/HFS+ filesystem checker
Filesystem Utilities (Unix Standard)
mkfs.hfs- Create HFS filesystemsmkfs.hfs+- Create HFS+ filesystemsmkfs.hfsplus- Alias for mkfs.hfs+fsck.hfs- Check/repair HFS filesystemsfsck.hfs+- Check/repair HFS+ filesystemsfsck.hfsplus- Alias for fsck.hfs+
Traditional HFS Utilities (symlinks to hfsutil)
hattrib,hcd,hcopy,hdel,hdir,hformat,hls,hmkdir,hmount,hpwd,hrename,hrmdir,humount,hvol
Build System
Build Commands
./build.sh # Respects CC, CFLAGS, PREFIX variables
make # Build all components
make symlinks # Create filesystem utility symlinks
make clean # Clean all build artifacts and symlinks
make install # Install to PREFIX (default: /usr/local)
make install-symlinks # Install with traditional command symlinks
Key Directories
src/- Source code for hfsutil and common utilitieshfsck/- HFS/HFS+ filesystem checkerlibhfs/- Core HFS librarylibrsrc/- Resource fork librarydoc/man/- Manual pages (sections 1 and 8)test/- Test suite
Code Style Guidelines
C Code
- Use consistent indentation (2 spaces)
- Follow existing naming conventions
- Include proper error handling
- Add comments for complex logic
- Use
constwhere appropriate
Build System
- Support standard variables: CC, CXX, CFLAGS, CXXFLAGS, LDFLAGS, PREFIX
- Use proper dependency tracking
- Include clean targets
- Support DESTDIR for staged installations
Documentation
- Update manual pages for new features
- Include examples in man pages
- Keep README.md current
- Document build requirements
HFS+ Implementation Notes
Key Features
- Full HFS+ volume creation with proper structures
- Volume header and allocation bitmap setup
- Catalog and extents B-tree initialization
- Unicode filename support
- Large volume support (up to 8 exabytes)
Filesystem Detection
- Automatic HFS vs HFS+ detection
- Proper signature validation
- Fallback mechanisms for edge cases
Testing
Test Structure
test/run_tests.sh- Main test runnertest/test_*.sh- Individual test suites- Comprehensive HFS+ formatting and validation tests
- Build system validation
Manual Testing
# Test filesystem utilities
./mkfs.hfs+ --version
./fsck.hfs+ --version
# Test HFS+ creation
dd if=/dev/zero of=test.img bs=1M count=10
./mkfs.hfs+ -l "Test Volume" test.img
./fsck.hfs+ test.img
Common Patterns
Version Information
All utilities support --version and --license flags with consistent output format.
Error Handling
Use proper exit codes and descriptive error messages. Follow Unix conventions.
Symlink Management
Symlinks are generated by build system, not tracked in git. Use make symlinks to create them.
Maintenance Notes
Adding New Features
- Update source code with proper error handling
- Add/update manual pages
- Update test suite
- Update build system if needed
- Test installation process
Release Process
- Update version in
src/common/version.c - Update CHANGELOG.md
- Run full test suite
- Test installation process
- Create git tag
Dependencies
- Standard C compiler (gcc/clang)
- make
- perl (for some build scripts)
- Standard Unix utilities
Compatibility
- Linux (primary target)
- BSD variants
- macOS
- Other Unix-like systems
Focus on maintaining compatibility while adding modern features and following Unix standards.