tst_device: Move tst_dev_sync() into from header to source file
While socketcall01.c could (and should) be easily fixed by using
tst_syscall() instead of custom syscall support detection and
nothing else was broken by 9e83513eb, before release do more
conservative fix by moving tst_dev_sync() into library code.
This fixes regression in detecting socketcall() syscall support for
archs which does not support it (e.g. x86_64, ARM):
socketcall01.c:42: FAIL: socketcall() for TCP stream failed with -1: ENOSYS (38)
socketcall01.c:42: FAIL: socketcall() for unix domain dgram failed with -1: ENOSYS (38)
socketcall01.c:42: FAIL: socketcall() for Raw socket failed with -1: ENOSYS (38)
socketcall01.c:42: FAIL: socketcall() for UDP dgram failed with -1: ENOSYS (38)
Fixes: 9e83513eb "tst_device.h: Use lapi/syscalls.h instead of <sys/syscall.h>"
Fixes: #634
Suggested-by: Martin Doucha <mdoucha@suse.cz>
Acked-by: Cyril Hrubis <chrubis@suse.cz>
Signed-off-by: Petr Vorel <pvorel@suse.cz>
diff --git a/include/tst_device.h b/include/tst_device.h
index 13d92ee..3ad33bd 100644
--- a/include/tst_device.h
+++ b/include/tst_device.h
@@ -19,7 +19,6 @@
#define TST_DEVICE_H__
#include <unistd.h>
-#include "lapi/syscalls.h"
struct tst_device {
const char *dev;
@@ -76,10 +75,7 @@
* simply before the tst_dev_bytes_written invocation. For easy to use,
* we create this inline function tst_dev_sync.
*/
-static inline int tst_dev_sync(int fd)
-{
- return syscall(__NR_syncfs, fd);
-}
+int tst_dev_sync(int fd);
/*
* Reads test block device stat file and returns the bytes written since the
diff --git a/lib/tst_device.c b/lib/tst_device.c
index e78549c..89b9c96 100644
--- a/lib/tst_device.c
+++ b/lib/tst_device.c
@@ -31,6 +31,7 @@
#include <linux/loop.h>
#include <stdint.h>
#include <inttypes.h>
+#include "lapi/syscalls.h"
#include "test.h"
#include "safe_macros.h"
@@ -222,6 +223,11 @@
return 1;
}
+int tst_dev_sync(int fd)
+{
+ return syscall(__NR_syncfs, fd);
+}
+
const char *tst_acquire_device__(unsigned int size)
{
int fd;