summaryrefslogtreecommitdiffstats
path: root/fs/proc/inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/proc/inode.c')
-rw-r--r--fs/proc/inode.c87
1 files changed, 36 insertions, 51 deletions
diff --git a/fs/proc/inode.c b/fs/proc/inode.c
index 8842cc253..607a7d7e9 100644
--- a/fs/proc/inode.c
+++ b/fs/proc/inode.c
@@ -13,7 +13,7 @@
#include <linux/file.h>
#include <linux/locks.h>
#include <linux/limits.h>
-#include <linux/config.h>
+#define __NO_VERSION__
#include <linux/module.h>
#include <asm/system.h>
@@ -51,10 +51,6 @@ void de_put(struct proc_dir_entry *de)
static void proc_put_inode(struct inode *inode)
{
-#ifdef CONFIG_SUN_OPENPROMFS_MODULE
- if (PROC_INODE_OPENPROM(inode) && proc_openprom_use)
- (*proc_openprom_use)(inode, 0);
-#endif
/*
* Kill off unused inodes ... VFS will unhash and
* delete the inode if we set i_nlink to zero.
@@ -74,9 +70,6 @@ static void proc_delete_inode(struct inode *inode)
proc_pid_delete_inode(inode);
return;
}
- if (PROC_INODE_OPENPROM(inode))
- return;
-
if (de) {
if (de->owner)
__MOD_DEC_USE_COUNT(de->owner);
@@ -97,6 +90,30 @@ static void proc_put_super(struct super_block *sb)
*p = (struct super_block *)(*p)->u.generic_sbp;
}
+static void proc_write_inode(struct inode * inode)
+{
+}
+
+static void proc_read_inode(struct inode * inode)
+{
+ inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
+}
+
+static int proc_statfs(struct super_block *sb, struct statfs *buf, int bufsiz)
+{
+ struct statfs tmp;
+
+ tmp.f_type = PROC_SUPER_MAGIC;
+ tmp.f_bsize = PAGE_SIZE/sizeof(long);
+ tmp.f_blocks = 0;
+ tmp.f_bfree = 0;
+ tmp.f_bavail = 0;
+ tmp.f_files = 0;
+ tmp.f_ffree = 0;
+ tmp.f_namelen = NAME_MAX;
+ return copy_to_user(buf, &tmp, bufsiz) ? -EFAULT : 0;
+}
+
static struct super_operations proc_sops = {
proc_read_inode,
proc_write_inode,
@@ -158,11 +175,6 @@ printk("proc_iget: using deleted entry %s, count=%d\n", de->name, de->count);
if (!inode)
goto out_fail;
-#ifdef CONFIG_SUN_OPENPROMFS_MODULE
- if (PROC_INODE_OPENPROM(inode) && proc_openprom_use)
- (*proc_openprom_use)(inode, 1);
-#endif
-
inode->u.generic_ip = (void *) de;
if (de) {
if (de->mode) {
@@ -172,26 +184,16 @@ printk("proc_iget: using deleted entry %s, count=%d\n", de->name, de->count);
}
if (de->size)
inode->i_size = de->size;
- if (de->ops)
- inode->i_op = de->ops;
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->ops)
+ inode->i_op = de->ops;
}
- /*
- * Fixup the root inode's nlink value
- */
- if (inode->i_ino == PROC_ROOT_INO) {
- struct task_struct *p;
- read_lock(&tasklist_lock);
- for_each_task(p) {
- if (p->pid)
- inode->i_nlink++;
- }
- read_unlock(&tasklist_lock);
- }
out:
return inode;
@@ -204,6 +206,7 @@ struct super_block *proc_read_super(struct super_block *s,void *data,
int silent)
{
struct inode * root_inode;
+ struct task_struct *p;
lock_super(s);
s->s_blocksize = 1024;
@@ -213,6 +216,12 @@ struct super_block *proc_read_super(struct super_block *s,void *data,
root_inode = proc_get_inode(s, PROC_ROOT_INO, &proc_root);
if (!root_inode)
goto out_no_root;
+ /*
+ * Fixup the root inode's nlink value
+ */
+ read_lock(&tasklist_lock);
+ for_each_task(p) if (p->pid) root_inode->i_nlink++;
+ read_unlock(&tasklist_lock);
s->s_root = d_alloc_root(root_inode);
if (!s->s_root)
goto out_no_root;
@@ -229,27 +238,3 @@ out_no_root:
unlock_super(s);
return NULL;
}
-
-int proc_statfs(struct super_block *sb, struct statfs *buf, int bufsiz)
-{
- struct statfs tmp;
-
- tmp.f_type = PROC_SUPER_MAGIC;
- tmp.f_bsize = PAGE_SIZE/sizeof(long);
- tmp.f_blocks = 0;
- tmp.f_bfree = 0;
- tmp.f_bavail = 0;
- tmp.f_files = 0;
- tmp.f_ffree = 0;
- tmp.f_namelen = NAME_MAX;
- return copy_to_user(buf, &tmp, bufsiz) ? -EFAULT : 0;
-}
-
-void proc_read_inode(struct inode * inode)
-{
- inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
-}
-
-void proc_write_inode(struct inode * inode)
-{
-}