For example,I want to store Pid to Name mapping in some data structure. So that, we can quickly check if some given pid is already stored or not. Can you suggest some data structure in linux kernel for that ?
There is map data structure in kernel, but it is not general purpose map. It maps identification number (UID) to a pointer. This is how you define it for example :
struct idr map;
idr_init(&map);
and then you use idr_get_new ( struct idr * idp,void * ptr,int * id);
function to insert new element into the map
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With