Commit 4027d6e3 authored by Benjamin LaHaise's avatar Benjamin LaHaise

Merge redhat.com:/md0/linux-2.5 into redhat.com:/md0/net-2.5

parents 5b3e7241 592dbf58
......@@ -81,6 +81,7 @@ struct socket
struct scm_cookie;
struct vm_area_struct;
struct page;
struct kiocb;
struct proto_ops {
int family;
......@@ -104,8 +105,12 @@ struct proto_ops {
char *optval, int optlen);
int (*getsockopt) (struct socket *sock, int level, int optname,
char *optval, int *optlen);
int (*sendmsg) (struct socket *sock, struct msghdr *m, int total_len, struct scm_cookie *scm);
int (*recvmsg) (struct socket *sock, struct msghdr *m, int total_len, int flags, struct scm_cookie *scm);
int (*sendmsg) (struct kiocb *iocb, struct socket *sock,
struct msghdr *m, int total_len,
struct scm_cookie *scm);
int (*recvmsg) (struct kiocb *iocb, struct socket *sock,
struct msghdr *m, int total_len, int flags,
struct scm_cookie *scm);
int (*mmap) (struct file *file, struct socket *sock, struct vm_area_struct * vma);
ssize_t (*sendpage) (struct socket *sock, struct page *page, int offset, size_t size, int flags);
};
......
......@@ -20,10 +20,12 @@ extern int inet_dgram_connect(struct socket *sock,
int addr_len, int flags);
extern int inet_accept(struct socket *sock,
struct socket *newsock, int flags);
extern int inet_recvmsg(struct socket *sock,
extern int inet_recvmsg(struct kiocb *iocb,
struct socket *sock,
struct msghdr *ubuf,
int size, int flags, struct scm_cookie *scm);
extern int inet_sendmsg(struct socket *sock,
extern int inet_sendmsg(struct kiocb *iocb,
struct socket *sock,
struct msghdr *msg,
int size, struct scm_cookie *scm);
extern int inet_shutdown(struct socket *sock, int how);
......
......@@ -51,6 +51,7 @@
#include <asm/atomic.h>
#include <net/dst.h>
#include <net/scm.h> /* for sock_iocb */
/*
* This structure really needs to be cleaned up.
......@@ -242,9 +243,10 @@ struct proto {
int (*getsockopt)(struct sock *sk, int level,
int optname, char *optval,
int *option);
int (*sendmsg)(struct sock *sk, struct msghdr *msg,
int len);
int (*recvmsg)(struct sock *sk, struct msghdr *msg,
int (*sendmsg)(struct kiocb *iocb, struct sock *sk,
struct msghdr *msg, int len);
int (*recvmsg)(struct kiocb *iocb, struct sock *sk,
struct msghdr *msg,
int len, int noblock, int flags,
int *addr_len);
int (*bind)(struct sock *sk,
......@@ -292,7 +294,29 @@ static __inline__ void sock_prot_dec_use(struct proto *prot)
#define SOCK_BINDADDR_LOCK 4
#define SOCK_BINDPORT_LOCK 8
/* sock_iocb: used to kick off async processing of socket ios */
struct sock_iocb {
struct list_head list;
int flags;
int size;
struct socket *sock;
struct sock *sk;
struct msghdr *msg, async_msg;
struct iovec async_iov;
struct scm_cookie *scm, async_scm;
};
static inline struct sock_iocb *kiocb_to_siocb(struct kiocb *iocb)
{
BUG_ON(sizeof(struct sock_iocb) > KIOCB_PRIVATE_SIZE);
return (struct sock_iocb *)iocb->private;
}
static inline struct kiocb *siocb_to_kiocb(struct sock_iocb *si)
{
return container_of((void *)si, struct kiocb, private);
}
/* Used by processes to "lock" a socket state, so that
* interrupts and bottom half handlers won't change it
......@@ -390,10 +414,10 @@ extern int sock_no_getsockopt(struct socket *, int , int,
char *, int *);
extern int sock_no_setsockopt(struct socket *, int, int,
char *, int);
extern int sock_no_sendmsg(struct socket *,
extern int sock_no_sendmsg(struct kiocb *, struct socket *,
struct msghdr *, int,
struct scm_cookie *);
extern int sock_no_recvmsg(struct socket *,
extern int sock_no_recvmsg(struct kiocb *, struct socket *,
struct msghdr *, int, int,
struct scm_cookie *);
extern int sock_no_mmap(struct file *file,
......
......@@ -648,7 +648,8 @@ extern int tcp_v4_remember_stamp(struct sock *sk);
extern int tcp_v4_tw_remember_stamp(struct tcp_tw_bucket *tw);
extern int tcp_sendmsg(struct sock *sk, struct msghdr *msg, int size);
extern int tcp_sendmsg(struct kiocb *iocb, struct sock *sk,
struct msghdr *msg, int size);
extern ssize_t tcp_sendpage(struct socket *sock, struct page *page, int offset, size_t size, int flags);
extern int tcp_ioctl(struct sock *sk,
......@@ -739,7 +740,7 @@ extern int tcp_setsockopt(struct sock *sk, int level,
int optname, char *optval,
int optlen);
extern void tcp_set_keepalive(struct sock *sk, int val);
extern int tcp_recvmsg(struct sock *sk,
extern int tcp_recvmsg(struct kiocb *iocb, struct sock *sk,
struct msghdr *msg,
int len, int nonblock,
int flags, int *addr_len);
......
......@@ -64,7 +64,8 @@ extern void udp_err(struct sk_buff *, u32);
extern int udp_connect(struct sock *sk,
struct sockaddr *usin, int addr_len);
extern int udp_sendmsg(struct sock *sk, struct msghdr *msg, int len);
extern int udp_sendmsg(struct kiocb *iocb, struct sock *sk,
struct msghdr *msg, int len);
extern int udp_rcv(struct sk_buff *skb);
extern int udp_ioctl(struct sock *sk, int cmd, unsigned long arg);
......
......@@ -336,8 +336,8 @@ int atm_connect(struct socket *sock,int itf,short vpi,int vci)
}
int atm_recvmsg(struct socket *sock,struct msghdr *m,int total_len,
int flags,struct scm_cookie *scm)
int atm_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *m,
int total_len, int flags, struct scm_cookie *scm)
{
DECLARE_WAITQUEUE(wait,current);
struct atm_vcc *vcc;
......@@ -417,8 +417,8 @@ int atm_recvmsg(struct socket *sock,struct msghdr *m,int total_len,
}
int atm_sendmsg(struct socket *sock,struct msghdr *m,int total_len,
struct scm_cookie *scm)
int atm_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *m,
int total_len, struct scm_cookie *scm)
{
DECLARE_WAITQUEUE(wait,current);
struct atm_vcc *vcc;
......
......@@ -13,10 +13,10 @@
int atm_create(struct socket *sock,int protocol,int family);
int atm_release(struct socket *sock);
int atm_connect(struct socket *sock,int itf,short vpi,int vci);
int atm_recvmsg(struct socket *sock,struct msghdr *m,int total_len,
int flags,struct scm_cookie *scm);
int atm_sendmsg(struct socket *sock,struct msghdr *m,int total_len,
struct scm_cookie *scm);
int atm_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *m,
int total_len, int flags, struct scm_cookie *scm);
int atm_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *m,
int total_len, struct scm_cookie *scm);
unsigned int atm_poll(struct file *file,struct socket *sock,poll_table *wait);
int atm_ioctl(struct socket *sock,unsigned int cmd,unsigned long arg);
int atm_setsockopt(struct socket *sock,int level,int optname,char *optval,
......
......@@ -1410,7 +1410,8 @@ static int ax25_getname(struct socket *sock, struct sockaddr *uaddr,
return err;
}
static int ax25_sendmsg(struct socket *sock, struct msghdr *msg, int len,
static int ax25_sendmsg(struct kiocb *iocb, struct socket *sock,
struct msghdr *msg, int len,
struct scm_cookie *scm)
{
struct sockaddr_ax25 *usax = (struct sockaddr_ax25 *)msg->msg_name;
......@@ -1588,8 +1589,8 @@ static int ax25_sendmsg(struct socket *sock, struct msghdr *msg, int len,
return err;
}
static int ax25_recvmsg(struct socket *sock, struct msghdr *msg, int size,
int flags, struct scm_cookie *scm)
static int ax25_recvmsg(struct kiocb *iocb, struct socket *sock,
struct msghdr *msg, int size, int flags, struct scm_cookie *scm)
{
struct sock *sk = sock->sk;
struct sk_buff *skb;
......
......@@ -207,7 +207,8 @@ struct sock *bluez_accept_dequeue(struct sock *parent, struct socket *newsock)
return NULL;
}
int bluez_sock_recvmsg(struct socket *sock, struct msghdr *msg, int len, int flags, struct scm_cookie *scm)
int bluez_sock_recvmsg(struct kiocb *iocb, struct socket *sock,
struct msghdr *msg, int len, int flags, struct scm_cookie *scm)
{
int noblock = flags & MSG_DONTWAIT;
struct sock *sk = sock->sk;
......
......@@ -1047,14 +1047,14 @@ int sock_no_getsockopt(struct socket *sock, int level, int optname,
return -EOPNOTSUPP;
}
int sock_no_sendmsg(struct socket *sock, struct msghdr *m, int flags,
struct scm_cookie *scm)
int sock_no_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *m,
int flags, struct scm_cookie *scm)
{
return -EOPNOTSUPP;
}
int sock_no_recvmsg(struct socket *sock, struct msghdr *m, int len, int flags,
struct scm_cookie *scm)
int sock_no_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *m,
int len, int flags, struct scm_cookie *scm)
{
return -EOPNOTSUPP;
}
......
......@@ -1733,8 +1733,8 @@ static int dn_data_ready(struct sock *sk, struct sk_buff_head *q, int flags, int
}
static int dn_recvmsg(struct socket *sock, struct msghdr *msg, int size,
int flags, struct scm_cookie *scm)
static int dn_recvmsg(struct kiocb *iocb, struct socket *sock,
struct msghdr *msg, int size, int flags, struct scm_cookie *scm)
{
struct sock *sk = sock->sk;
struct dn_scp *scp = DN_SK(sk);
......@@ -1901,8 +1901,8 @@ static inline int dn_queue_too_long(struct dn_scp *scp, struct sk_buff_head *que
return 0;
}
static int dn_sendmsg(struct socket *sock, struct msghdr *msg, int size,
struct scm_cookie *scm)
static int dn_sendmsg(struct kiocb *iocb, struct socket *sock,
struct msghdr *msg, int size, struct scm_cookie *scm)
{
struct sock *sk = sock->sk;
struct dn_scp *scp = DN_SK(sk);
......
......@@ -97,8 +97,9 @@ struct ec_cb
* If necessary we block.
*/
static int econet_recvmsg(struct socket *sock, struct msghdr *msg, int len,
int flags, struct scm_cookie *scm)
static int econet_recvmsg(struct kiocb *iocb, struct socket *sock,
struct msghdr *msg, int len, int flags,
struct scm_cookie *scm)
{
struct sock *sk = sock->sk;
struct sk_buff *skb;
......@@ -230,8 +231,8 @@ static void ec_tx_done(struct sk_buff *skb, int result)
* and hence whether to use real Econet or the UDP emulation.
*/
static int econet_sendmsg(struct socket *sock, struct msghdr *msg, int len,
struct scm_cookie *scm)
static int econet_sendmsg(struct kiocb *iocb, struct socket *sock,
struct msghdr *msg, int len, struct scm_cookie *scm)
{
struct sock *sk = sock->sk;
struct sockaddr_ec *saddr=(struct sockaddr_ec *)msg->msg_name;
......
......@@ -753,13 +753,14 @@ int inet_getname(struct socket *sock, struct sockaddr *uaddr,
}
int inet_recvmsg(struct socket *sock, struct msghdr *msg, int size,
int flags, struct scm_cookie *scm)
int inet_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg,
int size, int flags, struct scm_cookie *scm)
{
struct sock *sk = sock->sk;
int addr_len = 0;
int err = sk->prot->recvmsg(sk, msg, size, flags & MSG_DONTWAIT,
int err;
err = sk->prot->recvmsg(iocb, sk, msg, size, flags & MSG_DONTWAIT,
flags & ~MSG_DONTWAIT, &addr_len);
if (err >= 0)
msg->msg_namelen = addr_len;
......@@ -767,8 +768,8 @@ int inet_recvmsg(struct socket *sock, struct msghdr *msg, int size,
}
int inet_sendmsg(struct socket *sock, struct msghdr *msg, int size,
struct scm_cookie *scm)
int inet_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg,
int size, struct scm_cookie *scm)
{
struct sock *sk = sock->sk;
......@@ -776,7 +777,7 @@ int inet_sendmsg(struct socket *sock, struct msghdr *msg, int size,
if (!inet_sk(sk)->num && inet_autobind(sk))
return -EAGAIN;
return sk->prot->sendmsg(sk, msg, size);
return sk->prot->sendmsg(iocb, sk, msg, size);
}
int inet_shutdown(struct socket *sock, int how)
......
......@@ -295,7 +295,8 @@ static int raw_getrawfrag(const void *p, char *to, unsigned int offset,
return 0;
}
static int raw_sendmsg(struct sock *sk, struct msghdr *msg, int len)
static int raw_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
int len)
{
struct inet_opt *inet = inet_sk(sk);
struct ipcm_cookie ipc;
......@@ -476,8 +477,8 @@ out: return ret;
* we return it, otherwise we block.
*/
int raw_recvmsg(struct sock *sk, struct msghdr *msg, int len,
int noblock, int flags, int *addr_len)
int raw_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
int len, int noblock, int flags, int *addr_len)
{
struct inet_opt *inet = inet_sk(sk);
int copied = 0;
......
......@@ -1013,7 +1013,8 @@ static inline int select_size(struct sock *sk, struct tcp_opt *tp)
return tmp;
}
int tcp_sendmsg(struct sock *sk, struct msghdr *msg, int size)
int tcp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
int size)
{
struct iovec *iov;
struct tcp_opt *tp = tcp_sk(sk);
......@@ -1475,7 +1476,7 @@ int tcp_read_sock(struct sock *sk, read_descriptor_t *desc,
* Probably, code can be easily improved even more.
*/
int tcp_recvmsg(struct sock *sk, struct msghdr *msg,
int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
int len, int nonblock, int flags, int *addr_len)
{
struct tcp_opt *tp = tcp_sk(sk);
......
......@@ -423,7 +423,8 @@ static int udp_getfrag_nosum(const void *p, char * to, unsigned int offset, unsi
fraglen);
}
int udp_sendmsg(struct sock *sk, struct msghdr *msg, int len)
int udp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
int len)
{
struct inet_opt *inet = inet_sk(sk);
int ulen = len + sizeof(struct udphdr);
......@@ -635,8 +636,8 @@ static __inline__ int udp_checksum_complete(struct sk_buff *skb)
* return it, otherwise we block.
*/
int udp_recvmsg(struct sock *sk, struct msghdr *msg, int len,
int noblock, int flags, int *addr_len)
int udp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
int len, int noblock, int flags, int *addr_len)
{
struct inet_opt *inet = inet_sk(sk);
struct sockaddr_in *sin = (struct sockaddr_in *)msg->msg_name;
......
......@@ -2009,8 +2009,8 @@ drop: kfree_skb(skb);
out: return ret;
}
static int ipx_sendmsg(struct socket *sock, struct msghdr *msg, int len,
struct scm_cookie *scm)
static int ipx_sendmsg(struct kiocb *iocb, struct socket *sock,
struct msghdr *msg, int len, struct scm_cookie *scm)
{
struct sock *sk = sock->sk;
struct ipx_opt *ipxs = ipx_sk(sk);
......@@ -2069,8 +2069,8 @@ out: return ret;
}
static int ipx_recvmsg(struct socket *sock, struct msghdr *msg, int size,
int flags, struct scm_cookie *scm)
static int ipx_recvmsg(struct kiocb *iocb, struct socket *sock,
struct msghdr *msg, int size, int flags, struct scm_cookie *scm)
{
struct sock *sk = sock->sk;
struct ipx_opt *ipxs = ipx_sk(sk);
......
......@@ -1259,8 +1259,8 @@ static int irda_release(struct socket *sock)
* SEQPACK services. This is possible since it forces the client to
* fragment the message if necessary
*/
static int irda_sendmsg(struct socket *sock, struct msghdr *msg, int len,
struct scm_cookie *scm)
static int irda_sendmsg(struct kiocb *iocb, struct socket *sock,
struct msghdr *msg, int len, struct scm_cookie *scm)
{
struct sock *sk = sock->sk;
struct irda_sock *self;
......@@ -1331,8 +1331,9 @@ static int irda_sendmsg(struct socket *sock, struct msghdr *msg, int len,
* Try to receive message and copy it to user. The frame is discarded
* after being read, regardless of how much the user actually read
*/
static int irda_recvmsg_dgram(struct socket *sock, struct msghdr *msg,
int size, int flags, struct scm_cookie *scm)
static int irda_recvmsg_dgram(struct kiocb *iocb, struct socket *sock,
struct msghdr *msg, int size, int flags,
struct scm_cookie *scm)
{
struct sock *sk = sock->sk;
struct irda_sock *self = irda_sk(sk);
......
......@@ -677,8 +677,9 @@ static int llc_ui_accept(struct socket *sock, struct socket *newsock, int flags)
* Copy received data to the socket user.
* Returns non-negative upon success, negative otherwise.
*/
static int llc_ui_recvmsg(struct socket *sock, struct msghdr *msg, int size,
int flags, struct scm_cookie *scm)
static int llc_ui_recvmsg(struct kiocb *iocb, struct socket *sock,
struct msghdr *msg, int size, int flags,
struct scm_cookie *scm)
{
struct sock *sk = sock->sk;
struct sockaddr_llc *uaddr = (struct sockaddr_llc *)msg->msg_name;
......@@ -731,8 +732,8 @@ static int llc_ui_recvmsg(struct socket *sock, struct msghdr *msg, int size,
* Transmit data provided by the socket user.
* Returns non-negative upon success, negative otherwise.
*/
static int llc_ui_sendmsg(struct socket *sock, struct msghdr *msg, int len,
struct scm_cookie *scm)
static int llc_ui_sendmsg(struct kiocb *iocb, struct socket *sock,
struct msghdr *msg, int len, struct scm_cookie *scm)
{
struct sock *sk = sock->sk;
struct llc_opt *llc = llc_sk(sk);
......
......@@ -570,7 +570,8 @@ void netlink_set_err(struct sock *ssk, u32 pid, u32 group, int code)
read_unlock(&nl_table_lock);
}
static int netlink_sendmsg(struct socket *sock, struct msghdr *msg, int len,
static int netlink_sendmsg(struct kiocb *iocb, struct socket *sock,
struct msghdr *msg, int len,
struct scm_cookie *scm)
{
struct sock *sk = sock->sk;
......@@ -639,7 +640,8 @@ static int netlink_sendmsg(struct socket *sock, struct msghdr *msg, int len,
return err;
}
static int netlink_recvmsg(struct socket *sock, struct msghdr *msg, int len,
static int netlink_recvmsg(struct kiocb *iocb, struct socket *sock,
struct msghdr *msg, int len,
int flags, struct scm_cookie *scm)
{
struct sock *sk = sock->sk;
......
......@@ -966,7 +966,8 @@ int nr_rx_frame(struct sk_buff *skb, struct net_device *dev)
return 1;
}
static int nr_sendmsg(struct socket *sock, struct msghdr *msg, int len, struct scm_cookie *scm)
static int nr_sendmsg(struct kiocb *iocb, struct socket *sock,
struct msghdr *msg, int len, struct scm_cookie *scm)
{
struct sock *sk = sock->sk;
nr_cb *nr = nr_sk(sk);
......@@ -1056,8 +1057,9 @@ static int nr_sendmsg(struct socket *sock, struct msghdr *msg, int len, struct s
return len;
}
static int nr_recvmsg(struct socket *sock, struct msghdr *msg, int size,
int flags, struct scm_cookie *scm)
static int nr_recvmsg(struct kiocb *iocb, struct socket *sock,
struct msghdr *msg, int size, int flags,
struct scm_cookie *scm)
{
struct sock *sk = sock->sk;
struct sockaddr_ax25 *sax = (struct sockaddr_ax25 *)msg->msg_name;
......
......@@ -288,7 +288,8 @@ static int packet_rcv_spkt(struct sk_buff *skb, struct net_device *dev, struct
* protocol layers and you must therefore supply it with a complete frame
*/
static int packet_sendmsg_spkt(struct socket *sock, struct msghdr *msg, int len,
static int packet_sendmsg_spkt(struct kiocb *iocb, struct socket *sock,
struct msghdr *msg, int len,
struct scm_cookie *scm)
{
struct sock *sk = sock->sk;
......@@ -665,8 +666,8 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, struct pack
#endif
static int packet_sendmsg(struct socket *sock, struct msghdr *msg, int len,
struct scm_cookie *scm)
static int packet_sendmsg(struct kiocb *iocb, struct socket *sock,
struct msghdr *msg, int len, struct scm_cookie *scm)
{
struct sock *sk = sock->sk;
struct sockaddr_ll *saddr=(struct sockaddr_ll *)msg->msg_name;
......@@ -1020,7 +1021,8 @@ static int packet_create(struct socket *sock, int protocol)
* If necessary we block.
*/
static int packet_recvmsg(struct socket *sock, struct msghdr *msg, int len,
static int packet_recvmsg(struct kiocb *iocb, struct socket *sock,
struct msghdr *msg, int len,
int flags, struct scm_cookie *scm)
{
struct sock *sk = sock->sk;
......
......@@ -1025,8 +1025,8 @@ int rose_rx_call_request(struct sk_buff *skb, struct net_device *dev, struct ros
return 1;
}
static int rose_sendmsg(struct socket *sock, struct msghdr *msg, int len,
struct scm_cookie *scm)
static int rose_sendmsg(struct kiocb *iocb, struct socket *sock,
struct msghdr *msg, int len, struct scm_cookie *scm)
{
struct sock *sk = sock->sk;
rose_cb *rose = rose_sk(sk);
......@@ -1189,8 +1189,9 @@ static int rose_sendmsg(struct socket *sock, struct msghdr *msg, int len,
}
static int rose_recvmsg(struct socket *sock, struct msghdr *msg, int size,
int flags, struct scm_cookie *scm)
static int rose_recvmsg(struct kiocb *iocb, struct socket *sock,
struct msghdr *msg, int size, int flags,
struct scm_cookie *scm)
{
struct sock *sk = sock->sk;
rose_cb *rose = rose_sk(sk);
......
......@@ -90,10 +90,10 @@
#include <linux/netfilter.h>
static int sock_no_open(struct inode *irrelevant, struct file *dontcare);
static ssize_t sock_read(struct file *file, char *buf,
size_t size, loff_t *ppos);
static ssize_t sock_write(struct file *file, const char *buf,
size_t size, loff_t *ppos);
static ssize_t sock_aio_read(struct kiocb *iocb, char *buf,
size_t size, loff_t pos);
static ssize_t sock_aio_write(struct kiocb *iocb, char *buf,
size_t size, loff_t pos);
static int sock_mmap(struct file *file, struct vm_area_struct * vma);
static int sock_close(struct inode *inode, struct file *file);
......@@ -117,8 +117,8 @@ static ssize_t sock_sendpage(struct file *file, struct page *page,
static struct file_operations socket_file_ops = {
.llseek = no_llseek,
.read = sock_read,
.write = sock_write,
.aio_read = sock_aio_read,
.aio_write = sock_aio_write,
.poll = sock_poll,
.ioctl = sock_ioctl,
.mmap = sock_mmap,
......@@ -517,64 +517,100 @@ void sock_release(struct socket *sock)
sock->file=NULL;
}
int sock_sendmsg(struct socket *sock, struct msghdr *msg, int size)
static int __sock_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, int size)
{
struct sock_iocb *si = kiocb_to_siocb(iocb);
int err;
struct scm_cookie scm;
err = scm_send(sock, msg, &scm);
si->scm = &si->async_scm;
si->sock = sock;
si->msg = msg;
si->size = size;
err = scm_send(sock, msg, si->scm);
if (err >= 0) {
err = sock->ops->sendmsg(sock, msg, size, &scm);
scm_destroy(&scm);
err = sock->ops->sendmsg(iocb, sock, msg, size, si->scm);
if (-EIOCBQUEUED != err)
scm_destroy(si->scm);
}
return err;
}
int sock_recvmsg(struct socket *sock, struct msghdr *msg, int size, int flags)
int sock_sendmsg(struct socket *sock, struct msghdr *msg, int size)
{
struct kiocb iocb;
int ret;
init_sync_kiocb(&iocb, NULL);
ret = __sock_sendmsg(&iocb, sock, msg, size);
if (-EIOCBQUEUED == ret)
ret = wait_on_sync_kiocb(&iocb);
return ret;
}
int __sock_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, int size, int flags)
{
struct scm_cookie scm;
struct sock_iocb *si = kiocb_to_siocb(iocb);
memset(&scm, 0, sizeof(scm));
si->sock = sock;
si->scm = &si->async_scm;
si->sock = sock;
si->msg = msg;
si->size = size;
si->flags = flags;
size = sock->ops->recvmsg(sock, msg, size, flags, &scm);
memset(si->scm, 0, sizeof(*si->scm));
size = sock->ops->recvmsg(iocb, sock, msg, size, flags, si->scm);
if (size >= 0)
scm_recv(sock, msg, &scm, flags);
scm_recv(sock, msg, si->scm, flags);
return size;
}
int sock_recvmsg(struct socket *sock, struct msghdr *msg, int size, int flags)
{
struct kiocb iocb;
int ret;
init_sync_kiocb(&iocb, NULL);
ret = __sock_recvmsg(&iocb, sock, msg, size, flags);
if (-EIOCBQUEUED == ret)
ret = wait_on_sync_kiocb(&iocb);
return ret;
}
/*
* Read data from a socket. ubuf is a user mode pointer. We make sure the user
* area ubuf...ubuf+size-1 is writable before asking the protocol.
*/
static ssize_t sock_read(struct file *file, char *ubuf,
size_t size, loff_t *ppos)
static ssize_t sock_aio_read(struct kiocb *iocb, char *ubuf,
size_t size, loff_t pos)
{
struct sock_iocb *x = kiocb_to_siocb(iocb);
struct socket *sock;
struct iovec iov;
struct msghdr msg;
int flags;
if (ppos != &file->f_pos)
if (pos != 0)
return -ESPIPE;
if (size==0) /* Match SYS5 behaviour */
return 0;
sock = SOCKET_I(file->f_dentry->d_inode);
sock = SOCKET_I(iocb->ki_filp->f_dentry->d_inode);
msg.msg_name=NULL;
msg.msg_namelen=0;
msg.msg_iov=&iov;
msg.msg_iovlen=1;
msg.msg_control=NULL;
msg.msg_controllen=0;
iov.iov_base=ubuf;
iov.iov_len=size;
flags = !(file->f_flags & O_NONBLOCK) ? 0 : MSG_DONTWAIT;
x->async_msg.msg_name = NULL;
x->async_msg.msg_namelen = 0;
x->async_msg.msg_iov = &x->async_iov;
x->async_msg.msg_iovlen = 1;
x->async_msg.msg_control = NULL;
x->async_msg.msg_controllen = 0;
x->async_iov.iov_base = ubuf;
x->async_iov.iov_len = size;
flags = !(iocb->ki_filp->f_flags & O_NONBLOCK) ? 0 : MSG_DONTWAIT;
return sock_recvmsg(sock, &msg, size, flags);
return __sock_recvmsg(iocb, sock, &x->async_msg, size, flags);
}
......@@ -583,33 +619,32 @@ static ssize_t sock_read(struct file *file, char *ubuf,
* is readable by the user process.
*/
static ssize_t sock_write(struct file *file, const char *ubuf,
size_t size, loff_t *ppos)
static ssize_t sock_aio_write(struct kiocb *iocb, char *ubuf,
size_t size, loff_t pos)
{
struct sock_iocb *x = kiocb_to_siocb(iocb);
struct socket *sock;
struct msghdr msg;
struct iovec iov;
if (ppos != &file->f_pos)
if (pos != 0)
return -ESPIPE;
if(size==0) /* Match SYS5 behaviour */
return 0;
sock = SOCKET_I(file->f_dentry->d_inode);
sock = SOCKET_I(iocb->ki_filp->f_dentry->d_inode);
msg.msg_name=NULL;
msg.msg_namelen=0;
msg.msg_iov=&iov;
msg.msg_iovlen=1;
msg.msg_control=NULL;
msg.msg_controllen=0;
msg.msg_flags=!(file->f_flags & O_NONBLOCK) ? 0 : MSG_DONTWAIT;
x->async_msg.msg_name = NULL;
x->async_msg.msg_namelen = 0;
x->async_msg.msg_iov = &x->async_iov;
x->async_msg.msg_iovlen = 1;
x->async_msg.msg_control = NULL;
x->async_msg.msg_controllen = 0;
x->async_msg.msg_flags = !(iocb->ki_filp->f_flags & O_NONBLOCK) ? 0 : MSG_DONTWAIT;
if (sock->type == SOCK_SEQPACKET)
msg.msg_flags |= MSG_EOR;
iov.iov_base=(void *)ubuf;
iov.iov_len=size;
x->async_msg.msg_flags |= MSG_EOR;
x->async_iov.iov_base = (void *)ubuf;
x->async_iov.iov_len = size;
return sock_sendmsg(sock, &msg, size);
return __sock_sendmsg(iocb, sock, &x->async_msg, size);
}
ssize_t sock_sendpage(struct file *file, struct page *page,
......
......@@ -1175,7 +1175,8 @@ static void unix_attach_fds(struct scm_cookie *scm, struct sk_buff *skb)
* Send AF_UNIX data.
*/
static int unix_dgram_sendmsg(struct socket *sock, struct msghdr *msg, int len,
static int unix_dgram_sendmsg(struct kiocb *iocb, struct socket *sock,
struct msghdr *msg, int len,
struct scm_cookie *scm)
{
struct sock *sk = sock->sk;
......@@ -1307,7 +1308,8 @@ static int unix_dgram_sendmsg(struct socket *sock, struct msghdr *msg, int len,
}
static int unix_stream_sendmsg(struct socket *sock, struct msghdr *msg, int len,
static int unix_stream_sendmsg(struct kiocb *iocb, struct socket *sock,
struct msghdr *msg, int len,
struct scm_cookie *scm)
{
struct sock *sk = sock->sk;
......@@ -1415,7 +1417,8 @@ static void unix_copy_addr(struct msghdr *msg, struct sock *sk)
}
}
static int unix_dgram_recvmsg(struct socket *sock, struct msghdr *msg, int size,
static int unix_dgram_recvmsg(struct kiocb *iocb, struct socket *sock,
struct msghdr *msg, int size,
int flags, struct scm_cookie *scm)
{
struct sock *sk = sock->sk;
......@@ -1517,7 +1520,8 @@ static long unix_stream_data_wait(unix_socket * sk, long timeo)
static int unix_stream_recvmsg(struct socket *sock, struct msghdr *msg, int size,
static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock,
struct msghdr *msg, int size,
int flags, struct scm_cookie *scm)
{
struct sock *sk = sock->sk;
......
......@@ -540,8 +540,8 @@ static struct sock *wanpipe_alloc_socket(void)
* a packet is queued into sk->write_queue.
*===========================================================*/
static int wanpipe_sendmsg(struct socket *sock, struct msghdr *msg, int len,
struct scm_cookie *scm)
static int wanpipe_sendmsg(struct kiocb *iocb, struct socket *sock,
struct msghdr *msg, int len, struct scm_cookie *scm)
{
wanpipe_opt *wp;
struct sock *sk = sock->sk;
......@@ -1647,8 +1647,9 @@ static int wanpipe_create(struct socket *sock, int protocol)
* to the user. If necessary we block.
*===========================================================*/
static int wanpipe_recvmsg(struct socket *sock, struct msghdr *msg, int len,
int flags, struct scm_cookie *scm)
static int wanpipe_recvmsg(struct kiocb *iocb, struct socket *sock,
struct msghdr *msg, int len, int flags,
struct scm_cookie *scm)
{
struct sock *sk = sock->sk;
struct sk_buff *skb;
......
......@@ -916,8 +916,8 @@ int x25_rx_call_request(struct sk_buff *skb, struct x25_neigh *nb,
goto out;
}
static int x25_sendmsg(struct socket *sock, struct msghdr *msg, int len,
struct scm_cookie *scm)
static int x25_sendmsg(struct kiocb *iocb, struct socket *sock,
struct msghdr *msg, int len, struct scm_cookie *scm)
{
struct sock *sk = sock->sk;
struct x25_opt *x25 = x25_sk(sk);
......@@ -1091,7 +1091,8 @@ static int x25_sendmsg(struct socket *sock, struct msghdr *msg, int len,
}
static int x25_recvmsg(struct socket *sock, struct msghdr *msg, int size,
static int x25_recvmsg(struct kiocb *iocb, struct socket *sock,
struct msghdr *msg, int size,
int flags, struct scm_cookie *scm)
{
struct sock *sk = sock->sk;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment