diff options
author | Sukadev Bhattiprolu <sukadev@us.ibm.com> | 2008-10-13 11:42:59 +0200 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-13 18:51:43 +0200 |
commit | 15f1a6338ddd4e69fff965d4b3a0e1bfb7a13d9c (patch) | |
tree | 301eea94cb514dc12b5070fc4b3ab33d3aab4322 /fs | |
parent | Move tty lookup/reopen to caller (diff) | |
download | linux-15f1a6338ddd4e69fff965d4b3a0e1bfb7a13d9c.tar.xz linux-15f1a6338ddd4e69fff965d4b3a0e1bfb7a13d9c.zip |
Add an instance parameter devpts interfaces
Pass-in 'inode' or 'tty' parameter to devpts interfaces. With multiple
devpts instances, these parameters will be used in subsequent patches
to identify the instance of devpts mounted. The parameters also help
simplify devpts implementation.
Changelog[v3]:
- minor changes due to merge with ttydev updates
- rename parameters to emphasize they are ptmx or pts inodes
- pass-in tty_struct * to devpts_pty_kill() (this will help
cleanup the get_node() call in a subsequent patch)
Signed-off-by: Sukadev Bhattiprolu <sukadev@us.ibm.com>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/devpts/inode.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c index 488eb424f662..638db9b769ac 100644 --- a/fs/devpts/inode.c +++ b/fs/devpts/inode.c @@ -177,7 +177,7 @@ static struct dentry *get_node(int num) return lookup_one_len(s, root, sprintf(s, "%d", num)); } -int devpts_new_index(void) +int devpts_new_index(struct inode *ptmx_inode) { int index; int ida_ret; @@ -205,14 +205,14 @@ retry: return index; } -void devpts_kill_index(int idx) +void devpts_kill_index(struct inode *ptmx_inode, int idx) { mutex_lock(&allocated_ptys_lock); ida_remove(&allocated_ptys, idx); mutex_unlock(&allocated_ptys_lock); } -int devpts_pty_new(struct tty_struct *tty) +int devpts_pty_new(struct inode *ptmx_inode, struct tty_struct *tty) { int number = tty->index; /* tty layer puts index from devpts_new_index() in here */ struct tty_driver *driver = tty->driver; @@ -245,7 +245,7 @@ int devpts_pty_new(struct tty_struct *tty) return 0; } -struct tty_struct *devpts_get_tty(int number) +struct tty_struct *devpts_get_tty(struct inode *pts_inode, int number) { struct dentry *dentry = get_node(number); struct tty_struct *tty; @@ -262,8 +262,9 @@ struct tty_struct *devpts_get_tty(int number) return tty; } -void devpts_pty_kill(int number) +void devpts_pty_kill(struct tty_struct *tty) { + int number = tty->index; struct dentry *dentry = get_node(number); if (!IS_ERR(dentry)) { |