git: 8dfc788b8480 - main - aio_read2/aio_write2: add AIO_OP2_VECTORED

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Sun, 11 Feb 2024 01:54:38 UTC
The branch main has been updated by kib:

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

commit 8dfc788b8480a13f1f945f0a94d8b1e327af5c6f
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2024-02-03 18:09:36 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2024-02-11 01:54:11 +0000

    aio_read2/aio_write2: add AIO_OP2_VECTORED
    
    Suggested by:   Vinícius dos Santos Oliveira <vini.ipsmaker@gmail.com>
    Reviewed by:    jhb
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
    Differential revision:  https://reviews.freebsd.org/D43448
---
 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
 
 /*