aboutsummaryrefslogtreecommitdiffstats
path: root/fs/relayfs/inode.c
diff options
context:
space:
mode:
authorTom Zanussi <zanussi@us.ibm.com>2006-01-08 04:02:26 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-08 23:13:49 -0500
commit51008f9f95a4c3158151a75f88fb03fb0f646aba (patch)
treec4028f7562b36c5e02f40f020a47ae663e21f7cf /fs/relayfs/inode.c
parent7431733791feb0b19453d8047b0723c744667040 (diff)
[PATCH] relayfs: use generic_ip for private data
Use inode->u.generic_ip instead of relayfs_inode_info to store pointer to user data. Clients using relayfs_file_create() to create their own files would probably more expect their data to be stored in generic_ip; we also intend in the next set of patches to get rid of relayfs-specific stuff in the file operations, so we might as well do it here. Signed-off-by: Tom Zanussi <zanussi@us.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/relayfs/inode.c')
-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;