aboutsummaryrefslogtreecommitdiffstats
path: root/fs/relayfs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/relayfs')
-rw-r--r--fs/relayfs/inode.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/fs/relayfs/inode.c b/fs/relayfs/inode.c
index b2f50655736b..7f6d2c8e91c2 100644
--- a/fs/relayfs/inode.c
+++ b/fs/relayfs/inode.c
@@ -54,7 +54,8 @@ static struct inode *relayfs_get_inode(struct super_block *sb,
54 switch (mode & S_IFMT) { 54 switch (mode & S_IFMT) {
55 case S_IFREG: 55 case S_IFREG:
56 inode->i_fop = fops; 56 inode->i_fop = fops;
57 RELAYFS_I(inode)->data = data; 57 if (data)
58 inode->u.generic_ip = data;
58 break; 59 break;
59 case S_IFDIR: 60 case S_IFDIR:
60 inode->i_op = &simple_dir_inode_operations; 61 inode->i_op = &simple_dir_inode_operations;
@@ -255,8 +256,9 @@ int relayfs_remove_dir(struct dentry *dentry)
255 */ 256 */
256static int relayfs_open(struct inode *inode, struct file *filp) 257static int relayfs_open(struct inode *inode, struct file *filp)
257{ 258{
258 struct rchan_buf *buf = RELAYFS_I(inode)->data; 259 struct rchan_buf *buf = inode->u.generic_ip;
259 kref_get(&buf->kref); 260 kref_get(&buf->kref);
261 filp->private_data = buf;
260 262
261 return 0; 263 return 0;
262} 264}
@@ -270,8 +272,8 @@ static int relayfs_open(struct inode *inode, struct file *filp)
270 */ 272 */
271static int relayfs_mmap(struct file *filp, struct vm_area_struct *vma) 273static int relayfs_mmap(struct file *filp, struct vm_area_struct *vma)
272{ 274{
273 struct inode *inode = filp->f_dentry->d_inode; 275 struct rchan_buf *buf = filp->private_data;
274 return relay_mmap_buf(RELAYFS_I(inode)->data, vma); 276 return relay_mmap_buf(buf, vma);
275} 277}
276 278
277/** 279/**
@@ -284,8 +286,7 @@ static int relayfs_mmap(struct file *filp, struct vm_area_struct *vma)
284static unsigned int relayfs_poll(struct file *filp, poll_table *wait) 286static unsigned int relayfs_poll(struct file *filp, poll_table *wait)
285{ 287{
286 unsigned int mask = 0; 288 unsigned int mask = 0;
287 struct inode *inode = filp->f_dentry->d_inode; 289 struct rchan_buf *buf = filp->private_data;
288 struct rchan_buf *buf = RELAYFS_I(inode)->data;
289 290
290 if (buf->finalized) 291 if (buf->finalized)
291 return POLLERR; 292 return POLLERR;
@@ -309,7 +310,7 @@ static unsigned int relayfs_poll(struct file *filp, poll_table *wait)
309 */ 310 */
310static int relayfs_release(struct inode *inode, struct file *filp) 311static int relayfs_release(struct inode *inode, struct file *filp)
311{ 312{
312 struct rchan_buf *buf = RELAYFS_I(inode)->data; 313 struct rchan_buf *buf = filp->private_data;
313 kref_put(&buf->kref, relay_remove_buf); 314 kref_put(&buf->kref, relay_remove_buf);
314 315
315 return 0; 316 return 0;
@@ -470,8 +471,8 @@ static ssize_t relayfs_read(struct file *filp,
470 size_t count, 471 size_t count,
471 loff_t *ppos) 472 loff_t *ppos)
472{ 473{
474 struct rchan_buf *buf = filp->private_data;
473 struct inode *inode = filp->f_dentry->d_inode; 475 struct inode *inode = filp->f_dentry->d_inode;
474 struct rchan_buf *buf = RELAYFS_I(inode)->data;
475 size_t read_start, avail; 476 size_t read_start, avail;
476 ssize_t ret = 0; 477 ssize_t ret = 0;
477 void *from; 478 void *from;