----- Original Message -----
> From: "Matus Marhefka" <mmarh...@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 <mmarh...@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

Reply via email to