On 12/2/25 00:26, Konstantin Khorenko wrote:
> On 11/24/25 12:20, Pavel Tikhomirov wrote:
>> This will allow us to take local reference to ve more easily wihout the
>> need to put it on error paths, as cleanup attribute will automatically
>> handle put when scope of variable ends.
>>
>> https://virtuozzo.atlassian.net/browse/VSTOR-118289
>> Signed-off-by: Pavel Tikhomirov <[email protected]>
>>
>> Feature: ve: ve generic structures
>> ---
>> include/linux/ve.h | 2 ++
>> 1 file changed, 2 insertions(+)
>>
>> diff --git a/include/linux/ve.h b/include/linux/ve.h
>> index 24d06ed21e749..63b80068e2fb5 100644
>> --- a/include/linux/ve.h
>> +++ b/include/linux/ve.h
>> @@ -302,4 +302,6 @@ static inline int ve_get_cpu_avenrun(struct ve_struct
>> *ve, unsigned long *avenru
>> static inline int ve_get_cpu_stat(struct ve_struct *ve, struct
>> kernel_cpustat *kstat) { return -ENOSYS; }
>> #endif
>> +DEFINE_FREE(put_ve, struct ve_struct *, put_ve(_T))
>
> according to ./include/linux/cleanup.h better define with NULL check?
>
> DEFINE_FREE(put_ve, struct ve_struct *, if (_T) put_ve(_T))
That is for the cases where helper does not already have NULL check, but put_ve
has it:
void put_ve(struct ve_struct *ve)
{
if (ve)
css_put(&ve->css);
}
>
>> +
>> #endif /* _LINUX_VE_H */
>
--
Best regards, Pavel Tikhomirov
Senior Software Developer, Virtuozzo.
_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel