[CRIU] [PATCH] rpc: add constants for cgroups modes
Kuprieiev Ruslan
rkuprieiev at cloudlinux.com
Thu Aug 6 05:56:58 PDT 2015
On 08/06/2015 03:52 PM, Pavel Emelyanov wrote:
>> + switch (req->manage_cgroups_mode) {
>> >+ case CRIU_CG_MODE__IGNORE:
>> >+ mode = CG_MODE_IGNORE;
>> >+ break;
>> >+ case CRIU_CG_MODE__NONE:
>> >+ mode = CG_MODE_NONE;
>> >+ break;
>> >+ case CRIU_CG_MODE__PROPS:
>> >+ mode = CG_MODE_PROPS;
>> >+ break;
>> >+ case CRIU_CG_MODE__SOFT:
>> >+ mode = CG_MODE_SOFT;
>> >+ break;
>> >+ case CRIU_CG_MODE__FULL:
>> >+ mode = CG_MODE_FULL;
>> >+ break;
>> >+ case CRIU_CG_MODE__STRICT:
>> >+ mode = CG_MODE_STRICT;
>> >+ break;
>> >+ case CRIU_CG_MODE__DEFAULT:
>> >+ mode = CG_MODE_DEFAULT;
>> >+ break;
>> >+ default:
>> >+ goto err;
>> >+ }
> Can we do it like
>
> if (req->manage_cgroups_mode < MAX_MODE)
> mode = (int)req->manage_cgroups_mode;
>
> and put necessary amount of BUILD_BUG_ON()-s nearby?
>
No, we can't, as CG_MODE_$MODE doesn't match CRIU_CG_MODE__$MODE.
CG_MODE_ * are defined as (1u << $n), and CRIU_CG_MODE__* are enums.
More information about the CRIU
mailing list