git: e331ce2d60b6 - stable/14 - aio_read2/aio_write2: add AIO_OP2_VECTORED

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Sun, 18 Feb 2024 10:02:24 UTC
The branch stable/14 has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=e331ce2d60b6ffb3aa67f882d91336a587d07e40

commit e331ce2d60b6ffb3aa67f882d91336a587d07e40
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2024-02-03 18:09:36 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2024-02-18 10:01:46 +0000

    aio_read2/aio_write2: add AIO_OP2_VECTORED
    
    (cherry picked from commit 8dfc788b8480a13f1f945f0a94d8b1e327af5c6f)
---
 lib/libc/gen/aio_read2.c  | 4 +++-
 lib/libc/gen/aio_write2.c | 4 +++-
 sys/sys/aio.h             | 1 +
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/lib/libc/gen/aio_read2.c b/lib/libc/gen/aio_read2.c
index 3a783e1b1b15..a5186d509b26 100644
--- a/lib/libc/gen/aio_read2.c
+++ b/lib/libc/gen/aio_read2.c
@@ -37,13 +37,15 @@ aio_read2(struct aiocb *iocb, int flags)
 {
 	int error;
 
-	if ((flags & ~(AIO_OP2_FOFFSET)) != 0) {
+	if ((flags & ~(AIO_OP2_FOFFSET | AIO_OP2_VECTORED)) != 0) {
 		errno = EINVAL;
 		return (-1);
 	}
 	iocb->aio_lio_opcode = LIO_READ;
 	if ((flags & AIO_OP2_FOFFSET) != 0)
 		iocb->aio_lio_opcode |= LIO_FOFFSET;
+	if ((flags & AIO_OP2_VECTORED) != 0)
+		iocb->aio_lio_opcode |= LIO_VECTORED;
 
 	error = lio_listio(LIO_NOWAIT, &iocb, 1, NULL);
 	if (error == -1 && errno == EIO) {
diff --git a/lib/libc/gen/aio_write2.c b/lib/libc/gen/aio_write2.c
index 8b5d4a38a6c5..8f4f6a35fd4d 100644
--- a/lib/libc/gen/aio_write2.c
+++ b/lib/libc/gen/aio_write2.c
@@ -37,13 +37,15 @@ aio_write2(struct aiocb *iocb, int flags)
 {
 	int error;
 
-	if ((flags & ~(AIO_OP2_FOFFSET)) != 0) {
+	if ((flags & ~(AIO_OP2_FOFFSET | AIO_OP2_VECTORED)) != 0) {
 		errno = EINVAL;
 		return (-1);
 	}
 	iocb->aio_lio_opcode = LIO_WRITE;
 	if ((flags & AIO_OP2_FOFFSET) != 0)
 		iocb->aio_lio_opcode |= LIO_FOFFSET;
+	if ((flags & AIO_OP2_VECTORED) != 0)
+		iocb->aio_lio_opcode |= LIO_VECTORED;
 
 	error = lio_listio(LIO_NOWAIT, &iocb, 1, NULL);
 	if (error == -1 && errno == EIO) {
diff --git a/sys/sys/aio.h b/sys/sys/aio.h
index 6680f9fed3fa..919a6180b130 100644
--- a/sys/sys/aio.h
+++ b/sys/sys/aio.h
@@ -58,6 +58,7 @@
 /* aio_read2/aio_write2 flags */
 #if __BSD_VISIBLE
 #define	AIO_OP2_FOFFSET		0x00000001
+#define	AIO_OP2_VECTORED	0x00000002
 #endif
 
 /*