summaryrefslogtreecommitdiffstats
path: root/fs/proc
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-03-02 02:36:47 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-03-02 02:36:47 +0000
commit8624512aa908741ba2795200133eae0d7f4557ea (patch)
treed5d3036fccf2604f4c98dedc11e8adb929d6b52e /fs/proc
parent7b8f5d6f1d45d9f9de1d26e7d3c32aa5af11b488 (diff)
Merge with 2.3.48.
Diffstat (limited to 'fs/proc')
-rw-r--r--fs/proc/base.c77
-rw-r--r--fs/proc/generic.c30
-rw-r--r--fs/proc/inode.c26
-rw-r--r--fs/proc/kcore.c8
-rw-r--r--fs/proc/kmsg.c6
-rw-r--r--fs/proc/proc_misc.c45
-rw-r--r--fs/proc/root.c15
7 files changed, 70 insertions, 137 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c
index cdd2116b2..54d93e131 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -208,10 +208,6 @@ static struct file_operations proc_maps_operations = {
read: pid_maps_read,
};
-struct inode_operations proc_maps_inode_operations = {
- &proc_maps_operations, /* default base directory file-ops */
-};
-
#define PROC_BLOCK_SIZE (3*1024) /* 4K page size but our output routines use some slack for overruns */
static ssize_t proc_info_read(struct file * file, char * buf,
@@ -259,10 +255,6 @@ static struct file_operations proc_info_file_operations = {
read: proc_info_read,
};
-static struct inode_operations proc_info_inode_operations = {
- &proc_info_file_operations, /* default proc file-ops */
-};
-
#define MAY_PTRACE(p) \
(p==current||(p->p_pptr==current&&(p->flags&PF_PTRACED)&&p->state==TASK_STOPPED))
@@ -350,21 +342,7 @@ static struct file_operations proc_mem_operations = {
};
static struct inode_operations proc_mem_inode_operations = {
- &proc_mem_operations, /* default base directory file-ops */
- NULL, /* create */
- NULL, /* lookup */
- NULL, /* link */
- NULL, /* unlink */
- NULL, /* symlink */
- NULL, /* mkdir */
- NULL, /* rmdir */
- NULL, /* mknod */
- NULL, /* rename */
- NULL, /* readlink */
- NULL, /* follow_link */
- NULL, /* truncate */
- proc_permission, /* permission */
- NULL /* revalidate */
+ permission: proc_permission,
};
static struct dentry * proc_pid_follow_link(struct dentry *dentry,
@@ -453,14 +431,6 @@ static struct inode_operations proc_pid_link_inode_operations = {
follow_link: proc_pid_follow_link
};
-/* reading from directory - bad */
-
-static ssize_t proc_dir_read (struct file * filp, char * buf,
- size_t count, loff_t *ppos)
-{
- return -EISDIR;
-}
-
struct pid_entry {
int type;
int len;
@@ -744,28 +714,16 @@ out:
}
static struct file_operations proc_fd_operations = {
- read: proc_dir_read, /* read - bad */
- readdir: proc_readfd, /* readdir */
+ read: generic_read_dir,
+ readdir: proc_readfd,
};
/*
* proc directories can do almost nothing..
*/
static struct inode_operations proc_fd_inode_operations = {
- &proc_fd_operations, /* default base directory file-ops */
- NULL, /* create */
- proc_lookupfd, /* lookup */
- NULL, /* link */
- NULL, /* unlink */
- NULL, /* symlink */
- NULL, /* mkdir */
- NULL, /* rmdir */
- NULL, /* mknod */
- NULL, /* rename */
- NULL, /* readlink */
- NULL, /* follow_link */
- NULL, /* truncate */
- proc_permission, /* permission */
+ lookup: proc_lookupfd,
+ permission: proc_permission,
};
static struct dentry *proc_base_lookup(struct inode *dir, struct dentry *dentry)
@@ -801,6 +759,7 @@ static struct dentry *proc_base_lookup(struct inode *dir, struct dentry *dentry)
case PROC_PID_FD:
inode->i_nlink = 2;
inode->i_op = &proc_fd_inode_operations;
+ inode->i_fop = &proc_fd_operations;
break;
case PROC_PID_EXE:
inode->i_op = &proc_pid_link_inode_operations;
@@ -815,36 +774,37 @@ static struct dentry *proc_base_lookup(struct inode *dir, struct dentry *dentry)
inode->u.proc_i.op.proc_get_link = proc_root_link;
break;
case PROC_PID_ENVIRON:
- inode->i_op = &proc_info_inode_operations;
+ inode->i_fop = &proc_info_file_operations;
inode->u.proc_i.op.proc_read = proc_pid_environ;
break;
case PROC_PID_STATUS:
- inode->i_op = &proc_info_inode_operations;
+ inode->i_fop = &proc_info_file_operations;
inode->u.proc_i.op.proc_read = proc_pid_status;
break;
case PROC_PID_STAT:
- inode->i_op = &proc_info_inode_operations;
+ inode->i_fop = &proc_info_file_operations;
inode->u.proc_i.op.proc_read = proc_pid_stat;
break;
case PROC_PID_CMDLINE:
- inode->i_op = &proc_info_inode_operations;
+ inode->i_fop = &proc_info_file_operations;
inode->u.proc_i.op.proc_read = proc_pid_cmdline;
break;
case PROC_PID_STATM:
- inode->i_op = &proc_info_inode_operations;
+ inode->i_fop = &proc_info_file_operations;
inode->u.proc_i.op.proc_read = proc_pid_statm;
break;
case PROC_PID_MAPS:
- inode->i_op = &proc_maps_inode_operations;
+ inode->i_fop = &proc_maps_operations;
break;
#ifdef __SMP__
case PROC_PID_CPU:
- inode->i_op = &proc_info_inode_operations;
+ inode->i_fop = &proc_info_file_operations;
inode->u.proc_i.op.proc_read = proc_pid_cpu;
break;
#endif
case PROC_PID_MEM:
inode->i_op = &proc_mem_inode_operations;
+ inode->i_fop = &proc_mem_operations;
break;
default:
printk("procfs: impossible type (%d)",p->type);
@@ -860,14 +820,12 @@ out:
}
static struct file_operations proc_base_operations = {
- read: proc_dir_read, /* read - bad */
- readdir: proc_base_readdir, /* readdir */
+ read: generic_read_dir,
+ readdir: proc_base_readdir,
};
static struct inode_operations proc_base_inode_operations = {
- &proc_base_operations, /* default base directory file-ops */
- NULL, /* create */
- proc_base_lookup, /* lookup */
+ lookup: proc_base_lookup,
};
struct dentry *proc_pid_lookup(struct inode *dir, struct dentry * dentry)
@@ -910,6 +868,7 @@ struct dentry *proc_pid_lookup(struct inode *dir, struct dentry * dentry)
goto out;
inode->i_mode = S_IFDIR|S_IRUGO|S_IXUGO;
inode->i_op = &proc_base_inode_operations;
+ inode->i_fop = &proc_base_operations;
inode->i_nlink = 3;
inode->i_flags|=S_IMMUTABLE;
diff --git a/fs/proc/generic.c b/fs/proc/generic.c
index ad42f4fbc..fcfadbc99 100644
--- a/fs/proc/generic.c
+++ b/fs/proc/generic.c
@@ -37,10 +37,6 @@ static struct file_operations proc_file_operations = {
write: proc_file_write,
};
-static struct inode_operations proc_file_inode_operations = {
- &proc_file_operations, /* default proc file-ops */
-};
-
#ifndef MIN
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
#endif
@@ -343,10 +339,8 @@ static struct file_operations proc_dir_operations = {
/*
* proc directories can do almost nothing..
*/
-struct inode_operations proc_dir_inode_operations = {
- &proc_dir_operations, /* default net directory file-ops */
- NULL, /* create */
- proc_lookup, /* lookup */
+static struct inode_operations proc_dir_inode_operations = {
+ lookup: proc_lookup,
};
int proc_register(struct proc_dir_entry * dir, struct proc_dir_entry * dp)
@@ -361,15 +355,17 @@ int proc_register(struct proc_dir_entry * dir, struct proc_dir_entry * dp)
dp->parent = dir;
dir->subdir = dp;
if (S_ISDIR(dp->mode)) {
- if (dp->ops == NULL)
- dp->ops = &proc_dir_inode_operations;
+ if (dp->proc_iops == NULL) {
+ dp->proc_fops = &proc_dir_operations;
+ dp->proc_iops = &proc_dir_inode_operations;
+ }
dir->nlink++;
} else if (S_ISLNK(dp->mode)) {
- if (dp->ops == NULL)
- dp->ops = &proc_link_inode_operations;
+ if (dp->proc_iops == NULL)
+ dp->proc_iops = &proc_link_inode_operations;
} else if (S_ISREG(dp->mode)) {
- if (dp->ops == NULL)
- dp->ops = &proc_file_inode_operations;
+ if (dp->proc_fops == NULL)
+ dp->proc_fops = &proc_file_operations;
}
return 0;
}
@@ -490,7 +486,8 @@ struct proc_dir_entry *proc_mkdir(const char *name, struct proc_dir_entry *paren
memcpy(((char *) ent) + sizeof(*ent), fn, len + 1);
ent->name = ((char *) ent) + sizeof(*ent);
ent->namelen = len;
- ent->ops = &proc_dir_inode_operations;
+ ent->proc_fops = &proc_dir_operations;
+ ent->proc_iops = &proc_dir_inode_operations;
ent->nlink = 2;
ent->mode = S_IFDIR | S_IRUGO | S_IXUGO;
@@ -522,7 +519,8 @@ struct proc_dir_entry *create_proc_entry(const char *name, mode_t mode,
if (S_ISDIR(mode)) {
if ((mode & S_IALLUGO) == 0)
mode |= S_IRUGO | S_IXUGO;
- ent->ops = &proc_dir_inode_operations;
+ ent->proc_fops = &proc_dir_operations;
+ ent->proc_iops = &proc_dir_inode_operations;
ent->nlink = 2;
} else {
if ((mode & S_IFMT) == 0)
diff --git a/fs/proc/inode.c b/fs/proc/inode.c
index ffe846e5c..84a23a7f5 100644
--- a/fs/proc/inode.c
+++ b/fs/proc/inode.c
@@ -95,10 +95,6 @@ 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;
@@ -120,15 +116,11 @@ static int proc_statfs(struct super_block *sb, struct statfs *buf, int bufsiz)
}
static struct super_operations proc_sops = {
- proc_read_inode,
- proc_write_inode,
- proc_put_inode,
- proc_delete_inode, /* delete_inode(struct inode *) */
- NULL,
- proc_put_super,
- NULL,
- proc_statfs,
- NULL
+ read_inode: proc_read_inode,
+ put_inode: proc_put_inode,
+ delete_inode: proc_delete_inode,
+ put_super: proc_put_super,
+ statfs: proc_statfs,
};
@@ -195,8 +187,12 @@ printk("proc_iget: using deleted entry %s, count=%d\n", de->name, de->count);
__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;
+ else {
+ if (de->proc_iops)
+ inode->i_op = de->proc_iops;
+ if (de->proc_fops)
+ inode->i_fop = de->proc_fops;
+ }
}
out:
diff --git a/fs/proc/kcore.c b/fs/proc/kcore.c
index 01ac4fe2a..13ec76b02 100644
--- a/fs/proc/kcore.c
+++ b/fs/proc/kcore.c
@@ -26,15 +26,11 @@ static int open_kcore(struct inode * inode, struct file * filp)
static ssize_t read_kcore(struct file *, char *, size_t, loff_t *);
-static struct file_operations proc_kcore_operations = {
+struct file_operations proc_kcore_operations = {
read: read_kcore,
open: open_kcore,
};
-struct inode_operations proc_kcore_inode_operations = {
- &proc_kcore_operations,
-};
-
#ifdef CONFIG_KCORE_AOUT
static ssize_t read_kcore(struct file *file, char *buf, size_t count, loff_t *ppos)
{
@@ -323,7 +319,7 @@ static ssize_t read_kcore(struct file *file, char *buffer, size_t buflen, loff_t
* and after elf_kcore_store_hdr() returns.
* For now assume that num_vma does not change (TA)
*/
- proc_root_kcore.size = size = get_kcore_size(&num_vma, &elf_buflen);
+ proc_root_kcore->size = size = get_kcore_size(&num_vma, &elf_buflen);
if (buflen == 0 || *fpos >= size)
return 0;
diff --git a/fs/proc/kmsg.c b/fs/proc/kmsg.c
index a8fe0fc3c..149ad0aaa 100644
--- a/fs/proc/kmsg.c
+++ b/fs/proc/kmsg.c
@@ -45,13 +45,9 @@ static unsigned int kmsg_poll(struct file *file, poll_table * wait)
}
-static struct file_operations proc_kmsg_operations = {
+struct file_operations proc_kmsg_operations = {
read: kmsg_read,
poll: kmsg_poll,
open: kmsg_open,
release: kmsg_release,
};
-
-struct inode_operations proc_kmsg_inode_operations = {
- &proc_kmsg_operations, /* default base directory file-ops */
-};
diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c
index 3ad4bfabf..1f7ba6b99 100644
--- a/fs/proc/proc_misc.c
+++ b/fs/proc/proc_misc.c
@@ -598,28 +598,11 @@ static struct file_operations proc_profile_operations = {
write: write_profile,
};
-static struct inode_operations proc_profile_inode_operations = {
- &proc_profile_operations,
-};
-
-static struct proc_dir_entry proc_root_kmsg = {
- 0, 4, "kmsg",
- S_IFREG | S_IRUSR, 1, 0, 0,
- 0, &proc_kmsg_inode_operations
-};
-struct proc_dir_entry proc_root_kcore = {
- 0, 5, "kcore",
- S_IFREG | S_IRUSR, 1, 0, 0,
- 0, &proc_kcore_inode_operations
-};
-static struct proc_dir_entry proc_root_profile = {
- 0, 7, "profile",
- S_IFREG | S_IRUGO | S_IWUSR, 1, 0, 0,
- 0, &proc_profile_inode_operations
-};
+struct proc_dir_entry *proc_root_kcore;
void __init proc_misc_init(void)
{
+ struct proc_dir_entry *entry;
static struct {
char *name;
int (*read_proc)(char*,char**,off_t,int,int*,void*);
@@ -665,11 +648,25 @@ void __init proc_misc_init(void)
create_proc_read_entry(p->name, 0, NULL, p->read_proc, NULL);
/* And now for trickier ones */
- proc_register(&proc_root, &proc_root_kmsg);
- proc_register(&proc_root, &proc_root_kcore);
- proc_root_kcore.size = (size_t)high_memory - PAGE_OFFSET + PAGE_SIZE;
+ entry = create_proc_entry("kmsg", S_IRUSR, &proc_root);
+ if (entry)
+ entry->proc_fops = &proc_kmsg_operations;
+ proc_root_kcore = create_proc_entry("kcore", S_IRUSR, NULL);
+ if (proc_root_kcore) {
+ proc_root_kcore->proc_fops = &proc_kcore_operations;
+ proc_root_kcore->size =
+ (size_t)high_memory - PAGE_OFFSET + PAGE_SIZE;
+ }
if (prof_shift) {
- proc_register(&proc_root, &proc_root_profile);
- proc_root_profile.size = (1+prof_len) * sizeof(unsigned int);
+ entry = create_proc_entry("profile", S_IWUSR | S_IRUGO, NULL);
+ if (entry) {
+ entry->proc_fops = &proc_profile_operations;
+ entry->size = (1+prof_len) * sizeof(unsigned int);
+ }
}
+#ifdef __powerpc__
+ entry = create_proc_entry("ppc_htab", S_IRUGO|S_IWUSR, NULL);
+ if (entry)
+ entry->proc_fops = &ppc_htab_operations;
+#endif
}
diff --git a/fs/proc/root.c b/fs/proc/root.c
index 8bacabed2..6cdb2ad19 100644
--- a/fs/proc/root.c
+++ b/fs/proc/root.c
@@ -51,13 +51,6 @@ static struct proc_dir_entry proc_root_self = {
S_IFLNK | S_IRUGO | S_IWUGO | S_IXUGO, 1, 0, 0,
64, &proc_self_inode_operations,
};
-#ifdef __powerpc__
-static struct proc_dir_entry proc_root_ppc_htab = {
- 0, 8, "ppc_htab",
- S_IFREG | S_IRUGO|S_IWUSR, 1, 0, 0,
- 0, &proc_ppc_htab_inode_operations,
-};
-#endif
void __init proc_root_init(void)
{
@@ -143,16 +136,14 @@ static int proc_root_readdir(struct file * filp,
* directory handling functions for that..
*/
static struct file_operations proc_root_operations = {
- readdir: proc_root_readdir,
+ readdir: proc_root_readdir,
};
/*
* proc root can do almost nothing..
*/
static struct inode_operations proc_root_inode_operations = {
- &proc_root_operations, /* default base directory file-ops */
- NULL, /* create */
- proc_root_lookup, /* lookup */
+ lookup: proc_root_lookup,
};
/*
@@ -161,7 +152,7 @@ static struct inode_operations proc_root_inode_operations = {
struct proc_dir_entry proc_root = {
PROC_ROOT_INO, 5, "/proc",
S_IFDIR | S_IRUGO | S_IXUGO, 2, 0, 0,
- 0, &proc_root_inode_operations,
+ 0, &proc_root_inode_operations, &proc_root_operations,
NULL, NULL,
NULL,
&proc_root, NULL