aboutsummaryrefslogtreecommitdiffstats
path: root/fs/proc/inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/proc/inode.c')
-rw-r--r--fs/proc/inode.c32
1 files changed, 5 insertions, 27 deletions
diff --git a/fs/proc/inode.c b/fs/proc/inode.c
index d78ade305541..d35b23238fb1 100644
--- a/fs/proc/inode.c
+++ b/fs/proc/inode.c
@@ -18,35 +18,13 @@
18#include <linux/module.h> 18#include <linux/module.h>
19#include <linux/smp_lock.h> 19#include <linux/smp_lock.h>
20#include <linux/sysctl.h> 20#include <linux/sysctl.h>
21#include <linux/slab.h>
21 22
22#include <asm/system.h> 23#include <asm/system.h>
23#include <asm/uaccess.h> 24#include <asm/uaccess.h>
24 25
25#include "internal.h" 26#include "internal.h"
26 27
27struct proc_dir_entry *de_get(struct proc_dir_entry *de)
28{
29 atomic_inc(&de->count);
30 return de;
31}
32
33/*
34 * Decrements the use count and checks for deferred deletion.
35 */
36void de_put(struct proc_dir_entry *de)
37{
38 if (!atomic_read(&de->count)) {
39 printk("de_put: entry %s already free!\n", de->name);
40 return;
41 }
42
43 if (atomic_dec_and_test(&de->count))
44 free_proc_entry(de);
45}
46
47/*
48 * Decrement the use count of the proc_dir_entry.
49 */
50static void proc_delete_inode(struct inode *inode) 28static void proc_delete_inode(struct inode *inode)
51{ 29{
52 struct proc_dir_entry *de; 30 struct proc_dir_entry *de;
@@ -59,7 +37,7 @@ static void proc_delete_inode(struct inode *inode)
59 /* Let go of any associated proc directory entry */ 37 /* Let go of any associated proc directory entry */
60 de = PROC_I(inode)->pde; 38 de = PROC_I(inode)->pde;
61 if (de) 39 if (de)
62 de_put(de); 40 pde_put(de);
63 if (PROC_I(inode)->sysctl) 41 if (PROC_I(inode)->sysctl)
64 sysctl_head_put(PROC_I(inode)->sysctl); 42 sysctl_head_put(PROC_I(inode)->sysctl);
65 clear_inode(inode); 43 clear_inode(inode);
@@ -480,7 +458,7 @@ struct inode *proc_get_inode(struct super_block *sb, unsigned int ino,
480 } 458 }
481 unlock_new_inode(inode); 459 unlock_new_inode(inode);
482 } else 460 } else
483 de_put(de); 461 pde_put(de);
484 return inode; 462 return inode;
485} 463}
486 464
@@ -495,7 +473,7 @@ int proc_fill_super(struct super_block *s)
495 s->s_op = &proc_sops; 473 s->s_op = &proc_sops;
496 s->s_time_gran = 1; 474 s->s_time_gran = 1;
497 475
498 de_get(&proc_root); 476 pde_get(&proc_root);
499 root_inode = proc_get_inode(s, PROC_ROOT_INO, &proc_root); 477 root_inode = proc_get_inode(s, PROC_ROOT_INO, &proc_root);
500 if (!root_inode) 478 if (!root_inode)
501 goto out_no_root; 479 goto out_no_root;
@@ -509,6 +487,6 @@ int proc_fill_super(struct super_block *s)
509out_no_root: 487out_no_root:
510 printk("proc_read_super: get root inode failed\n"); 488 printk("proc_read_super: get root inode failed\n");
511 iput(root_inode); 489 iput(root_inode);
512 de_put(&proc_root); 490 pde_put(&proc_root);
513 return -ENOMEM; 491 return -ENOMEM;
514} 492}