public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Jan Stancek <jstancek@redhat.com>
To: Matus Marhefka <mmarhefk@redhat.com>
Cc: ltp-list@lists.sourceforge.net
Subject: Re: [LTP] [PATCH 1/3] lib: Add SAFE_MOUNT()
Date: Mon, 25 Aug 2014 06:11:15 -0400 (EDT)	[thread overview]
Message-ID: <451887524.12237225.1408961475409.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <1408099965-15748-1-git-send-email-mmarhefk@redhat.com>





----- Original Message -----
> From: "Matus Marhefka" <mmarhefk@redhat.com>
> To: ltp-list@lists.sourceforge.net
> Sent: Friday, 15 August, 2014 12:52:43 PM
> Subject: [LTP] [PATCH 1/3] lib: Add SAFE_MOUNT()
> 
> Signed-off-by: Matus Marhefka <mmarhefk@redhat.com>
> ---
>  include/safe_macros.h |  9 +++++++++
>  lib/safe_macros.c     | 19 +++++++++++++++++++
>  2 files changed, 28 insertions(+)
> 
> diff --git a/include/safe_macros.h b/include/safe_macros.h
> index a79c4ad..e1c2fd1 100644
> --- a/include/safe_macros.h
> +++ b/include/safe_macros.h
> @@ -271,5 +271,14 @@ int safe_rename(const char *file, const int lineno, void
> (*cleanup_fn)(void),
>  #define SAFE_RENAME(cleanup_fn, oldpath, newpath) \
>  	safe_rename(__FILE__, __LINE__, (cleanup_fn), (oldpath), (newpath))
>  
> +int safe_mount(const char *file, const int lineno, void (*cleanup_fn)(void),
> +	       const char *source, const char *target,
> +	       const char *filesystemtype, unsigned long mountflags,
> +	       const void *data);
> +#define SAFE_MOUNT(cleanup_fn, source, target, filesystemtype, \
> +		   mountflags, data) \
> +	safe_mount(__FILE__, __LINE__, (cleanup_fn), (source), (target), \
> +		   (filesystemtype), (mountflags), (data))
> +
>  #endif /* __SAFE_MACROS_H__ */
>  #endif /* __TEST_H__ */
> diff --git a/lib/safe_macros.c b/lib/safe_macros.c
> index eefacae..7e49b36 100644
> --- a/lib/safe_macros.c
> +++ b/lib/safe_macros.c
> @@ -784,3 +784,22 @@ int safe_rename(const char *file, const int lineno, void
> (*cleanup_fn)(void),
>  
>  	return rval;
>  }

Just a small nit: Can you add "#include <sys/mount.h>" to get rid of this warning:
safe_macros.c:686: warning: implicit declaration of function ‘mount’

Regards,
Jan

> +
> +int safe_mount(const char *file, const int lineno, void (*cleanup_fn)(void),
> +	       const char *source, const char *target,
> +	       const char *filesystemtype, unsigned long mountflags,
> +	       const void *data)
> +{
> +	int rval;
> +
> +	rval = mount(source, target, filesystemtype, mountflags, data);
> +
> +	if (rval == -1) {
> +		tst_brkm(TBROK | TERRNO, cleanup_fn,
> +			 "%s:%d: mount(%s, %s, %s, %lu, %p) failed",
> +			 file, lineno, source, target, filesystemtype,
> +			 mountflags, data);
> +	}
> +
> +	return rval;
> +}
> --
> 1.8.3.1
> 
> 
> ------------------------------------------------------------------------------
> _______________________________________________
> Ltp-list mailing list
> Ltp-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ltp-list
> 

------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

  parent reply	other threads:[~2014-08-25 10:11 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-15 10:52 [LTP] [PATCH 1/3] lib: Add SAFE_MOUNT() Matus Marhefka
2014-08-15 10:52 ` [LTP] [PATCH 2/3] containers: added mountns dir and mountns/mountns01.c Matus Marhefka
2014-08-25 10:26   ` Jan Stancek
2014-09-09 13:39     ` chrubis
2014-08-25 14:08   ` [LTP] [PATCH 2/3 v2] " Matus Marhefka
2014-08-29 12:23   ` [LTP] [PATCH 2/3 v3] " Matus Marhefka
2014-09-09 13:28     ` chrubis
2014-10-02 12:26   ` [LTP] [PATCH 2/3 v4] " Matus Marhefka
2014-08-15 10:52 ` [LTP] [PATCH 3/3] containers: added mountns/mountns02.c Matus Marhefka
2014-08-15 15:16   ` [LTP] [PATCH 3/3 v2] " Matus Marhefka
2014-08-25 10:33     ` Jan Stancek
2014-08-25 14:09     ` [LTP] [PATCH 3/3 v3] " Matus Marhefka
2014-08-29 12:24     ` [LTP] [PATCH 3/3 v4] " Matus Marhefka
2014-08-29 12:45       ` Jan Stancek
2014-09-09 13:40       ` chrubis
2014-10-02 12:27     ` [LTP] [PATCH 3/3 v5] " Matus Marhefka
2014-10-02 13:35       ` Cyril Hrubis
2014-08-25 10:11 ` Jan Stancek [this message]
2014-08-25 14:06 ` [LTP] [PATCH 1/3 v2] lib: Add SAFE_MOUNT() Matus Marhefka
2014-08-29 12:22 ` [LTP] [PATCH 1/3 v3] lib: Added SAFE_MOUNT() and SAFE_UMOUNT() Matus Marhefka
2014-10-02 12:55   ` Cyril Hrubis

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=451887524.12237225.1408961475409.JavaMail.zimbra@redhat.com \
    --to=jstancek@redhat.com \
    --cc=ltp-list@lists.sourceforge.net \
    --cc=mmarhefk@redhat.com \
    /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