rust-osdev / linked-list-allocator

Apache License 2.0
219 stars 53 forks source link

Made hole module public for external uses. #47

Closed MarcoCicognani closed 3 years ago

MarcoCicognani commented 3 years ago

Hi Phil!

I've made hole.rs public for external uses and moved align_layout() function into HoleList.

Heap still contains the size and the used counters, so it is still Heap that uses align_layout. Tell me if this is not the best solution

phil-opp commented 3 years ago

Thanks!

Heap still contains the size and the used counters, so it is still Heap that uses align_layout. Tell me if this is not the best solution

I would prefer to move the align_layout calls to HoleList::allocate_first_fit and HoleList::deallocate. Maybe we could use a &mut Layout reference as argument, which is then adjusted. Alternatively, we could also return the adjusted Layout as a second return type. What do you think?

MarcoCicognani commented 3 years ago

I think that is a good idea. I implement it immediately

MarcoCicognani commented 3 years ago

But size and used must remain into Heap, right?

phil-opp commented 3 years ago

Yes, I would keep them in Heap, to keep the HoleList as simple as possible.

MarcoCicognani commented 3 years ago

Well, done!

MarcoCicognani commented 3 years ago

Done

phil-opp commented 3 years ago

Published as v0.8.10