On 05/11/2013 05:07 AM, Igor M Podlesny wrote:
> On 30 April 2013 11:46, Glauber Costa <glom...@openvz.org> wrote:
>> Currently, vps_setup_res() have an explicit test for state != VPS_STARTING
>> before applying beancounter limits. This means that we can set limits without
>> further problems when the container is running, but will fail to do so when 
>> the
>> container is starting. In fact, hooks_vz have an explicit call for it in its
>> startup function.
>>
>> We should do the same, and call our version of setlimits ourselves when the
>> container is coming up.
>>
>> Signed-off-by: Glauber Costa <glom...@openvz.org>
>> ---
>>  src/lib/hooks_ct.c | 147 
>> +++++++++++++++++++++++++++--------------------------
>>  1 file changed, 76 insertions(+), 71 deletions(-)
>>
>> diff --git a/src/lib/hooks_ct.c b/src/lib/hooks_ct.c
>> index 63af536..3cfb6e9 100644
>> --- a/src/lib/hooks_ct.c
>> +++ b/src/lib/hooks_ct.c
>> @@ -153,6 +153,77 @@ static int _env_create(void *data)
>>         return exec_container_init(arg, &create_param);
>>  }
>>
>> +#define add_value(val, var, mult) do { if (val) { var = *val * mult; } } 
>> while (0)
> 
>    Aren't macroses supposed to be UPPER CASE named?
> 
Yes, and for a reason: macros behave very differently than functions,
and a convention to allow us to spot them and identify them as macros
very easily is beneficial.

This particular macro is defined right before the function, and
undefined right after it, so it should be extremely clear to every
reader that this is a macro. In this case, I don't see a reason for
being so strict.

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to