> From: Liu, Yi L <yi.l....@intel.com>
> Sent: Thursday, September 12, 2024 9:17 PM
> 
> There is no helpers for user to check if a given ID is allocated or not,
> neither a helper to loop all the allocated IDs in an IDA and do something
> for cleanup. With the two needs, a helper to get the lowest allocated ID
> of a range and two variants based on it.
> 
> Caller can check if a given ID is allocated or not by:
> 
>       bool ida_exists(struct ida *ida, unsigned int id)
> 
> Caller can iterate all allocated IDs by:
> 
>       int id;
>       while ((id = ida_find_first(&pasid_ida)) > 0) {
>               //anything to do with the allocated ID
>               ida_free(pasid_ida, pasid);
>       }
> 
> Cc: Matthew Wilcox (Oracle) <wi...@infradead.org>
> Suggested-by: Jason Gunthorpe <j...@nvidia.com>
> Signed-off-by: Yi Liu <yi.l....@intel.com>

Reviewed-by: Kevin Tian <kevin.t...@intel.com>

Reply via email to