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,
{
struct rxrpc_connection *conn;
struct rxrpc_call *call;
struct iovec piov[2];
struct kvec piov[2];
size_t sent;
int ret;
u32 param[1];
......@@ -189,7 +189,7 @@ int afs_rxfs_get_volume_info(struct afs_server *server,
{
struct rxrpc_connection *conn;
struct rxrpc_call *call;
struct iovec piov[3];
struct kvec piov[3];
size_t sent;
int ret;
u32 param[2], *bp, zero;
......@@ -304,7 +304,7 @@ int afs_rxfs_fetch_file_status(struct afs_server *server,
{
struct afs_server_callslot callslot;
struct rxrpc_call *call;
struct iovec piov[1];
struct kvec piov[1];
size_t sent;
int ret;
u32 *bp;
......@@ -429,7 +429,7 @@ int afs_rxfs_fetch_file_data(struct afs_server *server,
{
struct afs_server_callslot callslot;
struct rxrpc_call *call;
struct iovec piov[1];
struct kvec piov[1];
size_t sent;
int ret;
u32 *bp;
......@@ -580,7 +580,7 @@ int afs_rxfs_give_up_callback(struct afs_server *server,
{
struct afs_server_callslot callslot;
struct rxrpc_call *call;
struct iovec piov[1];
struct kvec piov[1];
size_t sent;
int ret;
u32 *bp;
......@@ -686,7 +686,7 @@ int afs_rxfs_lookup(struct afs_server *server,
{
struct rxrpc_connection *conn;
struct rxrpc_call *call;
struct iovec piov[3];
struct kvec piov[3];
size_t sent;
int ret;
u32 *bp, zero;
......
......@@ -182,7 +182,7 @@ static struct vfsmount *afs_mntpt_do_automount(struct dentry *mntpt)
goto error;
/* 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);
if (IS_ERR(page)) {
......
......@@ -97,7 +97,7 @@ int afs_rxvl_probe(struct afs_server *server, int alloc_flags)
{
struct rxrpc_connection *conn;
struct rxrpc_call *call;
struct iovec piov[1];
struct kvec piov[1];
size_t sent;
int ret;
u32 param[1];
......@@ -187,7 +187,7 @@ int afs_rxvl_get_entry_by_name(struct afs_server *server,
struct rxrpc_connection *conn;
struct rxrpc_call *call;
struct iovec piov[3];
struct kvec piov[3];
unsigned tmp;
size_t sent;
int ret, loop;
......@@ -322,7 +322,7 @@ int afs_rxvl_get_entry_by_id(struct afs_server *server,
struct rxrpc_connection *conn;
struct rxrpc_call *call;
struct iovec piov[1];
struct kvec piov[1];
unsigned tmp;
size_t sent;
int ret, loop;
......@@ -459,7 +459,7 @@ int afs_rxvl_get_entry_by_id_async(struct afs_async_op *op,
{
struct rxrpc_connection *conn;
struct rxrpc_call *call;
struct iovec piov[1];
struct kvec piov[1];
size_t sent;
int ret;
u32 param[3];
......
......@@ -12,11 +12,6 @@
#include <linux/module.h>
#include <linux/uio.h>
struct kvec {
void *iov_base; /* and that should *never* hold a userland pointer */
size_t iov_len;
};
#endif /* __KERNEL__ */
struct erase_info_user {
......
......@@ -23,6 +23,15 @@ struct iovec
__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)
*/
......
......@@ -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,
size_t sioc,
struct iovec siov[],
struct kvec *siov,
uint8_t rxhdr_flags,
int alloc_flags,
int dup_data,
......
......@@ -44,7 +44,7 @@ struct rxrpc_message
int dcount; /* data part count */
size_t dsize; /* data size */
#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 */
};
......@@ -62,7 +62,7 @@ extern int rxrpc_conn_newmsg(struct rxrpc_connection *conn,
struct rxrpc_call *call,
uint8_t type,
int count,
struct iovec diov[],
struct kvec *diov,
int alloc_flags,
struct rxrpc_message **_msg);
......
......@@ -471,7 +471,7 @@ static inline int __rxrpc_call_gen_normal_ACK(struct rxrpc_call *call,
rxrpc_seq_t seq)
{
struct rxrpc_message *msg;
struct iovec diov[3];
struct kvec diov[3];
unsigned aux[4];
int delta, ret;
......@@ -717,7 +717,7 @@ static int rxrpc_call_generate_ACK(struct rxrpc_call *call,
/* send a special ACK if one is required */
if (special_ACK) {
struct rxrpc_ackpacket ack;
struct iovec diov[2];
struct kvec diov[2];
uint8_t acks[1] = { RXRPC_ACK_TYPE_ACK };
/* fill out the appropriate form */
......@@ -838,7 +838,7 @@ static int __rxrpc_call_abort(struct rxrpc_call *call, int errno)
{
struct rxrpc_connection *conn = call->conn;
struct rxrpc_message *msg;
struct iovec diov[1];
struct kvec diov[1];
int ret;
u32 _error;
......@@ -1919,14 +1919,14 @@ int rxrpc_call_read_data(struct rxrpc_call *call,
*/
int rxrpc_call_write_data(struct rxrpc_call *call,
size_t sioc,
struct iovec siov[],
struct kvec *siov,
u8 rxhdr_flags,
int alloc_flags,
int dup_data,
size_t *size_sent)
{
struct rxrpc_message *msg;
struct iovec *sptr;
struct kvec *sptr;
size_t space, size, chunk, tmp;
char *buf;
int ret;
......
......@@ -518,7 +518,7 @@ int rxrpc_conn_newmsg(struct rxrpc_connection *conn,
struct rxrpc_call *call,
uint8_t type,
int dcount,
struct iovec diov[],
struct kvec diov[],
int alloc_flags,
struct rxrpc_message **_msg)
{
......@@ -634,7 +634,11 @@ int rxrpc_conn_sendmsg(struct rxrpc_connection *conn,
/* set up the message to be transmitted */
msghdr.msg_name = &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_control = NULL;
msghdr.msg_controllen = 0;
......
......@@ -611,7 +611,7 @@ int rxrpc_trans_immediate_abort(struct rxrpc_transport *trans,
struct rxrpc_header ahdr;
struct sockaddr_in sin;
struct msghdr msghdr;
struct iovec iov[2];
struct kvec iov[2];
mm_segment_t oldfs;
uint32_t _error;
int len, ret;
......@@ -649,7 +649,11 @@ int rxrpc_trans_immediate_abort(struct rxrpc_transport *trans,
msghdr.msg_name = &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_control = NULL;
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