[CRIU] [PATCH v2 4/8] save net device confs one by one

Pavel Emelyanov xemul at parallels.com
Fri Sep 26 14:07:12 PDT 2014


On 09/26/2014 03:39 PM, Pavel Tikhomirov wrote:
> 
> On 09/26/2014 09:54 AM, Pavel Emelyanov wrote:
>> On 09/25/2014 12:00 PM, Pavel Tikhomirov wrote:
>>
>>> +static int ipv4_conf_op(char *dir, int *conf, int op)
>>> +{
>>> +	int ret;
>>> +	int i;
>>> +
>>> +	for (i = 0; devconfs[i]; i++) {
>>> +		char path[PATH_MAX];
>>> +		struct sysctl_req req[2];
>>> +
>>> +		snprintf(path, sizeof(path), "%s/%s", dir, devconfs[i]);
>>> +
>>> +		req[0].name = path;
>>> +		req[0].arg = &conf[i];
>>> +		req[0].type = CTL_32;
>>> +		req[1].name = NULL;
>>> +
>>> +		ret = sysctl_op(req, op);
>> Sysctl-s can be read/written in batches. Look at ipc_sysctl_req().
> 
> If so, is it OK to have: char path[NET_DEV_CONF_SIZE][PATH_MAX]; for paths?

Why PATH_MAX? You know the lengths of your paths, don't you?

>>> +		if (ret < 0) {
>>> +			pr_err("Failed to read %s/%s\n", dir, devconfs[i]);
>>> +			return -1;
>>> +		}
>>> +	}
>>> +
>>> +	return 0;
>>> +}
>>> +
> 



More information about the CRIU mailing list