[LTP] [PATCH] containers/share: added namespaces types argument for ns_exec

Cyril Hrubis chrubis@suse.cz
Tue Oct 6 14:08:42 CEST 2015


Hi!
> diff --git a/testcases/kernel/containers/share/ns_exec.c b/testcases/kernel/containers/share/ns_exec.c
> index e2f068c..f00b587 100644
> --- a/testcases/kernel/containers/share/ns_exec.c
> +++ b/testcases/kernel/containers/share/ns_exec.c
> @@ -40,6 +40,46 @@ char *TCID = "ns_exec";
>  int ns_fd[NS_TOTAL];
>  int ns_fds;
>  
> +struct param {
> +	const char *name;
> +};
> +
> +struct param params[] = {
> +	{"ipc"},
> +	{"mnt"},
> +	{"net"},
> +	{"pid"},
> +	{"user"},
> +	{"uts"},
> +	{NULL}
> +};
> +
> +
> +struct param *get_param(const char *name)
> +{
> +	int i;
> +
> +	for (i = 0; params[i].name; i++) {
> +		if (!strcasecmp(params[i].name, name))
> +			return params + i;
> +	}
> +
> +	return NULL;
> +}

I would consider sharing this part with ns_create.c. I.e. pulling the
struct param and get_param() function from ns_create.c to some common.h
header and including it in both places so that we don't have to manage
the list of namespaces in two places.

Apart from that the the patch looks good, acked.

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the Ltp mailing list