svn commit: r298796 - in head/sys: kern sys
John Baldwin
jhb at FreeBSD.org
Fri Apr 29 20:11:11 UTC 2016
Author: jhb
Date: Fri Apr 29 20:11:09 2016
New Revision: 298796
URL: https://svnweb.freebsd.org/changeset/base/298796
Log:
Introduce a new protocol hook pru_aio_queue.
This allows a protocol to claim individual AIO requests instead of using
the default socket AIO handling.
Sponsored by: Chelsio Communications
Modified:
head/sys/kern/sys_socket.c
head/sys/kern/uipc_domain.c
head/sys/kern/uipc_socket.c
head/sys/sys/protosw.h
Modified: head/sys/kern/sys_socket.c
==============================================================================
--- head/sys/kern/sys_socket.c Fri Apr 29 19:17:31 2016 (r298795)
+++ head/sys/kern/sys_socket.c Fri Apr 29 20:11:09 2016 (r298796)
@@ -734,8 +734,13 @@ soo_aio_queue(struct file *fp, struct ka
{
struct socket *so;
struct sockbuf *sb;
+ int error;
so = fp->f_data;
+ error = (*so->so_proto->pr_usrreqs->pru_aio_queue)(so, job);
+ if (error == 0)
+ return (0);
+
switch (job->uaiocb.aio_lio_opcode) {
case LIO_READ:
sb = &so->so_rcv;
Modified: head/sys/kern/uipc_domain.c
==============================================================================
--- head/sys/kern/uipc_domain.c Fri Apr 29 19:17:31 2016 (r298795)
+++ head/sys/kern/uipc_domain.c Fri Apr 29 20:11:09 2016 (r298796)
@@ -135,6 +135,7 @@ protosw_init(struct protosw *pr)
#define DEFAULT(foo, bar) if ((foo) == NULL) (foo) = (bar)
DEFAULT(pu->pru_accept, pru_accept_notsupp);
+ DEFAULT(pu->pru_aio_queue, pru_aio_queue_notsupp);
DEFAULT(pu->pru_bind, pru_bind_notsupp);
DEFAULT(pu->pru_bindat, pru_bindat_notsupp);
DEFAULT(pu->pru_connect, pru_connect_notsupp);
Modified: head/sys/kern/uipc_socket.c
==============================================================================
--- head/sys/kern/uipc_socket.c Fri Apr 29 19:17:31 2016 (r298795)
+++ head/sys/kern/uipc_socket.c Fri Apr 29 20:11:09 2016 (r298796)
@@ -3103,6 +3103,13 @@ pru_accept_notsupp(struct socket *so, st
}
int
+pru_aio_queue_notsupp(struct socket *so, struct kaiocb *job)
+{
+
+ return EOPNOTSUPP;
+}
+
+int
pru_attach_notsupp(struct socket *so, int proto, struct thread *td)
{
Modified: head/sys/sys/protosw.h
==============================================================================
--- head/sys/sys/protosw.h Fri Apr 29 19:17:31 2016 (r298795)
+++ head/sys/sys/protosw.h Fri Apr 29 20:11:09 2016 (r298796)
@@ -34,6 +34,7 @@
#define _SYS_PROTOSW_H_
/* Forward declare these structures referenced from prototypes below. */
+struct kaiocb;
struct mbuf;
struct thread;
struct sockaddr;
@@ -228,12 +229,14 @@ struct pr_usrreqs {
struct thread *td);
int (*pru_connectat)(int fd, struct socket *so,
struct sockaddr *nam, struct thread *td);
+ int (*pru_aio_queue)(struct socket *so, struct kaiocb *job);
};
/*
* All nonvoid pru_*() functions below return EOPNOTSUPP.
*/
int pru_accept_notsupp(struct socket *so, struct sockaddr **nam);
+int pru_aio_queue_notsupp(struct socket *so, struct kaiocb *job);
int pru_attach_notsupp(struct socket *so, int proto, struct thread *td);
int pru_bind_notsupp(struct socket *so, struct sockaddr *nam,
struct thread *td);
More information about the svn-src-all
mailing list