Skip to content
This repository has been archived by the owner on Apr 20, 2022. It is now read-only.

Significant difference between space manager blocks documented here vs. Apple docs #42

Open
hakanai opened this issue Sep 15, 2019 · 1 comment

Comments

@hakanai
Copy link
Contributor

hakanai commented Sep 15, 2019

This is a table of the differences between what's documented here and what Apple eventually released in the docs:

Current KSY Apple Docs
sm_o (obj_phys_t)
block_size (u4) sm_block_size (uint32_t)
blocks_per_chunk (u4) sm_blocks_per_chunk (uint32_t)
chunks_per_cib (u4) sm_chunks_per_cib (uint32_t)
cibs_per_cab (u4) sm_cibs_per_cab (uint32_t)
block_count (u4) sm_dev[0].sm_block_count (uint64_t)
chunk_count (u4)
cib_count (u4) sm_dev[0].sm_chunk_count (uint64_t)
cab_count (u4)
entry_count (u4) sm_dev[0].sm_cib_count (uint32_t)
unknown_68 (u4) sm_dev[0].sm_cab_count (uint32_t)
free_block_count (u8) sm_dev[0].sm_free_count (uint64_t)
entries_offset (u4) sm_dev[0].sm_addr_offset (uint32_t)
unknown_84 (92) sm_dev[0].sm_reserved (uint32_t)
sm_dev[0].sm_reserved2 (uint64_t)
sm_dev[1].sm_block_count (uint64_t)
sm_dev[1].sm_chunk_count (uint64_t)
sm_dev[1].sm_cib_count (uint32_t)
sm_dev[1].sm_cab_count (uint32_t)
sm_dev[1].sm_free_count (uint64_t)
sm_dev[1].sm_addr_offset (uint32_t)
sm_dev[1].sm_reserved (uint32_t)
sm_dev[1].sm_reserved2 (uint64_t)
sm_flags (uint32_t)
sm_ip_bm_tx_multiplier (uint32_t)
sm_ip_block_count (uint64_t)
sm_ip_bm_size_in_blocks (uint32_t)
sm_ip_bm_block_count (uint32_t)
sm_ip_bm_base (paddr_t)
prev_spaceman_internal_pool_block (u8) sm_ip_base (paddr_t)
sm_fs_reserve_block_count (uint64_t)
sm_fs_reserve_alloc_count (uint64_t)
sm_fq[SFQ_COUNT] (spaceman_free_queue_t)
sm_ip_bm_free_head (uint16_t)
sm_ip_bm_free_tail (uint16_t)
sm_ip_bm_xid_offset (uint32_t)
sm_ip_bitmap_offset (uint32_t)
sm_ip_bm_free_next_offset (uint32_t)
sm_version (uint32_t)
sm_struct_size (uint32_t)
sm_datazone (spaceman_datazone_info_phys_t)

I tried updating my own parsing code to match theirs, but some of my existing data didn't seem to parse using their documented structure. However, I noticed that there's a version field in the structure, and even in my own data set, I see many different values for that field. I haven't quite figured out whether we've screwed up writing the parsing code, or whether there really are multiple versions of the structure for different versions of APFS, or it could possibly even be a little of each.

@cugu
Copy link
Owner

cugu commented Sep 16, 2019

Thanks for the listing. The space manager was never really relevant to me and I did not spend time to incorporate the information Apple released so far...
I'm happy to merge any pull requests, though ;-)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants