Commit 7cc2fd8b authored by Linus Torvalds's avatar Linus Torvalds

Get rid of /proc dependency on inode numbers

parent b40c812e
...@@ -1121,12 +1121,6 @@ struct dentry *proc_pid_lookup(struct inode *dir, struct dentry * dentry) ...@@ -1121,12 +1121,6 @@ struct dentry *proc_pid_lookup(struct inode *dir, struct dentry * dentry)
return ERR_PTR(-ENOENT); return ERR_PTR(-ENOENT);
} }
void proc_pid_delete_inode(struct inode *inode)
{
if (proc_task(inode))
put_task_struct(proc_task(inode));
}
#define PROC_NUMBUF 10 #define PROC_NUMBUF 10
#define PROC_MAXPIDS 20 #define PROC_MAXPIDS 20
......
...@@ -59,14 +59,18 @@ void de_put(struct proc_dir_entry *de) ...@@ -59,14 +59,18 @@ void de_put(struct proc_dir_entry *de)
*/ */
static void proc_delete_inode(struct inode *inode) static void proc_delete_inode(struct inode *inode)
{ {
struct proc_dir_entry *de = PDE(inode); struct proc_dir_entry *de;
struct task_struct *tsk;
inode->i_state = I_CLEAR; inode->i_state = I_CLEAR;
if (PROC_INODE_PROPER(inode)) { /* Let go of any associated process */
proc_pid_delete_inode(inode); tsk = PROC_I(inode)->task;
return; if (tsk)
} put_task_struct(tsk);
/* Let go of any associated proc directory entry */
de = PROC_I(inode)->pde;
if (de) { if (de) {
if (de->owner) if (de->owner)
__MOD_DEC_USE_COUNT(de->owner); __MOD_DEC_USE_COUNT(de->owner);
...@@ -86,10 +90,18 @@ static kmem_cache_t * proc_inode_cachep; ...@@ -86,10 +90,18 @@ static kmem_cache_t * proc_inode_cachep;
static struct inode *proc_alloc_inode(struct super_block *sb) static struct inode *proc_alloc_inode(struct super_block *sb)
{ {
struct proc_inode *ei; struct proc_inode *ei;
struct inode *inode;
ei = (struct proc_inode *)kmem_cache_alloc(proc_inode_cachep, SLAB_KERNEL); ei = (struct proc_inode *)kmem_cache_alloc(proc_inode_cachep, SLAB_KERNEL);
if (!ei) if (!ei)
return NULL; return NULL;
return &ei->vfs_inode; ei->task = NULL;
ei->type = 0;
ei->op.proc_get_link = NULL;
ei->pde = NULL;
inode = &ei->vfs_inode;
inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
return inode;
} }
static void proc_destroy_inode(struct inode *inode) static void proc_destroy_inode(struct inode *inode)
......
...@@ -74,8 +74,6 @@ struct proc_dir_entry { ...@@ -74,8 +74,6 @@ struct proc_dir_entry {
kdev_t rdev; kdev_t rdev;
}; };
#define PROC_INODE_PROPER(inode) ((inode)->i_ino & ~0xffff)
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
extern struct proc_dir_entry proc_root; extern struct proc_dir_entry proc_root;
...@@ -89,7 +87,6 @@ extern void proc_root_init(void); ...@@ -89,7 +87,6 @@ extern void proc_root_init(void);
extern void proc_misc_init(void); extern void proc_misc_init(void);
struct dentry *proc_pid_lookup(struct inode *dir, struct dentry * dentry); struct dentry *proc_pid_lookup(struct inode *dir, struct dentry * dentry);
void proc_pid_delete_inode(struct inode *inode);
int proc_pid_readdir(struct file * filp, void * dirent, filldir_t filldir); int proc_pid_readdir(struct file * filp, void * dirent, filldir_t filldir);
extern struct proc_dir_entry *create_proc_entry(const char *name, mode_t mode, extern struct proc_dir_entry *create_proc_entry(const char *name, mode_t mode,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment