diff options
author | Sukadev Bhattiprolu <sukadev@us.ibm.com> | 2008-10-13 10:43:18 +0100 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-13 09:51:43 -0700 |
commit | 89a52e109e2e2fe8bbd4e316cdb910774519c029 (patch) | |
tree | 5e469fcbfe109216ea1e046377c00b439b558bdd /fs | |
parent | 527b3e4773628b30d03323a2cb5fb0d84441990f (diff) | |
download | linux-89a52e109e2e2fe8bbd4e316cdb910774519c029.tar.gz linux-89a52e109e2e2fe8bbd4e316cdb910774519c029.tar.bz2 linux-89a52e109e2e2fe8bbd4e316cdb910774519c029.zip |
Simplify devpts_pty_new()
devpts_pty_new() is called when setting up a new pty and would not
will not have an existing dentry or inode for the pty. So don't bother
looking for an existing dentry - just create a new one.
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, 8 insertions, 3 deletions
diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c index b292ed7ff1ca..50e885f84bb0 100644 --- a/fs/devpts/inode.c +++ b/fs/devpts/inode.c @@ -220,6 +220,7 @@ int devpts_pty_new(struct inode *ptmx_inode, struct tty_struct *tty) dev_t device = MKDEV(driver->major, driver->minor_start+number); struct dentry *dentry; struct inode *inode = new_inode(devpts_mnt->mnt_sb); + char s[12]; /* We're supposed to be given the slave end of a pty */ BUG_ON(driver->type != TTY_DRIVER_TYPE_PTY); @@ -235,9 +236,13 @@ int devpts_pty_new(struct inode *ptmx_inode, struct tty_struct *tty) init_special_inode(inode, S_IFCHR|config.mode, device); inode->i_private = tty; - dentry = get_node(number); - if (!IS_ERR(dentry) && !dentry->d_inode) { - d_instantiate(dentry, inode); + sprintf(s, "%d", number); + + mutex_lock(&devpts_root->d_inode->i_mutex); + + dentry = d_alloc_name(devpts_root, s); + if (!IS_ERR(dentry)) { + d_add(dentry, inode); fsnotify_create(devpts_root->d_inode, dentry); } |