Complete Bit-by-Bit Documentation:
- Every byte of MDB documented with exact offset (162 bytes total)
- All 16 bits of drAtrb explained individually with hex masks
- drNxtCNID: Reserved CNIDs 1-15 fully documented
- Volume name Pascal string format with byte examples
- Extent records complete structure (12 bytes, 3 descriptors)
Memory Layouts:
- Complete volume layout from byte 0 to end
- MDB field map with types and byte counts
- Node descriptor (14 bytes) for B-trees
- BTHeaderRec (106 bytes) complete structure
- Extent descriptor byte-by-byte breakdown
Critical Formulas:
- Alternate MDB: device_size - 1024 (NOT sector-based)
- Date conversion: Unix epoch offset (2082844800)
- Y2K28 limit calculation
- Volume size limits with 16-bit addressing
Endianness Details:
- Big-endian byte order for all multi-byte fields
- Examples of 16-bit and 32-bit value storage
- Code snippets showing correct/incorrect writing
- Hex dump verification commands
Oddities and Edge Cases:
- BD signature origin mystery
- Pascal vs C strings
- MacRoman character encoding differences
- Allocation block alignment requirements
- 16-bit addressing limitations (65,535 blocks max)
Verification:
- xxd commands for checking every critical field
- Expected hex output for validation
- Common errors and how to detect them
Goal: Complete reimplementation possible with only this document
Complete ASCII conversion:
- + in all test output and validation
- ! in all warnings
- All files verified for ASCII-only content
Files updated:
- Makefile (install messages)
- test/test_mkfs.sh (test output)
- test/test_fsck.sh (test output)
- test/test_hfsutils.sh (test output)
- test/lib/validation.sh (validation messages)
Benefits:
- Works on all BSD TTY systems
- Compatible with Linux text consoles
- No Unicode font requirements
- Portable across all POSIX systems
- Serial console compatible
- Minimal system requirements
- Update hfsutils_rcsid to match the new version 4.1.0A.1
- Ensure all version strings are consistent across the codebase
- Maintain historical CHANGELOG entries for 4.1.0A as requested
- Update version strings in src/common/version.c to 4.1.0A.1
- Update all documentation to reflect new version number
- Add comprehensive changelog entry for 4.1.0A.1 with all recent improvements
- Add macOS packaging examples in PACKAGING.md (Homebrew, MacPorts)
- Update compatibility information for BSD systems and macOS
- Document flexible installation system as major feature
Version 4.1.0A.1 represents a significant improvement over 4.1.0A with:
- Complete flexible installation system for all distributions
- Fixed hfsck installation paths
- Enhanced build system robustness
- Comprehensive packaging documentation
- Full compatibility with merged and traditional filesystem layouts
- Update hfsplus_format.h to use correct path for hfs_detect.h (../common/hfs_detect.h)
- Fix hformat.c to use correct paths for both headers
- Resolves compilation error: hfsplus_format.h no existe el fichero o directorio
This fixes the build error in src/hfsutil/hformat.c:38:11
- Move hfs_detect.h from include/hfsutil/ to include/common/
- Update all include references in source files
- Fix typo in hfsck/main.c include path (../nclude -> ../include)
- Remove duplicate hfs_detect.o rules in hfsck Makefiles
- Update documentation (CHANGELOG.md, TODO, README.md)
- Improve project organization and maintainability
Version: 4.1.0A - Extended implementation with better code organization
Major refinement implementing standard system exit codes and comprehensive documentation:
### Standard Exit Codes Implementation:
- **fsck.hfs+ Exit Codes** (Unix/Linux/BSD standard):
* 0: No errors found
* 1: Errors found and corrected
* 2: System should be rebooted
* 4: Errors found but not corrected
* 8: Operational error
* 16: Usage or syntax error
* 32: fsck canceled by user request
* 128: Shared library error
- **mkfs.hfs+ Exit Codes** (Unix/Linux/BSD standard):
* 0: Success
* 1: General error
* 2: Usage error
* 4: Operational error
* 8: System error
### Enhanced User Experience:
- **Comprehensive Usage Messages**: Detailed help with examples and exit codes
- **Standard Option Support**: Added -f, -y flags for fsck compatibility
- **Professional Error Handling**: Proper error categorization and reporting
- **Verbose Mode Enhancement**: Detailed progress reporting in fsck operations
### Code Documentation Improvements:
- **Function Documentation**: Comprehensive NAME/DESCRIPTION/PARAMETERS/RETURNS format
- **Inline Comments**: Detailed explanations of complex operations
- **Error Handling**: Clear documentation of error conditions and responses
- **Journal Operations**: Enhanced documentation of HFS+ journaling functions
### Testing Infrastructure:
- **test/test_exit_codes.sh**: Comprehensive exit code validation suite
- **Standard Compliance Testing**: Verification of Unix/Linux/BSD compatibility
- **Error Condition Testing**: Validation of proper error handling
### Professional Integration:
- **System Administrator Friendly**: Standard exit codes for scripting
- **Enterprise Ready**: Proper error reporting for automated systems
- **Unix Philosophy Compliance**: Tools that work well with other Unix utilities
- **Logging Integration**: Enhanced error logging with proper categorization
This brings hfsutils to professional Unix/Linux/BSD system administration
standards with proper exit codes, comprehensive documentation, and
enterprise-grade error handling.
- Fix setreuid/setregid unused result warnings in suid.c
- Remove duplicate Makefile rule in hfsck/Makefile
- Update TODO file with comprehensive project status
- Add version 4.0.1 entry to CHANGELOG.md
- Mark completed features and remaining tasks clearly
All major compilation warnings resolved. Project is now in excellent state.
Major implementation of HFS+ formatting capabilities:
HFS+ Formatting Implementation:
- Complete HFS+ volume header creation with proper signature (0x482B)
- HFS+ allocation file setup with bitmap block calculation
- HFS+ extents overflow file initialization
- HFS+ catalog file structure preparation
- HFS+ attributes file placeholder for future implementation
- Proper endianness handling for all multi-byte fields
- Block size optimization based on volume size
- Volume size calculation and validation
Standard Unix Filesystem Utilities:
- mkfs.hfs command for HFS formatting
- mkfs.hfs+ and mkfs.hfsplus commands for HFS+ formatting
- Integration with hfsutil unified binary architecture
- Program name detection for automatic filesystem type selection
- Consistent command-line interface with standard options
Enhanced hformat Command:
- Added -t option for explicit filesystem type selection
- Support for both hfs and hfs+ filesystem types
- Program name detection for mkfs.hfs, mkfs.hfs+, mkfs.hfsplus
- Verbose output showing volume creation progress
- Proper error handling and validation
Technical Implementation:
- hfsplus_format.h: Complete HFS+ structure definitions and function prototypes
- hfsplus_format.c: Full HFS+ formatting implementation
- Proper date handling with HFS epoch conversion
- Safe time handling for dates beyond HFS limit (Feb 6, 2040)
- Volume validation and force formatting options
- Cross-platform endianness support
Build System Integration:
- Added hfsplus_format.c to build process
- Updated Makefile with new object file
- Enhanced hfsutil command table with mkfs variants
- Proper include path handling for new headers
Testing and Validation:
- test_hfsplus_complete.sh: Comprehensive test suite
- Verification of HFS vs HFS+ volume creation
- Signature validation with hexdump verification
- Program name detection testing
- Backward compatibility verification
Volume Structure:
- Proper HFS+ volume header at offset 1024
- Allocation file starting at block 1
- Extents file following allocation file
- Catalog file with proper block allocation
- Backup volume header at end of volume
- Correct block size selection (512B to 4KB based on volume size)
This implementation provides a solid foundation for HFS+ support
while maintaining full backward compatibility with existing HFS
functionality. The framework is ready for future enhancements
including B-tree initialization, journal support, and Unicode
filename handling.