public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] safe_macros: make safe_pread() and safe_pwrite() inline
Date: Mon, 28 Nov 2016 16:45:25 +0100	[thread overview]
Message-ID: <20161128154525.GA24540@rei.lan> (raw)
In-Reply-To: <1480149001-4844-1-git-send-email-nyushchenko@dev.rtsoft.ru>

Hi!
> diff --git a/include/old/safe_macros.h b/include/old/safe_macros.h
> index 8ed2eb4..e3be1f2 100644
> --- a/include/old/safe_macros.h
> +++ b/include/old/safe_macros.h
> @@ -70,6 +70,26 @@
>  	safe_read(__FILE__, __LINE__, cleanup_fn, (len_strict), (fildes), \
>  	    (buf), (nbyte))
>  
> +/*
> + * inline function that uses off_t since sizeof(off_t) depends on compile flags
> + */
> +static inline ssize_t safe_pread(const char *file, const int lineno,
> +		void (*cleanup_fn)(void), char len_strict,
> +		int fildes, void *buf, size_t nbyte, off_t offset)
> +{
> +	ssize_t rval;
> +
> +	rval = pread(fildes, buf, nbyte, offset);
> +
> +	if (rval == -1 || (len_strict && (size_t)rval != nbyte)) {
> +		tst_brkm(TBROK | TERRNO, cleanup_fn,
> +			 "%s:%d: pread(%d,%p,%zu,%lld) failed, returned %zd",
> +			 file, lineno, fildes, buf, nbyte, (long long)offset,
> +			 rval);
> +	}
> +
> +	return rval;
> +}
>  #define SAFE_PREAD(cleanup_fn, len_strict, fildes, buf, nbyte, offset)   \
>  	safe_pread(__FILE__, __LINE__, cleanup_fn, (len_strict), (fildes), \
>  	    (buf), (nbyte), (offset))
> @@ -112,6 +132,25 @@
>  	safe_write(__FILE__, __LINE__, cleanup_fn, (len_strict), (fildes), \
>  	    (buf), (nbyte))
>  

I've removed this part (SAFE_PREAD in old library headers), since the
old library is deprecated and there are more users for this function.

Pushed, thanks.

-- 
Cyril Hrubis
chrubis@suse.cz

      reply	other threads:[~2016-11-28 15:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-02 15:58 [LTP] reason of pwritev01_64 failure on 32-bit arm Nikita Yushchenko
2016-09-05 10:54 ` Jan Stancek
2016-09-27 11:58   ` [LTP] [PATCH] safe_macros: make safe_pread() and safe_pwrite() inline Nikita Yushchenko
2016-09-27 12:56     ` Cyril Hrubis
2016-11-26  8:30       ` Nikita Yushchenko
2016-11-28 15:45         ` Cyril Hrubis [this message]

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=20161128154525.GA24540@rei.lan \
    --to=chrubis@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