summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2017-09-29 08:07:17 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2018-01-25 19:32:55 -0500
commite1fc742e14e01d84d9693c4aca4ab23da65811fb (patch)
tree5f6aa92ad10ebd83a667d246b17c8fb4e3cb8f4e /include
parentc981f254cc82f50f8cb864ce6432097b23195b9c (diff)
fs: add RWF_APPEND
This is the per-I/O equivalent of O_APPEND to support atomic append operations on any open file. If a file is opened with O_APPEND, pwrite() ignores the offset and always appends data to the end of the file. RWF_APPEND enables atomic append and pwrite() with offset on a single file descriptor. Signed-off-by: Jürg Billeter <j@bitron.ch> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'include')
-rw-r--r--include/linux/fs.h2
-rw-r--r--include/uapi/linux/fs.h6
2 files changed, 7 insertions, 1 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 6276f8315e5b..85c8ddc55760 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -3224,6 +3224,8 @@ static inline int kiocb_set_rw_flags(struct kiocb *ki, rwf_t flags)
3224 ki->ki_flags |= IOCB_DSYNC; 3224 ki->ki_flags |= IOCB_DSYNC;
3225 if (flags & RWF_SYNC) 3225 if (flags & RWF_SYNC)
3226 ki->ki_flags |= (IOCB_DSYNC | IOCB_SYNC); 3226 ki->ki_flags |= (IOCB_DSYNC | IOCB_SYNC);
3227 if (flags & RWF_APPEND)
3228 ki->ki_flags |= IOCB_APPEND;
3227 return 0; 3229 return 0;
3228} 3230}
3229 3231
diff --git a/include/uapi/linux/fs.h b/include/uapi/linux/fs.h
index 4199f8acbce5..d2a8313fabd7 100644
--- a/include/uapi/linux/fs.h
+++ b/include/uapi/linux/fs.h
@@ -377,7 +377,11 @@ typedef int __bitwise __kernel_rwf_t;
377/* per-IO, return -EAGAIN if operation would block */ 377/* per-IO, return -EAGAIN if operation would block */
378#define RWF_NOWAIT ((__force __kernel_rwf_t)0x00000008) 378#define RWF_NOWAIT ((__force __kernel_rwf_t)0x00000008)
379 379
380/* per-IO O_APPEND */
381#define RWF_APPEND ((__force __kernel_rwf_t)0x00000010)
382
380/* mask of flags supported by the kernel */ 383/* mask of flags supported by the kernel */
381#define RWF_SUPPORTED (RWF_HIPRI | RWF_DSYNC | RWF_SYNC | RWF_NOWAIT) 384#define RWF_SUPPORTED (RWF_HIPRI | RWF_DSYNC | RWF_SYNC | RWF_NOWAIT |\
385 RWF_APPEND)
382 386
383#endif /* _UAPI_LINUX_FS_H */ 387#endif /* _UAPI_LINUX_FS_H */