mirror of
https://github.com/JotaRandom/hfsutils.git
synced 2026-01-16 17:17:30 +00:00
## Specification Conformance Fixes ### Alternate Header Location (Critical Bug Fix) - Fixed alternate MDB/VH location for both HFS and HFS+ - Changed from (total_sectors - 1) * sector_size to device_size - 1024 - Conforms to Apple TN1150: '1024 bytes before the end of the volume' - Files: src/mkfs/mkfs_hfs_format.c ### HFS+ Volume Header Field Alignment - Added missing rsrcClumpSize field (offset +56, 4 bytes) - Added missing dataClumpSize field (offset +60, 4 bytes) - Fixed nextCatalogID placement (now correctly at offset +64) - Set nextCatalogID initial value to 16 (kHFSFirstUserCatalogNodeID) - Files: src/mkfs/mkfs_hfs_format.c ### HFS+ Volume Attributes - Set kHFSVolumeUnmountedBit (0x0100) in attributes field - Changed from 0x00000000 to 0x00000100 per TN1150 spec - Files: src/mkfs/mkfs_hfs_format.c ## Documentation ### New Technical Documentation (./doc/) - TN1150_HFS_PLUS_VOLUME_FORMAT.md: Apple official HFS+ spec - HFS_CLASSIC_SPECIFICATION.md: Complete HFS Classic spec - WIKIPEDIA_HFS_PLUS.md: Wikipedia HFS+ reference - HFS_IMPLEMENTATION_NOTES.md: Practical implementation guide - DEVELOPMENT_HISTORY.md: Project evolution and lessons learned - README.md: Documentation index with quick reference Total: 6 technical documents, 65.9 KB offline reference ## Project Reorganization ### Consolidated Documentation - Removed 9 scattered summary .md files from root - Consolidated into doc/DEVELOPMENT_HISTORY.md - Files removed: BUILD_SYSTEM_SUMMARY.md, DEPENDENCY_RESOLUTION_SUMMARY.md, EMBEDDED_REORGANIZATION_SUMMARY.md, HFS_PLUS_IMPLEMENTATION_SUMMARY.md, TASK_3.4_COMPLETION_SUMMARY.md, MKFS_TEST_RESULTS.md, CORRECCION.md, ENTREGABLES.md, RESUMEN_FINAL.md ### Organized Test Scripts - Moved 7 test scripts from root to test/ - Scripts: test_fsck_enhanced.sh, test_hcopy_manual*.sh, test_hfs_integrity.sh, test_hfs_spec_validation.sh, test_recursive_integrity.sh, test_spec_conformance.sh ### Updated .gitignore - Added temporary log files (build_output.log, test_output.txt, etc.) - Added generated configuration files (Makefiles, config.h, os.c) - Added IDE directories (.vs/) - Added consolidated documentation patterns (*_SUMMARY.md) ## Updated Files - README.md: Links to new documentation, updated limitations - TODO: Current status (November 2025), recent achievements - PROJECT_STRUCTURE.md: Updated directory structure documentation - test/README.md: Updated test organization ## Impact - Specification-compliant HFS/HFS+ volume creation - Clean, navigable project structure (24 root files vs ~40) - Comprehensive offline technical documentation - All tests organized in test/ directory Resolves: Specification conformance issues Related: Apple TN1150, HFS/HFS+ standards compliance
11 KiB
11 KiB
Project Structure
This document describes the organization of the hfsutils project, including source code, documentation, tests, and build artifacts.
Directory Structure
hfsutils/
├── .github/ # GitHub configuration and workflows
├── build/ # Build artifacts (generated)
│ ├── obj/ # Object files
│ └── standalone/ # Standalone binaries (mkfs.hfs, fsck.hfs+, etc.)
├── config/ # Build configuration files
├── doc/ # Technical documentation
│ ├── TN1150_HFS_PLUS_VOLUME_FORMAT.md # Apple HFS+ specification
│ ├── HFS_CLASSIC_SPECIFICATION.md # HFS Classic specification
│ ├── WIKIPEDIA_HFS_PLUS.md # Wikipedia HFS+ reference
│ ├── HFS_IMPLEMENTATION_NOTES.md # Implementation guide
│ ├── DEVELOPMENT_HISTORY.md # Project evolution
│ ├── README.md # Documentation index
│ ├── man/ # Manual pages
│ │ ├── man1/ # User command man pages
│ │ └── man8/ # System admin man pages
│ └── *.txt # Legacy documentation files
├── hfsck/ # HFS/HFS+ filesystem checker
│ ├── ck_*.c # Check modules (btree, mdb, volume)
│ ├── hfsck.c # Main checker
│ ├── journal.c # Journal handling
│ └── util.c # Checker utilities
├── include/ # Public header files
│ ├── common/ # Common utilities headers
│ ├── hfsutil/ # hfsutil headers
│ └── config.h # Build configuration
├── libhfs/ # Core HFS library
│ ├── *.c, *.h # HFS implementation
│ └── os/ # OS-specific code
├── librsrc/ # Resource fork library
│ ├── *.c, *.h # Resource handling
├── linux/ # Linux-specific utilities
├── scripts/ # Build and utility scripts
├── src/ # Source code
│ ├── binhex/ # BinHex encoding/decoding
│ ├── common/ # Common utilities and version info
│ ├── embedded/ # Embedded minimal libhfs for standalone tools
│ ├── fsck/ # Standalone fsck utilities
│ ├── hfsutil/ # Main hfsutil command utilities
│ ├── mkfs/ # Standalone mkfs utilities
│ ├── mount/ # Mount/unmount utilities
│ └── tests/ # Unit tests
├── test/ # Integration tests and test data
│ ├── data/ # Test data files
│ ├── temp/ # Temporary test files
│ ├── run_tests.sh # Main test runner
│ ├── test_*.sh # Individual test scripts
│ └── generate_test_data.sh # Test data generator
├── tests/ # Additional test suite
├── BUILD.md # Build system documentation
├── build.sh # Quick build script
├── build.standalone.sh # Standalone utilities build
├── CHANGELOG.md # Version history
├── clean.sh # Cleanup script
├── configure # Main configure script
├── configure.standalone # Standalone configure
├── COPYRIGHT # License information
├── CREDITS # Contributors
├── Makefile # Main makefile
├── Makefile.standalone # Standalone makefile
├── PACKAGING.md # Distribution packaging guide
├── PROJECT_STRUCTURE.md # This file
├── README.md # Main project documentation
└── TODO # Development tasks
Key Directories Explained
Source Code (src/)
Organized by component:
binhex/- BinHex encoding/decoding for Macintosh filescommon/- Shared utilities (version info, error handling, common functions)embedded/- Minimal libhfs subset for standalone tools (reduces dependencies)fsck/- Standalone filesystem checker utilities (fsck.hfs, fsck.hfs+)hfsutil/- Main hfsutil command and traditional utilities (hls, hcopy, hmount, etc.)mkfs/- Standalone filesystem creation utilities (mkfs.hfs, mkfs.hfs+)mount/- Mount/unmount utilities (mount.hfs, umount.hfs)tests/- Unit tests for individual components
Documentation (doc/)
Complete offline reference:
- Specifications: Apple TN1150, HFS Classic spec, Wikipedia references
- Implementation: Practical guide with code examples and validation
- History: Project evolution, lessons learned, development timeline
- Man Pages: User and system administrator documentation
Tests (test/ and tests/)
Comprehensive test coverage:
test/- Integration tests, test data, and main test runnertests/- Additional test suite- Test scripts: Specification conformance, integrity checks, cross-compatibility
Libraries
Core HFS implementation:
libhfs/- Full-featured HFS library (for hfsutil)librsrc/- Resource fork handlingsrc/embedded/- Minimal subset for standalone tools
Build System
Multiple build options:
Makefile- Main build system (full hfsutils)Makefile.standalone- Standalone utilities onlybuild.sh- Quick one-step buildconfigure- Auto-configuration for librariesconfig/- Build configuration templates
Build Targets
Main Targets
makeormake all- Build hfsutil executable and librariesmake install- Install binaries, libraries, and man pagesmake install-symlinks- Install with traditional command namesmake clean- Remove build artifactsmake distclean- Complete cleanup including configurationmake test- Run test suitemake help- Show all available targets
Standalone Utilities
make standalone- Build all standalone utilities (mkfs, fsck, etc.)make build/standalone/mkfs.hfs- Build HFS mkfsmake build/standalone/mkfs.hfs+- Build HFS+ mkfsmake build/standalone/fsck.hfs+- Build HFS+ fsckmake hfsck/hfsck- Build filesystem checker
Utility Targets
make symlinks- Create command symlinks for testingmake clean-symlinks- Remove symlinks
Installation Paths
Default installation (PREFIX=/usr/local):
/usr/local/
├── bin/
│ ├── hfsutil # Main unified binary
│ ├── hls # Symlink to hfsutil (optional)
│ ├── hcopy # Symlink to hfsutil (optional)
│ └── ... # Other command symlinks
├── sbin/
│ ├── hfsck # Filesystem checker
│ ├── mkfs.hfs # HFS formatter
│ ├── mkfs.hfs+ # HFS+ formatter
│ ├── fsck.hfs+ # HFS+ checker
│ └── ... # Symlinks (mkfs.hfsplus, fsck.hfsplus)
├── lib/
│ ├── libhfs.a # HFS library
│ └── librsrc.a # Resource fork library
├── include/
│ ├── hfs.h # HFS library header
│ └── rsrc.h # Resource library header
└── share/man/
├── man1/ # User commands
└── man8/ # System commands
Merged /bin systems (Arch, Fedora 17+, Debian 8+):
make install PREFIX=/usr SBINDIR=/usr/bin
File Organization
Root Directory Files
Build System:
Makefile,Makefile.standalone- Build definitionsbuild.sh,build.standalone.sh- Build scriptsclean.sh- Cleanup scriptconfigure,configure.standalone- Configuration scriptsconfig.mk,config.h.in- Generated configuration
Documentation:
README.md- Main project documentationBUILD.md- Build system guideCHANGELOG.md- Version historyPACKAGING.md- Distribution packagingPROJECT_STRUCTURE.md- This fileCOPYRIGHT- License (GPL v2)CREDITS- ContributorsINSTALL- Installation guideTODO- Development tasks
Generated Files (not in git)
Build artifacts:
build/obj/- Object filesbuild/standalone/- Standalone binariesconfig.mk- Generated configuration*.o- Object files in source directories
Test artifacts:
test/temp/- Temporary test filestest/data/- Generated test data*.img,*.hfs,*.hfsplus- Test disk images
Development Workflow
Adding New Features
- Update source code in appropriate
src/subdirectory - Add tests in
test/directory - Update documentation:
- User-facing: Update
README.md - Technical: Add to
doc/HFS_IMPLEMENTATION_NOTES.md - Build changes: Update
BUILD.md
- User-facing: Update
- Update CHANGELOG.md with changes
- Test: Run
make testand validate changes
Documentation Updates
- Specifications:
doc/TN1150_HFS_PLUS_VOLUME_FORMAT.md,doc/HFS_CLASSIC_SPECIFICATION.md - Implementation:
doc/HFS_IMPLEMENTATION_NOTES.md - History:
doc/DEVELOPMENT_HISTORY.md - Quick reference:
doc/README.md
Testing
# Run all tests
cd test && ./run_tests.sh
# Run specific test category
./run_tests.sh basic
./run_tests.sh hfsplus
# Run individual test
bash test_hfs_spec_validation.sh
Clean Directory Structure
Eliminated scattered files:
- ❌ Removed: 9 summary .md files from root (consolidated in
doc/DEVELOPMENT_HISTORY.md) - ❌ Removed: 7 test scripts from root (moved to
test/) - ❌ Removed: Temporary log files (test_output.txt, build_output.log, etc.)
- ✅ Organized: All documentation in
doc/ - ✅ Organized: All tests in
test/ - ✅ Organized: All source code in
src/
Result: Clean, navigable root directory with clear organization.
- ✅ Added documentation for each component
Next Steps
The project structure is now ready for:
- Task 2: Extract and prepare libhfs subset for embedding
- Task 3: Implement mkfs.hfs standalone utility
- Task 4: Implement fsck.hfs standalone utility
- Task 5: Implement mount.hfs standalone utility
Testing
The build system can be tested in a Linux/WSL environment with:
make standalone # Build all standalone utilities
make install-linux # Test Linux installation
make install-other # Test other systems installation
make install-complete # Test complete installation