X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=arch%2Fppc64%2Fkernel%2Fmf_proc.c;h=f98f35569dee313b8e2ff8ae0f158dd09c4b0040;hb=c7b5ebbddf7bcd3651947760f423e3783bbe6573;hp=5d48ce84a0b10aea0aa40f68b51065a9a36313fd;hpb=9213980e6a70d8473e0ffd4b39ab5b6caaba9ff5;p=linux-2.6.git diff --git a/arch/ppc64/kernel/mf_proc.c b/arch/ppc64/kernel/mf_proc.c index 5d48ce84a..f98f35569 100644 --- a/arch/ppc64/kernel/mf_proc.c +++ b/arch/ppc64/kernel/mf_proc.c @@ -25,33 +25,26 @@ static int proc_mf_dump_cmdline(char *page, char **start, off_t off, { int len = count; char *p; - + + if (off) { + *eof = 1; + return 0; + } + len = mf_getCmdLine(page, &len, (u64)data); - p = page + len - 1; - while (p > page) { - if ((*p == 0) || (*p == ' ')) - --p; - else + p = page; + while (len < (count - 1)) { + if (!*p || *p == '\n') break; + p++; + len++; } - if (*p != '\n') { - ++p; - *p = '\n'; - } - ++p; + *p = '\n'; + p++; *p = 0; - len = p - page; - - len -= off; - if (len < count) { - *eof = 1; - if (len <= 0) - return 0; - } else - len = count; - *start = page + off; - return len; + + return p - page; } #if 0 @@ -174,22 +167,29 @@ static int proc_mf_change_cmdline(struct file *file, const char *buffer, 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; @@ -225,20 +225,7 @@ static int __init mf_proc_init(void) 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);