[CRIU] [PATCH 4/8] parasite: Add missing 'void' in function
declarations
Stanislav Kinsbursky
skinsbursky at parallels.com
Wed Feb 22 05:03:43 EST 2012
22.02.2012 13:35, Cyrill Gorcunov пишет:
> On Wed, Feb 22, 2012 at 01:32:19PM +0400, Stanislav Kinsbursky wrote:
>>
>> Ok. remove your SET_PARASITE_STATUS_SUCCESS then and make it even easier.
>> Let's there will be only one place, where SET_PARASITE_STATUS is
>> called - parasite_service().
>
> I think this is good idea! Mind to provide an example how it might
> look like? Some opencoded case, not diff. Then we could estimate
> the result.
>
> Cyrill
Something like below:
#define SET_PARASITE_STATUS(st, ret_code, sys_ret_code) \
do { \
(st)->ret = ret_code, \
(st)->sys_ret = sys_ret_code & -1, \
(st)->line = sys_ret_code >> 32; \
} while (0)
int handle_command_A(void *data, long *sys_ret_code);
{
int err;
err = some_action(data);
if (err)
*sys_ret_code = __LINE__ << 32 | err;
return -1;
}
return 0;
}
int parasite_service(...)
{
int ret;
int sys_ret_code;
switch (cmd) {
case A:
ret = handle_command_A(data, &sys_ret_code);
break;
case B:
...
default
...
ret = -1;
err = -1;
break;
}
SET_PARASITE_STATUS(st, ret, err);
return ret;
}
--
Best regards,
Stanislav Kinsbursky
More information about the CRIU
mailing list