Skip to content

Commit 4b980c2

Browse files
committed
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 9e83513, 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: 9e83513 "tst_device.h: Use lapi/syscalls.h instead of <sys/syscall.h>" Fixes: #634 Suggested-by: Martin Doucha <[email protected]> Acked-by: Cyril Hrubis <[email protected]> Signed-off-by: Petr Vorel <[email protected]>
1 parent 185a54d commit 4b980c2

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

include/tst_device.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
#define TST_DEVICE_H__
2020

2121
#include <unistd.h>
22-
#include "lapi/syscalls.h"
2322

2423
struct tst_device {
2524
const char *dev;
@@ -76,10 +75,7 @@ int tst_detach_device(const char *dev_path);
7675
* simply before the tst_dev_bytes_written invocation. For easy to use,
7776
* we create this inline function tst_dev_sync.
7877
*/
79-
static inline int tst_dev_sync(int fd)
80-
{
81-
return syscall(__NR_syncfs, fd);
82-
}
78+
int tst_dev_sync(int fd);
8379

8480
/*
8581
* Reads test block device stat file and returns the bytes written since the

lib/tst_device.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include <linux/loop.h>
3232
#include <stdint.h>
3333
#include <inttypes.h>
34+
#include "lapi/syscalls.h"
3435
#include "test.h"
3536
#include "safe_macros.h"
3637

@@ -222,6 +223,11 @@ int tst_detach_device(const char *dev)
222223
return 1;
223224
}
224225

226+
int tst_dev_sync(int fd)
227+
{
228+
return syscall(__NR_syncfs, fd);
229+
}
230+
225231
const char *tst_acquire_device__(unsigned int size)
226232
{
227233
int fd;

0 commit comments

Comments
 (0)