patch-2.1.115 linux/fs/devpts/inode.c
Next file: linux/fs/devpts/root.c
Previous file: linux/fs/devpts/devpts_i.h
Back to the patch index
Back to the overall index
- Lines: 51
- Date:
Thu Aug 6 02:29:45 1998
- Orig file:
v2.1.114/linux/fs/devpts/inode.c
- Orig date:
Tue Jun 23 10:01:24 1998
diff -u --recursive --new-file v2.1.114/linux/fs/devpts/inode.c linux/fs/devpts/inode.c
@@ -34,7 +34,7 @@
struct inode *inode;
int i;
- for ( i = 0 ; i < NR_PTYS ; i++ ) {
+ for ( i = 0 ; i < sbi->max_ptys ; i++ ) {
if ( (inode = sbi->inodes[i]) ) {
if ( inode->i_count != 1 )
printk("devpts_put_super: badness: entry %d count %d\n",
@@ -48,6 +48,7 @@
if ( sbi->next )
SBI(sbi->next)->back = sbi->back;
+ kfree(sbi->inodes);
kfree(sbi);
#ifdef MODULE
@@ -138,8 +139,14 @@
if ( !sbi )
goto fail_unlock;
- sbi->magic = DEVPTS_SBI_MAGIC;
- memset(sbi->inodes, 0, sizeof sbi->inodes);
+ sbi->magic = DEVPTS_SBI_MAGIC;
+ sbi->max_ptys = unix98_max_ptys;
+ sbi->inodes = kmalloc(sizeof(struct inode *) * sbi->max_ptys, GFP_KERNEL);
+ if ( !sbi->inodes ) {
+ kfree(sbi);
+ goto fail_unlock;
+ }
+ memset(sbi->inodes, 0, sizeof(struct inode *) * sbi->max_ptys);
s->u.generic_sbp = (void *) sbi;
s->s_blocksize = 1024;
@@ -252,6 +259,7 @@
static void devpts_read_inode(struct inode *inode)
{
ino_t ino = inode->i_ino;
+ struct devpts_sb_info *sbi = SBI(inode->i_sb);
inode->i_op = NULL;
inode->i_mode = 0;
@@ -270,7 +278,7 @@
}
ino -= 2;
- if ( ino >= NR_PTYS )
+ if ( ino >= sbi->max_ptys )
return; /* Bogus */
inode->i_mode = S_IFCHR;
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov