aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Tomasz Napierala <trasz@FreeBSD.org>2019-12-14 13:37:17 +0000
committerEdward Tomasz Napierala <trasz@FreeBSD.org>2019-12-14 13:37:17 +0000
commitcf69fe66d43c6e91d6a91b1567ff445bb1c0f095 (patch)
tree639b86ddd6195671fd10b10ab90e14e16cd46e87
parent0cde2b32394f9dce535431d6ee4736c852622a8d (diff)
downloadsrc-cf69fe66d43c6e91d6a91b1567ff445bb1c0f095.tar.gz
src-cf69fe66d43c6e91d6a91b1567ff445bb1c0f095.zip
Add sync_file_range(2) implementation to linux(4); it's a thin wrapper
over the usual fsync(2). This silences some warnings when running "apt-get upgrade". Reviewed by: brooks, emaste MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D22371
Notes
Notes: svn path=/head/; revision=355754
-rw-r--r--sys/amd64/linux/linux_dummy.c1
-rw-r--r--sys/amd64/linux32/linux32_dummy.c1
-rw-r--r--sys/arm64/linux/linux_dummy.c1
-rw-r--r--sys/compat/linux/linux_file.c16
-rw-r--r--sys/compat/linux/linux_file.h7
-rw-r--r--sys/i386/linux/linux_dummy.c1
6 files changed, 23 insertions, 4 deletions
diff --git a/sys/amd64/linux/linux_dummy.c b/sys/amd64/linux/linux_dummy.c
index 8384e6376bb9..32922da113c6 100644
--- a/sys/amd64/linux/linux_dummy.c
+++ b/sys/amd64/linux/linux_dummy.c
@@ -99,7 +99,6 @@ DUMMY(migrate_pages);
DUMMY(unshare);
/* Linux 2.6.17: */
DUMMY(splice);
-DUMMY(sync_file_range);
DUMMY(tee);
DUMMY(vmsplice);
/* Linux 2.6.18: */
diff --git a/sys/amd64/linux32/linux32_dummy.c b/sys/amd64/linux32/linux32_dummy.c
index 23fba4f72a00..1f8f5aa1c24f 100644
--- a/sys/amd64/linux32/linux32_dummy.c
+++ b/sys/amd64/linux32/linux32_dummy.c
@@ -105,7 +105,6 @@ DUMMY(migrate_pages);
DUMMY(unshare);
/* Linux 2.6.17: */
DUMMY(splice);
-DUMMY(sync_file_range);
DUMMY(tee);
DUMMY(vmsplice);
/* Linux 2.6.18: */
diff --git a/sys/arm64/linux/linux_dummy.c b/sys/arm64/linux/linux_dummy.c
index 73cadbcf7e42..ca43f5d35a05 100644
--- a/sys/arm64/linux/linux_dummy.c
+++ b/sys/arm64/linux/linux_dummy.c
@@ -101,7 +101,6 @@ DUMMY(migrate_pages);
DUMMY(unshare);
/* Linux 2.6.17: */
DUMMY(splice);
-DUMMY(sync_file_range);
DUMMY(tee);
DUMMY(vmsplice);
/* Linux 2.6.18: */
diff --git a/sys/compat/linux/linux_file.c b/sys/compat/linux/linux_file.c
index 57723e1aafd7..20d58ea58346 100644
--- a/sys/compat/linux/linux_file.c
+++ b/sys/compat/linux/linux_file.c
@@ -908,6 +908,22 @@ linux_fdatasync(td, uap)
}
int
+linux_sync_file_range(td, uap)
+ struct thread *td;
+ struct linux_sync_file_range_args *uap;
+{
+
+ if (uap->offset < 0 || uap->nbytes < 0 ||
+ (uap->flags & ~(LINUX_SYNC_FILE_RANGE_WAIT_BEFORE |
+ LINUX_SYNC_FILE_RANGE_WRITE |
+ LINUX_SYNC_FILE_RANGE_WAIT_AFTER)) != 0) {
+ return (EINVAL);
+ }
+
+ return (kern_fsync(td, uap->fd, false));
+}
+
+int
linux_pread(struct thread *td, struct linux_pread_args *uap)
{
struct vnode *vp;
diff --git a/sys/compat/linux/linux_file.h b/sys/compat/linux/linux_file.h
index 8742fa27b278..40384c52a066 100644
--- a/sys/compat/linux/linux_file.h
+++ b/sys/compat/linux/linux_file.h
@@ -134,4 +134,11 @@
#define LINUX_RENAME_EXCHANGE 0x00000002
#define LINUX_RENAME_WHITEOUT 0x00000004
+/*
+ * sync_file_range flags
+ */
+#define LINUX_SYNC_FILE_RANGE_WAIT_BEFORE 1
+#define LINUX_SYNC_FILE_RANGE_WRITE 2
+#define LINUX_SYNC_FILE_RANGE_WAIT_AFTER 4
+
#endif /* !_LINUX_FILE_H_ */
diff --git a/sys/i386/linux/linux_dummy.c b/sys/i386/linux/linux_dummy.c
index f916992e48c4..4ed88cef9e82 100644
--- a/sys/i386/linux/linux_dummy.c
+++ b/sys/i386/linux/linux_dummy.c
@@ -101,7 +101,6 @@ DUMMY(migrate_pages);
DUMMY(unshare);
/* Linux 2.6.17: */
DUMMY(splice);
-DUMMY(sync_file_range);
DUMMY(tee);
DUMMY(vmsplice);
/* Linux 2.6.18: */