inode.c (0a1340c185734a57fbf4775927966ad4a1347b02) inode.c (8e18e2941c53416aa219708e7dcad21fb4bd6794)
1/* -*- linux-c -*- --------------------------------------------------------- *
2 *
3 * linux/fs/devpts/inode.c
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

--- 163 unchanged lines hidden (view full) ---

172 return -ENOMEM;
173
174 inode->i_ino = number+2;
175 inode->i_blksize = 1024;
176 inode->i_uid = config.setuid ? config.uid : current->fsuid;
177 inode->i_gid = config.setgid ? config.gid : current->fsgid;
178 inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
179 init_special_inode(inode, S_IFCHR|config.mode, device);
1/* -*- linux-c -*- --------------------------------------------------------- *
2 *
3 * linux/fs/devpts/inode.c
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

--- 163 unchanged lines hidden (view full) ---

172 return -ENOMEM;
173
174 inode->i_ino = number+2;
175 inode->i_blksize = 1024;
176 inode->i_uid = config.setuid ? config.uid : current->fsuid;
177 inode->i_gid = config.setgid ? config.gid : current->fsgid;
178 inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
179 init_special_inode(inode, S_IFCHR|config.mode, device);
180 inode->u.generic_ip = tty;
180 inode->i_private = tty;
181
182 dentry = get_node(number);
183 if (!IS_ERR(dentry) && !dentry->d_inode)
184 d_instantiate(dentry, inode);
185
186 mutex_unlock(&devpts_root->d_inode->i_mutex);
187
188 return 0;
189}
190
191struct tty_struct *devpts_get_tty(int number)
192{
193 struct dentry *dentry = get_node(number);
194 struct tty_struct *tty;
195
196 tty = NULL;
197 if (!IS_ERR(dentry)) {
198 if (dentry->d_inode)
181
182 dentry = get_node(number);
183 if (!IS_ERR(dentry) && !dentry->d_inode)
184 d_instantiate(dentry, inode);
185
186 mutex_unlock(&devpts_root->d_inode->i_mutex);
187
188 return 0;
189}
190
191struct tty_struct *devpts_get_tty(int number)
192{
193 struct dentry *dentry = get_node(number);
194 struct tty_struct *tty;
195
196 tty = NULL;
197 if (!IS_ERR(dentry)) {
198 if (dentry->d_inode)
199 tty = dentry->d_inode->u.generic_ip;
199 tty = dentry->d_inode->i_private;
200 dput(dentry);
201 }
202
203 mutex_unlock(&devpts_root->d_inode->i_mutex);
204
205 return tty;
206}
207

--- 36 unchanged lines hidden ---
200 dput(dentry);
201 }
202
203 mutex_unlock(&devpts_root->d_inode->i_mutex);
204
205 return tty;
206}
207

--- 36 unchanged lines hidden ---