Commit 7b091e02 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] sparse: switching afs to kvec

 - afs and rxrpc switched to kvec; definition of kvec moved to uio.h (duh).
 - afs/mntpt.c got missing cast added.

at that point afs is sparse-clean and rxrpc has only one remaining warning
(setsockopt from local variable, protected by set_fs()).
parent 0c4fb9bf
...@@ -59,7 +59,7 @@ int afs_rxfs_get_root_volume(struct afs_server *server, ...@@ -59,7 +59,7 @@ int afs_rxfs_get_root_volume(struct afs_server *server,
{ {
struct rxrpc_connection *conn; struct rxrpc_connection *conn;
struct rxrpc_call *call; struct rxrpc_call *call;
struct iovec piov[2]; struct kvec piov[2];
size_t sent; size_t sent;
int ret; int ret;
u32 param[1]; u32 param[1];
...@@ -189,7 +189,7 @@ int afs_rxfs_get_volume_info(struct afs_server *server, ...@@ -189,7 +189,7 @@ int afs_rxfs_get_volume_info(struct afs_server *server,
{ {
struct rxrpc_connection *conn; struct rxrpc_connection *conn;
struct rxrpc_call *call; struct rxrpc_call *call;
struct iovec piov[3]; struct kvec piov[3];
size_t sent; size_t sent;
int ret; int ret;
u32 param[2], *bp, zero; u32 param[2], *bp, zero;
...@@ -304,7 +304,7 @@ int afs_rxfs_fetch_file_status(struct afs_server *server, ...@@ -304,7 +304,7 @@ int afs_rxfs_fetch_file_status(struct afs_server *server,
{ {
struct afs_server_callslot callslot; struct afs_server_callslot callslot;
struct rxrpc_call *call; struct rxrpc_call *call;
struct iovec piov[1]; struct kvec piov[1];
size_t sent; size_t sent;
int ret; int ret;
u32 *bp; u32 *bp;
...@@ -429,7 +429,7 @@ int afs_rxfs_fetch_file_data(struct afs_server *server, ...@@ -429,7 +429,7 @@ int afs_rxfs_fetch_file_data(struct afs_server *server,
{ {
struct afs_server_callslot callslot; struct afs_server_callslot callslot;
struct rxrpc_call *call; struct rxrpc_call *call;
struct iovec piov[1]; struct kvec piov[1];
size_t sent; size_t sent;
int ret; int ret;
u32 *bp; u32 *bp;
...@@ -580,7 +580,7 @@ int afs_rxfs_give_up_callback(struct afs_server *server, ...@@ -580,7 +580,7 @@ int afs_rxfs_give_up_callback(struct afs_server *server,
{ {
struct afs_server_callslot callslot; struct afs_server_callslot callslot;
struct rxrpc_call *call; struct rxrpc_call *call;
struct iovec piov[1]; struct kvec piov[1];
size_t sent; size_t sent;
int ret; int ret;
u32 *bp; u32 *bp;
...@@ -686,7 +686,7 @@ int afs_rxfs_lookup(struct afs_server *server, ...@@ -686,7 +686,7 @@ int afs_rxfs_lookup(struct afs_server *server,
{ {
struct rxrpc_connection *conn; struct rxrpc_connection *conn;
struct rxrpc_call *call; struct rxrpc_call *call;
struct iovec piov[3]; struct kvec piov[3];
size_t sent; size_t sent;
int ret; int ret;
u32 *bp, zero; u32 *bp, zero;
......
...@@ -182,7 +182,7 @@ static struct vfsmount *afs_mntpt_do_automount(struct dentry *mntpt) ...@@ -182,7 +182,7 @@ static struct vfsmount *afs_mntpt_do_automount(struct dentry *mntpt)
goto error; goto error;
/* read the contents of the AFS special symlink */ /* read the contents of the AFS special symlink */
filler = mntpt->d_inode->i_mapping->a_ops->readpage; filler = (filler_t *)mntpt->d_inode->i_mapping->a_ops->readpage;
page = read_cache_page(mntpt->d_inode->i_mapping, 0, filler, NULL); page = read_cache_page(mntpt->d_inode->i_mapping, 0, filler, NULL);
if (IS_ERR(page)) { if (IS_ERR(page)) {
......
...@@ -97,7 +97,7 @@ int afs_rxvl_probe(struct afs_server *server, int alloc_flags) ...@@ -97,7 +97,7 @@ int afs_rxvl_probe(struct afs_server *server, int alloc_flags)
{ {
struct rxrpc_connection *conn; struct rxrpc_connection *conn;
struct rxrpc_call *call; struct rxrpc_call *call;
struct iovec piov[1]; struct kvec piov[1];
size_t sent; size_t sent;
int ret; int ret;
u32 param[1]; u32 param[1];
...@@ -187,7 +187,7 @@ int afs_rxvl_get_entry_by_name(struct afs_server *server, ...@@ -187,7 +187,7 @@ int afs_rxvl_get_entry_by_name(struct afs_server *server,
struct rxrpc_connection *conn; struct rxrpc_connection *conn;
struct rxrpc_call *call; struct rxrpc_call *call;
struct iovec piov[3]; struct kvec piov[3];
unsigned tmp; unsigned tmp;
size_t sent; size_t sent;
int ret, loop; int ret, loop;
...@@ -322,7 +322,7 @@ int afs_rxvl_get_entry_by_id(struct afs_server *server, ...@@ -322,7 +322,7 @@ int afs_rxvl_get_entry_by_id(struct afs_server *server,
struct rxrpc_connection *conn; struct rxrpc_connection *conn;
struct rxrpc_call *call; struct rxrpc_call *call;
struct iovec piov[1]; struct kvec piov[1];
unsigned tmp; unsigned tmp;
size_t sent; size_t sent;
int ret, loop; int ret, loop;
...@@ -459,7 +459,7 @@ int afs_rxvl_get_entry_by_id_async(struct afs_async_op *op, ...@@ -459,7 +459,7 @@ int afs_rxvl_get_entry_by_id_async(struct afs_async_op *op,
{ {
struct rxrpc_connection *conn; struct rxrpc_connection *conn;
struct rxrpc_call *call; struct rxrpc_call *call;
struct iovec piov[1]; struct kvec piov[1];
size_t sent; size_t sent;
int ret; int ret;
u32 param[3]; u32 param[3];
......
...@@ -12,11 +12,6 @@ ...@@ -12,11 +12,6 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/uio.h> #include <linux/uio.h>
struct kvec {
void *iov_base; /* and that should *never* hold a userland pointer */
size_t iov_len;
};
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
struct erase_info_user { struct erase_info_user {
......
...@@ -23,6 +23,15 @@ struct iovec ...@@ -23,6 +23,15 @@ struct iovec
__kernel_size_t iov_len; /* Must be size_t (1003.1g) */ __kernel_size_t iov_len; /* Must be size_t (1003.1g) */
}; };
#ifdef __KERNEL__
struct kvec {
void *iov_base; /* and that should *never* hold a userland pointer */
size_t iov_len;
};
#endif
/* /*
* UIO_MAXIOV shall be at least 16 1003.1g (5.4.1.1) * UIO_MAXIOV shall be at least 16 1003.1g (5.4.1.1)
*/ */
......
...@@ -204,7 +204,7 @@ extern int rxrpc_call_read_data(struct rxrpc_call *call, void *buffer, size_t si ...@@ -204,7 +204,7 @@ extern int rxrpc_call_read_data(struct rxrpc_call *call, void *buffer, size_t si
extern int rxrpc_call_write_data(struct rxrpc_call *call, extern int rxrpc_call_write_data(struct rxrpc_call *call,
size_t sioc, size_t sioc,
struct iovec siov[], struct kvec *siov,
uint8_t rxhdr_flags, uint8_t rxhdr_flags,
int alloc_flags, int alloc_flags,
int dup_data, int dup_data,
......
...@@ -44,7 +44,7 @@ struct rxrpc_message ...@@ -44,7 +44,7 @@ struct rxrpc_message
int dcount; /* data part count */ int dcount; /* data part count */
size_t dsize; /* data size */ size_t dsize; /* data size */
#define RXRPC_MSG_MAX_IOCS 8 #define RXRPC_MSG_MAX_IOCS 8
struct iovec data[RXRPC_MSG_MAX_IOCS]; /* message data */ struct kvec data[RXRPC_MSG_MAX_IOCS]; /* message data */
unsigned long dfree; /* bit mask indicating kfree(data[x]) if T */ unsigned long dfree; /* bit mask indicating kfree(data[x]) if T */
}; };
...@@ -62,7 +62,7 @@ extern int rxrpc_conn_newmsg(struct rxrpc_connection *conn, ...@@ -62,7 +62,7 @@ extern int rxrpc_conn_newmsg(struct rxrpc_connection *conn,
struct rxrpc_call *call, struct rxrpc_call *call,
uint8_t type, uint8_t type,
int count, int count,
struct iovec diov[], struct kvec *diov,
int alloc_flags, int alloc_flags,
struct rxrpc_message **_msg); struct rxrpc_message **_msg);
......
...@@ -471,7 +471,7 @@ static inline int __rxrpc_call_gen_normal_ACK(struct rxrpc_call *call, ...@@ -471,7 +471,7 @@ static inline int __rxrpc_call_gen_normal_ACK(struct rxrpc_call *call,
rxrpc_seq_t seq) rxrpc_seq_t seq)
{ {
struct rxrpc_message *msg; struct rxrpc_message *msg;
struct iovec diov[3]; struct kvec diov[3];
unsigned aux[4]; unsigned aux[4];
int delta, ret; int delta, ret;
...@@ -717,7 +717,7 @@ static int rxrpc_call_generate_ACK(struct rxrpc_call *call, ...@@ -717,7 +717,7 @@ static int rxrpc_call_generate_ACK(struct rxrpc_call *call,
/* send a special ACK if one is required */ /* send a special ACK if one is required */
if (special_ACK) { if (special_ACK) {
struct rxrpc_ackpacket ack; struct rxrpc_ackpacket ack;
struct iovec diov[2]; struct kvec diov[2];
uint8_t acks[1] = { RXRPC_ACK_TYPE_ACK }; uint8_t acks[1] = { RXRPC_ACK_TYPE_ACK };
/* fill out the appropriate form */ /* fill out the appropriate form */
...@@ -838,7 +838,7 @@ static int __rxrpc_call_abort(struct rxrpc_call *call, int errno) ...@@ -838,7 +838,7 @@ static int __rxrpc_call_abort(struct rxrpc_call *call, int errno)
{ {
struct rxrpc_connection *conn = call->conn; struct rxrpc_connection *conn = call->conn;
struct rxrpc_message *msg; struct rxrpc_message *msg;
struct iovec diov[1]; struct kvec diov[1];
int ret; int ret;
u32 _error; u32 _error;
...@@ -1919,14 +1919,14 @@ int rxrpc_call_read_data(struct rxrpc_call *call, ...@@ -1919,14 +1919,14 @@ int rxrpc_call_read_data(struct rxrpc_call *call,
*/ */
int rxrpc_call_write_data(struct rxrpc_call *call, int rxrpc_call_write_data(struct rxrpc_call *call,
size_t sioc, size_t sioc,
struct iovec siov[], struct kvec *siov,
u8 rxhdr_flags, u8 rxhdr_flags,
int alloc_flags, int alloc_flags,
int dup_data, int dup_data,
size_t *size_sent) size_t *size_sent)
{ {
struct rxrpc_message *msg; struct rxrpc_message *msg;
struct iovec *sptr; struct kvec *sptr;
size_t space, size, chunk, tmp; size_t space, size, chunk, tmp;
char *buf; char *buf;
int ret; int ret;
......
...@@ -518,7 +518,7 @@ int rxrpc_conn_newmsg(struct rxrpc_connection *conn, ...@@ -518,7 +518,7 @@ int rxrpc_conn_newmsg(struct rxrpc_connection *conn,
struct rxrpc_call *call, struct rxrpc_call *call,
uint8_t type, uint8_t type,
int dcount, int dcount,
struct iovec diov[], struct kvec diov[],
int alloc_flags, int alloc_flags,
struct rxrpc_message **_msg) struct rxrpc_message **_msg)
{ {
...@@ -634,7 +634,11 @@ int rxrpc_conn_sendmsg(struct rxrpc_connection *conn, ...@@ -634,7 +634,11 @@ int rxrpc_conn_sendmsg(struct rxrpc_connection *conn,
/* set up the message to be transmitted */ /* set up the message to be transmitted */
msghdr.msg_name = &conn->addr; msghdr.msg_name = &conn->addr;
msghdr.msg_namelen = sizeof(conn->addr); msghdr.msg_namelen = sizeof(conn->addr);
msghdr.msg_iov = msg->data; /*
* the following is safe, since for compiler definitions of kvec and
* iovec are identical, yielding the same in-core layout and alignment
*/
msghdr.msg_iov = (struct iovec *)msg->data;
msghdr.msg_iovlen = msg->dcount; msghdr.msg_iovlen = msg->dcount;
msghdr.msg_control = NULL; msghdr.msg_control = NULL;
msghdr.msg_controllen = 0; msghdr.msg_controllen = 0;
......
...@@ -611,7 +611,7 @@ int rxrpc_trans_immediate_abort(struct rxrpc_transport *trans, ...@@ -611,7 +611,7 @@ int rxrpc_trans_immediate_abort(struct rxrpc_transport *trans,
struct rxrpc_header ahdr; struct rxrpc_header ahdr;
struct sockaddr_in sin; struct sockaddr_in sin;
struct msghdr msghdr; struct msghdr msghdr;
struct iovec iov[2]; struct kvec iov[2];
mm_segment_t oldfs; mm_segment_t oldfs;
uint32_t _error; uint32_t _error;
int len, ret; int len, ret;
...@@ -649,7 +649,11 @@ int rxrpc_trans_immediate_abort(struct rxrpc_transport *trans, ...@@ -649,7 +649,11 @@ int rxrpc_trans_immediate_abort(struct rxrpc_transport *trans,
msghdr.msg_name = &sin; msghdr.msg_name = &sin;
msghdr.msg_namelen = sizeof(sin); msghdr.msg_namelen = sizeof(sin);
msghdr.msg_iov = iov; /*
* the following is safe, since for compiler definitions of kvec and
* iovec are identical, yielding the same in-core layout and alignment
*/
msghdr.msg_iov = (struct iovec *)iov;
msghdr.msg_iovlen = 2; msghdr.msg_iovlen = 2;
msghdr.msg_control = NULL; msghdr.msg_control = NULL;
msghdr.msg_controllen = 0; msghdr.msg_controllen = 0;
......
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