Linux Test Project
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: Andrea Cervesato <andrea.cervesato@suse.de>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v2 1/8] Rewrite userns01.c using new LTP API
Date: Wed, 23 Mar 2022 11:17:41 +0100	[thread overview]
Message-ID: <YjrzxcAZeZKc7CDK@pevik> (raw)
In-Reply-To: <20220315122351.8556-2-andrea.cervesato@suse.de>

Hi Andrea,

Reviewed-by: Petr Vorel <pvorel@suse.cz>

nit: I'd sometimes use underscore to make names more readable
i.e. update_map, parent_map_pid, OVERFLOW_UID_PATH, OVERFLOW_GID_PATH

> +static inline int check_newuser(void)
> +{
> +	int pid, status;
> +
> +	if (tst_kvercmp(3, 8, 0) < 0)
> +		tst_brk(TCONF, "CLONE_NEWUSER not supported");
Is this limitation needed, when we have the same check with ltp_clone_quick()?
> +
> +	pid = ltp_clone_quick(CLONE_NEWUSER | SIGCHLD, dummy_child, NULL);
> +	if (pid == -1)
> +		tst_brk(TCONF | TTERRNO, "CLONE_NEWUSER not supported");
> +
> +	SAFE_WAIT(&status);
> +
> +	return 0;
> +}
> +
> +static inline void updatemap(int cpid, bool type, int idnum, int parentmappid)
> +{
> +	char path[BUFSIZ];
> +	char content[BUFSIZ];
> +	int fd;
> +
> +	if (type == UID_MAP)
> +		sprintf(path, "/proc/%d/uid_map", cpid);
> +	else if (type == GID_MAP)
> +		sprintf(path, "/proc/%d/gid_map", cpid);
> +	else
> +		tst_brk(TBROK, "invalid type parameter");

nit: maybe switch would be more readable.

...

Kind regards,
Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  parent reply	other threads:[~2022-03-23 10:17 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-15 12:23 [LTP] [PATCH v2 0/8] Rewrite userns testing suite using new LTP API Andrea Cervesato
2022-03-15 12:23 ` [LTP] [PATCH v2 1/8] Rewrite userns01.c " Andrea Cervesato
2022-03-15 13:29   ` [LTP] [PATCH v2 1/2] Remove libclone from userns test suite Andrea Cervesato
2022-03-15 13:30   ` [LTP] [PATCH v2 2/2] Remove obsolete userns_helper.h from userns Andrea Cervesato
2022-03-23 10:17   ` Petr Vorel [this message]
2022-03-24 20:31   ` [LTP] [PATCH v2 1/8] Rewrite userns01.c using new LTP API Petr Vorel
2022-03-24 20:50   ` Petr Vorel
2022-03-25  9:18     ` Andrea Cervesato via ltp
2022-03-25 10:06       ` Petr Vorel
2022-03-15 12:23 ` [LTP] [PATCH v2 2/8] Rewrite userns02.c " Andrea Cervesato
2022-03-24 19:46   ` Petr Vorel
2022-03-15 12:23 ` [LTP] [PATCH v2 3/8] Rewrite userns03.c " Andrea Cervesato
2022-03-24 20:40   ` Petr Vorel
2022-03-15 12:23 ` [LTP] [PATCH v2 4/8] Rewrite userns04.c " Andrea Cervesato
2022-03-24 20:55   ` Petr Vorel
2022-03-15 12:23 ` [LTP] [PATCH v2 5/8] Rewrite userns05.c " Andrea Cervesato
2022-03-24 21:08   ` Petr Vorel
2022-03-15 12:23 ` [LTP] [PATCH v2 6/8] Rewrite userns06.c " Andrea Cervesato
2022-03-25  7:08   ` Petr Vorel
2022-03-15 12:23 ` [LTP] [PATCH v2 7/8] Rewrite userns07.c " Andrea Cervesato
2022-03-25  7:11   ` Petr Vorel
2022-03-15 12:23 ` [LTP] [PATCH v2 8/8] Rewrite userns08.c " Andrea Cervesato
2022-03-23  9:36   ` Petr Vorel
2022-03-23  9:46     ` Andrea Cervesato via ltp
2022-03-23  9:58     ` Cyril Hrubis
2022-03-23 12:54       ` Petr Vorel
2022-03-23 15:41         ` Andrea Cervesato via ltp
2022-03-24 14:18           ` Petr Vorel
2022-03-25  7:18   ` Petr Vorel
2022-03-25  8:58     ` Andrea Cervesato via ltp

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YjrzxcAZeZKc7CDK@pevik \
    --to=pvorel@suse.cz \
    --cc=andrea.cervesato@suse.de \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox