aboutsummaryrefslogtreecommitdiffstats
path: root/fs/devpts
diff options
context:
space:
mode:
authorSukadev Bhattiprolu <sukadev@us.ibm.com>2008-10-13 05:42:59 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-10-13 12:51:43 -0400
commit15f1a6338ddd4e69fff965d4b3a0e1bfb7a13d9c (patch)
tree301eea94cb514dc12b5070fc4b3ab33d3aab4322 /fs/devpts
parent4a2b5fddd53b80efcb3266ee36e23b8de28e761a (diff)
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/devpts')
-rw-r--r--fs/devpts/inode.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c
index 488eb424f66..638db9b769a 100644
--- a/fs/devpts/inode.c
+++ b/fs/devpts/inode.c
@@ -177,7 +177,7 @@ static struct dentry *get_node(int num)
177 return lookup_one_len(s, root, sprintf(s, "%d", num)); 177 return lookup_one_len(s, root, sprintf(s, "%d", num));
178} 178}
179 179
180int devpts_new_index(void) 180int devpts_new_index(struct inode *ptmx_inode)
181{ 181{
182 int index; 182 int index;
183 int ida_ret; 183 int ida_ret;
@@ -205,14 +205,14 @@ retry:
205 return index; 205 return index;
206} 206}
207 207
208void devpts_kill_index(int idx) 208void devpts_kill_index(struct inode *ptmx_inode, int idx)
209{ 209{
210 mutex_lock(&allocated_ptys_lock); 210 mutex_lock(&allocated_ptys_lock);
211 ida_remove(&allocated_ptys, idx); 211 ida_remove(&allocated_ptys, idx);
212 mutex_unlock(&allocated_ptys_lock); 212 mutex_unlock(&allocated_ptys_lock);
213} 213}
214 214
215int devpts_pty_new(struct tty_struct *tty) 215int devpts_pty_new(struct inode *ptmx_inode, struct tty_struct *tty)
216{ 216{
217 int number = tty->index; /* tty layer puts index from devpts_new_index() in here */ 217 int number = tty->index; /* tty layer puts index from devpts_new_index() in here */
218 struct tty_driver *driver = tty->driver; 218 struct tty_driver *driver = tty->driver;
@@ -245,7 +245,7 @@ int devpts_pty_new(struct tty_struct *tty)
245 return 0; 245 return 0;
246} 246}
247 247
248struct tty_struct *devpts_get_tty(int number) 248struct tty_struct *devpts_get_tty(struct inode *pts_inode, int number)
249{ 249{
250 struct dentry *dentry = get_node(number); 250 struct dentry *dentry = get_node(number);
251 struct tty_struct *tty; 251 struct tty_struct *tty;
@@ -262,8 +262,9 @@ struct tty_struct *devpts_get_tty(int number)
262 return tty; 262 return tty;
263} 263}
264 264
265void devpts_pty_kill(int number) 265void devpts_pty_kill(struct tty_struct *tty)
266{ 266{
267 int number = tty->index;
267 struct dentry *dentry = get_node(number); 268 struct dentry *dentry = get_node(number);
268 269
269 if (!IS_ERR(dentry)) { 270 if (!IS_ERR(dentry)) {