From: Dave C Boutcher <sleddog@us.ibm.com>
To: linux-kernel@vger.kernel.org
Cc: paulus@samba.org, akpm@osdl.org, ipseries-list@redhat.com
Subject: [PATCH] ppc64 mf_proc file position fix
Date: Fri, 20 Aug 2004 15:10:32 -0500 [thread overview]
Message-ID: <20040820201032.GA14005@cs.umn.edu> (raw)
Andrew,
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: Dave Boutcher <sleddog@us.ibm.com>
--- linux-2.6.8.1/arch/ppc64/kernel/mf_proc.c.orig 2004-08-20 10:37:09.000000000 -0500
+++ linux-2.6.8.1/arch/ppc64/kernel/mf_proc.c 2004-08-20 14:16:01.000000000 -0500
@@ -168,22 +168,29 @@
return count;
}
-static int proc_mf_change_vmlinux(struct file *file, const char *buffer,
- unsigned long count, void *data)
+static ssize_t proc_mf_change_vmlinux(struct file *file,
+ 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;
if (!capable(CAP_SYS_ADMIN))
return -EACCES;
- rc = mf_setVmlinuxChunk(buffer, count, file->f_pos, (u64)data);
+ rc = mf_setVmlinuxChunk(buf, count, *ppos, (u64)dp->data);
if (rc < 0)
return rc;
- file->f_pos += count;
+ *ppos += count;
return count;
}
+static struct file_operations proc_vmlinux_operations = {
+ .write = proc_mf_change_vmlinux,
+};
+
static int __init mf_proc_init(void)
{
struct proc_dir_entry *mf_proc_root;
@@ -219,20 +226,7 @@
return 1;
ent->nlink = 1;
ent->data = (void *)(long)i;
-#if 0
- 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->proc_fops = &proc_vmlinux_operations;
}
ent = create_proc_entry("side", S_IFREG|S_IRUSR|S_IWUSR, mf_proc_root);
--
Dave Boutcher
next reply other threads:[~2004-08-20 20:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-08-20 20:10 Dave C Boutcher [this message]
2004-08-23 17:54 ` [PATCH] ppc64 mf_proc file position fix Christoph Hellwig
2004-08-23 18:18 ` Dave C Boutcher
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040820201032.GA14005@cs.umn.edu \
--to=sleddog@us.ibm.com \
--cc=akpm@osdl.org \
--cc=ipseries-list@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=paulus@samba.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox