mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-21 11:44:01 +08:00
8ead9dd547
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 <ebiederm@xmission.com> Cc: Peter Anvin <hpa@zytor.com> Cc: Andy Lutomirski <luto@amacapital.net> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Peter Hurley <peter@hurleysoftware.com> Cc: Serge Hallyn <serge.hallyn@ubuntu.com> Cc: Willy Tarreau <w@1wt.eu> Cc: Aurelien Jarno <aurelien@aurel32.net> Cc: Alan Cox <gnomes@lxorguk.ukuu.org.uk> Cc: Jann Horn <jann@thejh.net> Cc: Greg KH <greg@kroah.com> Cc: Jiri Slaby <jslaby@suse.com> Cc: Florian Weimer <fw@deneb.enyo.de> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
40 lines
1.1 KiB
C
40 lines
1.1 KiB
C
/* -*- linux-c -*- --------------------------------------------------------- *
|
|
*
|
|
* linux/include/linux/devpts_fs.h
|
|
*
|
|
* Copyright 1998-2004 H. Peter Anvin -- All Rights Reserved
|
|
*
|
|
* This file is part of the Linux kernel and is made available under
|
|
* the terms of the GNU General Public License, version 2, or at your
|
|
* option, any later version, incorporated herein by reference.
|
|
*
|
|
* ------------------------------------------------------------------------- */
|
|
|
|
#ifndef _LINUX_DEVPTS_FS_H
|
|
#define _LINUX_DEVPTS_FS_H
|
|
|
|
#include <linux/errno.h>
|
|
|
|
struct pts_fs_info;
|
|
|
|
#ifdef CONFIG_UNIX98_PTYS
|
|
|
|
/* Look up a pts fs info and get a ref to it */
|
|
struct pts_fs_info *devpts_get_ref(struct inode *, struct file *);
|
|
void devpts_put_ref(struct pts_fs_info *);
|
|
|
|
int devpts_new_index(struct pts_fs_info *);
|
|
void devpts_kill_index(struct pts_fs_info *, int);
|
|
|
|
/* mknod in devpts */
|
|
struct dentry *devpts_pty_new(struct pts_fs_info *, int, void *);
|
|
/* get private structure */
|
|
void *devpts_get_priv(struct dentry *);
|
|
/* unlink */
|
|
void devpts_pty_kill(struct dentry *);
|
|
|
|
#endif
|
|
|
|
|
|
#endif /* _LINUX_DEVPTS_FS_H */
|