Commit 0463210d authored by Dave Boutcher's avatar Dave Boutcher Committed by Linus Torvalds

[PATCH] ppc64: mf_proc file position fix

arch/ppc64/kernel/mf_proc.c uses a bad interface for moving along file
position in a proc_write routine.  This quit working altogether in 2.6.8.
Patch to fix.  And I did a quick scan of the kernel to see if anyone else
was similarly broken...apparantly not :-)

Fixes a broken update of f_pos in a proc file write routine.
Signed-off-by: default avatarDave Boutcher <sleddog@us.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 9f3f3558
...@@ -167,22 +167,29 @@ static int proc_mf_change_cmdline(struct file *file, const char *buffer, ...@@ -167,22 +167,29 @@ static int proc_mf_change_cmdline(struct file *file, const char *buffer,
return count; return count;
} }
static int proc_mf_change_vmlinux(struct file *file, const char *buffer, static ssize_t proc_mf_change_vmlinux(struct file *file,
unsigned long count, void *data) const char __user *buf,
size_t count, loff_t *ppos)
{ {
struct inode * inode = file->f_dentry->d_inode;
struct proc_dir_entry * dp = PDE(inode);
int rc; int rc;
if (!capable(CAP_SYS_ADMIN)) if (!capable(CAP_SYS_ADMIN))
return -EACCES; return -EACCES;
rc = mf_setVmlinuxChunk(buffer, count, file->f_pos, (u64)data); rc = mf_setVmlinuxChunk(buf, count, *ppos, (u64)dp->data);
if (rc < 0) if (rc < 0)
return rc; return rc;
file->f_pos += count; *ppos += count;
return count; return count;
} }
static struct file_operations proc_vmlinux_operations = {
.write = proc_mf_change_vmlinux,
};
static int __init mf_proc_init(void) static int __init mf_proc_init(void)
{ {
struct proc_dir_entry *mf_proc_root; struct proc_dir_entry *mf_proc_root;
...@@ -218,20 +225,7 @@ static int __init mf_proc_init(void) ...@@ -218,20 +225,7 @@ static int __init mf_proc_init(void)
return 1; return 1;
ent->nlink = 1; ent->nlink = 1;
ent->data = (void *)(long)i; ent->data = (void *)(long)i;
#if 0 ent->proc_fops = &proc_vmlinux_operations;
if (i == 3) {
/*
* if we had a 'D' vmlinux entry, it would only
* be readable.
*/
ent->read_proc = proc_mf_dump_vmlinux;
ent->write_proc = NULL;
} else
#endif
{
ent->write_proc = proc_mf_change_vmlinux;
ent->read_proc = NULL;
}
} }
ent = create_proc_entry("side", S_IFREG|S_IRUSR|S_IWUSR, mf_proc_root); ent = create_proc_entry("side", S_IFREG|S_IRUSR|S_IWUSR, mf_proc_root);
......
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