mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-10 11:59:48 +00:00
SUNRPC/NFS: make rpc pipe upcall generic
commit c1225158a8 upstream.
The same function is used by idmap, gss and blocklayout code. Make it
generic.
Signed-off-by: Peng Tao <peng_tao@emc.com>
Signed-off-by: Jim Rees <rees@umich.edu>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
ddd5310cb9
commit
53e34d2425
@@ -77,6 +77,26 @@ rpc_timeout_upcall_queue(struct work_struct *work)
|
||||
rpc_purge_list(rpci, &free_list, destroy_msg, -ETIMEDOUT);
|
||||
}
|
||||
|
||||
ssize_t rpc_pipe_generic_upcall(struct file *filp, struct rpc_pipe_msg *msg,
|
||||
char __user *dst, size_t buflen)
|
||||
{
|
||||
char *data = (char *)msg->data + msg->copied;
|
||||
size_t mlen = min(msg->len - msg->copied, buflen);
|
||||
unsigned long left;
|
||||
|
||||
left = copy_to_user(dst, data, mlen);
|
||||
if (left == mlen) {
|
||||
msg->errno = -EFAULT;
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
mlen -= left;
|
||||
msg->copied += mlen;
|
||||
msg->errno = 0;
|
||||
return mlen;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(rpc_pipe_generic_upcall);
|
||||
|
||||
/**
|
||||
* rpc_queue_upcall - queue an upcall message to userspace
|
||||
* @inode: inode of upcall pipe on which to queue given message
|
||||
|
||||
Reference in New Issue
Block a user