aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/rpc_pipe.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/sunrpc/rpc_pipe.c')
-rw-r--r--net/sunrpc/rpc_pipe.c34
1 files changed, 27 insertions, 7 deletions
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
index 72bc5368396..67dbc188438 100644
--- a/net/sunrpc/rpc_pipe.c
+++ b/net/sunrpc/rpc_pipe.c
@@ -77,6 +77,26 @@ rpc_timeout_upcall_queue(struct work_struct *work)
77 rpc_purge_list(rpci, &free_list, destroy_msg, -ETIMEDOUT); 77 rpc_purge_list(rpci, &free_list, destroy_msg, -ETIMEDOUT);
78} 78}
79 79
80ssize_t rpc_pipe_generic_upcall(struct file *filp, struct rpc_pipe_msg *msg,
81 char __user *dst, size_t buflen)
82{
83 char *data = (char *)msg->data + msg->copied;
84 size_t mlen = min(msg->len - msg->copied, buflen);
85 unsigned long left;
86
87 left = copy_to_user(dst, data, mlen);
88 if (left == mlen) {
89 msg->errno = -EFAULT;
90 return -EFAULT;
91 }
92
93 mlen -= left;
94 msg->copied += mlen;
95 msg->errno = 0;
96 return mlen;
97}
98EXPORT_SYMBOL_GPL(rpc_pipe_generic_upcall);
99
80/** 100/**
81 * rpc_queue_upcall - queue an upcall message to userspace 101 * rpc_queue_upcall - queue an upcall message to userspace
82 * @inode: inode of upcall pipe on which to queue given message 102 * @inode: inode of upcall pipe on which to queue given message
@@ -456,13 +476,13 @@ rpc_get_inode(struct super_block *sb, umode_t mode)
456 inode->i_ino = get_next_ino(); 476 inode->i_ino = get_next_ino();
457 inode->i_mode = mode; 477 inode->i_mode = mode;
458 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; 478 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
459 switch(mode & S_IFMT) { 479 switch (mode & S_IFMT) {
460 case S_IFDIR: 480 case S_IFDIR:
461 inode->i_fop = &simple_dir_operations; 481 inode->i_fop = &simple_dir_operations;
462 inode->i_op = &simple_dir_inode_operations; 482 inode->i_op = &simple_dir_inode_operations;
463 inc_nlink(inode); 483 inc_nlink(inode);
464 default: 484 default:
465 break; 485 break;
466 } 486 }
467 return inode; 487 return inode;
468} 488}