From: Anuj Gupta Add three ioctls for write stream management: FS_IOC_WRITE_STREAM_GET_MAX number of streams the filesystem offers FS_IOC_WRITE_STREAM_ALLOC reserve a stream, returns an fd FS_IOC_WRITE_STREAM_SET set or clear a stream on a file Write streams are a resource the kernel manages and applications ask for. ALLOC reserves a stream and returns a stream fd; the stream stays reserved as long as that fd is open. ALLOC fails once all streams are reserved. SET assigns the stream named by the stream_fd in struct fs_write_stream_set to an open file; the same stream fd can be used to set the stream on any number of files. SET with FS_WRITE_STREAM_SET_CLEAR and a stream_fd of -1 clears whatever stream the file carries. Suggested-by: Christoph Hellwig Signed-off-by: Anuj Gupta Signed-off-by: Kanchan Joshi --- include/uapi/linux/fs.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/include/uapi/linux/fs.h b/include/uapi/linux/fs.h index 34c6f219462a..1974052aa476 100644 --- a/include/uapi/linux/fs.h +++ b/include/uapi/linux/fs.h @@ -345,6 +345,21 @@ struct file_attr { /* Get logical block metadata capability details */ #define FS_IOC_GETLBMD_CAP _IOWR(0x15, 2, struct logical_block_metadata_cap) +struct fs_write_stream_set { + __s32 stream_fd; /* IN: stream to attach, -1 to clear */ + __u32 flags; /* IN: FS_WRITE_STREAM_SET_* */ +}; + +/* Clear the file's write stream. Requires stream_fd to be -1. */ +#define FS_WRITE_STREAM_SET_CLEAR (1U << 0) + +/* GET_MAX returns the count through its argument; ALLOC returns a stream fd + * as the ioctl return value and takes none. + */ +#define FS_IOC_WRITE_STREAM_GET_MAX _IOR(0x15, 3, __u32) +#define FS_IOC_WRITE_STREAM_ALLOC _IO(0x15, 4) +#define FS_IOC_WRITE_STREAM_SET _IOW(0x15, 5, struct fs_write_stream_set) + /* * Inode flags (FS_IOC_GETFLAGS / FS_IOC_SETFLAGS) * -- 2.25.1