diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-01-05 17:10:17 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-01-05 17:10:17 -0800 |
commit | 3669fa63b630a69899c9c7f0e1f1bd8f1fd218e3 (patch) | |
tree | 57502db190cc35fdab96122f7828271bcc66a5a7 /fs | |
parent | 09a141fe03fb5deec3cf2ca343e918a992bdb41c (diff) | |
download | history-3669fa63b630a69899c9c7f0e1f1bd8f1fd218e3.tar.gz |
Use 'free_pipe_info()' helper function for pipe closedown.
This avoids having fs/fifo.c having to know anything about
pipe data passing details, and cleans up the code.
Diffstat (limited to 'fs')
-rw-r--r-- | fs/fifo.c | 8 | ||||
-rw-r--r-- | fs/pipe.c | 17 |
2 files changed, 12 insertions, 13 deletions
diff --git a/fs/fifo.c b/fs/fifo.c index a045fa71630cd3..5455916241f04e 100644 --- a/fs/fifo.c +++ b/fs/fifo.c @@ -135,12 +135,8 @@ err_wr: goto err; err: - if (!PIPE_READERS(*inode) && !PIPE_WRITERS(*inode)) { - struct pipe_inode_info *info = inode->i_pipe; - inode->i_pipe = NULL; - free_page((unsigned long)info->base); - kfree(info); - } + if (!PIPE_READERS(*inode) && !PIPE_WRITERS(*inode)) + free_pipe_info(inode); err_nocleanup: up(PIPE_SEM(*inode)); diff --git a/fs/pipe.c b/fs/pipe.c index 8cb1abd8761398..464a83fc4749ca 100644 --- a/fs/pipe.c +++ b/fs/pipe.c @@ -322,10 +322,7 @@ pipe_release(struct inode *inode, int decr, int decw) PIPE_READERS(*inode) -= decr; PIPE_WRITERS(*inode) -= decw; if (!PIPE_READERS(*inode) && !PIPE_WRITERS(*inode)) { - struct pipe_inode_info *info = inode->i_pipe; - inode->i_pipe = NULL; - free_page((unsigned long) info->base); - kfree(info); + free_pipe_info(inode); } else { wake_up_interruptible(PIPE_WAIT(*inode)); kill_fasync(PIPE_FASYNC_READERS(*inode), SIGIO, POLL_IN); @@ -530,6 +527,14 @@ struct file_operations rdwr_pipe_fops = { .fasync = pipe_rdwr_fasync, }; +void free_pipe_info(struct inode *inode) +{ + struct pipe_inode_info *info = inode->i_pipe; + inode->i_pipe = NULL; + free_page((unsigned long)info->base); + kfree(info); +} + struct inode* pipe_new(struct inode* inode) { unsigned long page; @@ -668,9 +673,7 @@ close_f12_inode_i_j: close_f12_inode_i: put_unused_fd(i); close_f12_inode: - free_page((unsigned long) PIPE_BASE(*inode)); - kfree(inode->i_pipe); - inode->i_pipe = NULL; + free_pipe_info(inode); iput(inode); close_f12: put_filp(f2); |