]> Git Repo - linux.git/commit
devpts: more pty driver interface cleanups
authorLinus Torvalds <[email protected]>
Tue, 26 Apr 2016 03:04:08 +0000 (20:04 -0700)
committerLinus Torvalds <[email protected]>
Tue, 26 Apr 2016 22:47:32 +0000 (15:47 -0700)
commit8ead9dd54716d1e05e129959f702fcc1786f82b4
treea31bb92dab97a482390b515e91fd29e80b3a3004
parentbcc981e9ed84c678533299d7eff17d2c81e4d5de
devpts: more pty driver interface cleanups

This is more prep-work for the upcoming pty changes.  Still just code
cleanup with no actual semantic changes.

This removes a bunch pointless complexity by just having the slave pty
side remember the dentry associated with the devpts slave rather than
the inode.  That allows us to remove all the "look up the dentry" code
for when we want to remove it again.

Together with moving the tty pointer from "inode->i_private" to
"dentry->d_fsdata" and getting rid of pointless inode locking, this
removes about 30 lines of code.  Not only is the end result smaller,
it's simpler and easier to understand.

The old code, for example, depended on the d_find_alias() to not just
find the dentry, but also to check that it is still hashed, which in
turn validated the tty pointer in the inode.

That is a _very_ roundabout way to say "invalidate the cached tty
pointer when the dentry is removed".

The new code just does

dentry->d_fsdata = NULL;

in devpts_pty_kill() instead, invalidating the tty pointer rather more
directly and obviously.  Don't do something complex and subtle when the
obvious straightforward approach will do.

The rest of the patch (ie apart from code deletion and the above tty
pointer clearing) is just switching the calling convention to pass the
dentry or file pointer around instead of the inode.

Cc: Eric Biederman <[email protected]>
Cc: Peter Anvin <[email protected]>
Cc: Andy Lutomirski <[email protected]>
Cc: Al Viro <[email protected]>
Cc: Peter Hurley <[email protected]>
Cc: Serge Hallyn <[email protected]>
Cc: Willy Tarreau <[email protected]>
Cc: Aurelien Jarno <[email protected]>
Cc: Alan Cox <[email protected]>
Cc: Jann Horn <[email protected]>
Cc: Greg KH <[email protected]>
Cc: Jiri Slaby <[email protected]>
Cc: Florian Weimer <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
drivers/tty/pty.c
drivers/tty/tty_io.c
fs/devpts/inode.c
include/linux/devpts_fs.h
include/linux/tty_driver.h
This page took 0.06079 seconds and 4 git commands to generate.