blob: e0ee0b3000b2da107c975137165fc989777d8a58 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/* -*- linux-c -*- --------------------------------------------------------- *
2 *
3 * linux/include/linux/devpts_fs.h
4 *
5 * Copyright 1998-2004 H. Peter Anvin -- All Rights Reserved
6 *
7 * This file is part of the Linux kernel and is made available under
8 * the terms of the GNU General Public License, version 2, or at your
9 * option, any later version, incorporated herein by reference.
10 *
11 * ------------------------------------------------------------------------- */
12
13#ifndef _LINUX_DEVPTS_FS_H
14#define _LINUX_DEVPTS_FS_H
15
16#include <linux/errno.h>
17
18#ifdef CONFIG_UNIX98_PTYS
19
Sukadev Bhattiprolu15f1a632008-10-13 10:42:59 +010020int devpts_new_index(struct inode *ptmx_inode);
21void devpts_kill_index(struct inode *ptmx_inode, int idx);
Herton R. Krzesinski1f55c712016-01-14 17:56:58 -020022void devpts_add_ref(struct inode *ptmx_inode);
23void devpts_del_ref(struct inode *ptmx_inode);
Sukadev Bhattiprolu15f1a632008-10-13 10:42:59 +010024/* mknod in devpts */
Jiri Slabyf11afb62012-10-18 22:26:29 +020025struct inode *devpts_pty_new(struct inode *ptmx_inode, dev_t device, int index,
26 void *priv);
Jiri Slaby8fcbaa22012-10-18 22:26:27 +020027/* get private structure */
28void *devpts_get_priv(struct inode *pts_inode);
Sukadev Bhattiprolu15f1a632008-10-13 10:42:59 +010029/* unlink */
Jiri Slabyf11afb62012-10-18 22:26:29 +020030void devpts_pty_kill(struct inode *inode);
Linus Torvalds1da177e2005-04-16 15:20:36 -070031
32#else
33
34/* Dummy stubs in the no-pty case */
Sukadev Bhattiprolu15f1a632008-10-13 10:42:59 +010035static inline int devpts_new_index(struct inode *ptmx_inode) { return -EINVAL; }
36static inline void devpts_kill_index(struct inode *ptmx_inode, int idx) { }
Herton R. Krzesinski1f55c712016-01-14 17:56:58 -020037static inline void devpts_add_ref(struct inode *ptmx_inode) { }
38static inline void devpts_del_ref(struct inode *ptmx_inode) { }
Jiri Slaby162b97c2012-10-18 22:26:28 +020039static inline struct inode *devpts_pty_new(struct inode *ptmx_inode,
Jiri Slabyf11afb62012-10-18 22:26:29 +020040 dev_t device, int index, void *priv)
Sukadev Bhattiprolu15f1a632008-10-13 10:42:59 +010041{
Jiri Slaby162b97c2012-10-18 22:26:28 +020042 return ERR_PTR(-EINVAL);
Sukadev Bhattiprolu15f1a632008-10-13 10:42:59 +010043}
Jiri Slaby8fcbaa22012-10-18 22:26:27 +020044static inline void *devpts_get_priv(struct inode *pts_inode)
Sukadev Bhattiprolu15f1a632008-10-13 10:42:59 +010045{
46 return NULL;
47}
Jiri Slabyf11afb62012-10-18 22:26:29 +020048static inline void devpts_pty_kill(struct inode *inode) { }
Linus Torvalds1da177e2005-04-16 15:20:36 -070049
50#endif
51
52
53#endif /* _LINUX_DEVPTS_FS_H */