[CRIU] [PATCH 04/13] restore: add mount id-s in the ns_ids list (v3)

Pavel Emelyanov xemul at parallels.com
Wed Apr 9 04:57:14 PDT 2014


>  static unsigned int lookup_ns_id(unsigned int kid, struct ns_desc *nd)
>  {
>  	struct ns_id *nsid;
> @@ -128,6 +156,17 @@ static unsigned int lookup_ns_id(unsigned int kid, struct ns_desc *nd)
>  	return 0;
>  }
>  
> +struct ns_id *lookup_ns_by_id(unsigned int id)
> +{
> +	struct ns_id *nsid;
> +
> +	for (nsid = ns_ids; nsid != NULL; nsid = nsid->next)
> +		if (nsid->id == id)
> +			return nsid;
> +
> +	return NULL;
> +}
> +

Namespace should be looked-up using two values -- type AND ID. IDs are
unique now only due to simplicity of their generation.

>  static unsigned int generate_ns_id(int pid, unsigned int kid, struct ns_desc *nd)
>  {
>  	unsigned int id;


More information about the CRIU mailing list