struct inode * proc_get_inode(struct super_block * sb, int ino, struct proc_dir_entry * de) { struct inode * inode; /* * Increment the use count so the dir entry can't disappear. */ de_get(de); #if 1 /* shouldn't ever happen */ if (de && de->deleted) printk("proc_iget: using deleted entry %s, count=%d\n", de->name, atomic_read(&de->count)); #endif inode = iget(sb, ino); if (!inode) goto out_fail; inode->u.generic_ip = (void *) de; if (de) { if (de->mode) { inode->i_mode = de->mode; inode->i_uid = de->uid; inode->i_gid = de->gid; } if (de->size) inode->i_size = de->size; if (de->nlink) inode->i_nlink = de->nlink; if (de->owner) __MOD_INC_USE_COUNT(de->owner); if (S_ISBLK(de->mode)||S_ISCHR(de->mode)||S_ISFIFO(de->mode)) init_special_inode(inode,de->mode,kdev_t_to_nr(de->rdev)); else { if (de->proc_iops) inode->i_op = de->proc_iops; if (de->proc_fops) inode->i_fop = de->proc_fops; } } out: return inode; out_fail: de_put(de); goto out; }
struct inode *proc_get_inode(struct super_block *sb, unsigned int ino, struct proc_dir_entry *de) { struct inode * inode; /* * Increment the use count so the dir entry can't disappear. */ de_get(de); WARN_ON(de && de->deleted); if (de != NULL && !try_module_get(de->owner)) goto out_mod; inode = iget(sb, ino); if (!inode) goto out_ino; PROC_I(inode)->pde = de; if (de) { if (de->mode) { inode->i_mode = de->mode; inode->i_uid = de->uid; inode->i_gid = de->gid; } if (de->size) inode->i_size = de->size; if (de->nlink) inode->i_nlink = de->nlink; if (de->proc_iops) inode->i_op = de->proc_iops; if (de->proc_fops) inode->i_fop = de->proc_fops; } return inode; out_ino: if (de != NULL) module_put(de->owner); out_mod: de_put(de); return NULL; }