On Wed, Apr 08, 2020 at 09:36:58AM +0530, Abhishek Kumar wrote: > c8e424c introduced hashmap_free_entries, which can free any struct > pointer, regardless of the hashmap_entry field offset. > > oidmap does not make use of this flexibilty, hardcoding the offset to > zero instead. Let's fix this by passing struct type and member to > hashmap_free_entries. I'm not sure how much this improves anything. We're now telling the hashmap code how to get to our "struct oidmap_entry" pointer by using the correct offset there. But we know that offset will always be 0, because we put our internal hashmap entry at the start of oidmap_entry. What you can't do is: struct foo { int first_member; struct oidmap_entry not_the_first_member; }; and work directly with "struct foo" pointers. You have to convert oidmap_entry pointers into foo pointers with container_of() or similar. And that is true both before and after your patch. That said, I don't mind doing this as a cleanup; there's a subtle dependency on the location of internal_entry within object_entry, and this would move towards getting rid of it. -Peff