public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v2 2/2] Reimplement TST_SAFE_TIMERFD_*() using TST_ASSERT_SYSCALL*()
Date: Thu, 5 Mar 2020 18:50:31 +0100	[thread overview]
Message-ID: <20200305175031.GB29517@dell5510> (raw)
In-Reply-To: <20200305151459.30341-2-mdoucha@suse.cz>

Hi Martin,

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

> -	fd = timerfd_create(clockid, flags);
> -	if (fd < 0) {
> -		tst_brk(TTYPE | TERRNO, "%s:%d timerfd_create(%s) failed",
> -			file, lineno, tst_clock_name(clockid));
> -	}
> -
> -	return fd;
> +	return TST_ASSERT_SYSCALL_FD_IMPL(timerfd_create(clockid, flags), file,
> +		lineno, "timerfd_create(%s)", tst_clock_name(clockid));
>  }

>  int safe_timerfd_gettime(const char *file, const int lineno,
>  				int fd, struct itimerspec *curr_value)
>  {
> -	int rval;
> -
> -	rval = timerfd_gettime(fd, curr_value);
> -	if (rval != 0) {
> -		tst_brk(TTYPE | TERRNO, "%s:%d timerfd_gettime() failed",
> -			file, lineno);
> -	}
> -
> -	return rval;
> +	return TST_ASSERT_SYSCALL_IMPL(timerfd_gettime(fd, curr_value), file,
> +		lineno, "timerfd_gettime()");
>  }

I like sprintf formatting (it's needed), but it'd be nice to have a way to avoid
it, when it's just foo() (using SCALL_FUN and SCALL_PARAMS).
But that's probably too much optimization, resulting in unreadable macros.

Kind regards,
Petr

  parent reply	other threads:[~2020-03-05 17:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-05 15:14 [LTP] [PATCH v2 1/2] Add TST_ASSERT_SYSCALL*() macros Martin Doucha
2020-03-05 15:14 ` [LTP] [PATCH v2 2/2] Reimplement TST_SAFE_TIMERFD_*() using TST_ASSERT_SYSCALL*() Martin Doucha
2020-03-05 15:20   ` Cyril Hrubis
2020-03-05 17:50   ` Petr Vorel [this message]
2020-03-05 17:42 ` [LTP] [PATCH v2 1/2] Add TST_ASSERT_SYSCALL*() macros Petr Vorel
2020-03-05 17:53   ` Cyril Hrubis
2020-03-05 19:36     ` Petr Vorel

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=20200305175031.GB29517@dell5510 \
    --to=pvorel@suse.cz \
    --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