public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/3] lib: Add SAFE_MOUNT()
@ 2014-08-15 10:52 Matus Marhefka
  2014-08-15 10:52 ` [LTP] [PATCH 2/3] containers: added mountns dir and mountns/mountns01.c Matus Marhefka
                   ` (4 more replies)
  0 siblings, 5 replies; 21+ messages in thread
From: Matus Marhefka @ 2014-08-15 10:52 UTC (permalink / raw)
  To: ltp-list

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;
 }
+
+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

^ permalink raw reply related	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2014-10-02 13:36 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [LTP] [PATCH 1/3] lib: Add SAFE_MOUNT() Jan Stancek
2014-08-25 14:06 ` [LTP] [PATCH 1/3 v2] " 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox