GIT 9091dea557420ec71fa23d8059024607e2e5ecd3 git+ssh://master.kernel.org/pub/scm/linux/kernel/git/kyle/parisc-2.6.git#master commit Author: Alexey Dobriyan Date: Sat Mar 17 19:28:27 2007 +0300 parisc: convert /proc/gsc/pcxl_dma to seq_file As side effect, remove one more ->get_info user and a novel approach of content generation: sprintf(buf, "%sfoo", buf, ...); sprintf(buf, "%sbar", buf, ...); ... Compile-tested. Signed-off-by: Alexey Dobriyan Signed-off-by: Kyle McMartin commit 75d9fb99c9428c7a485b2ff7fd1c08606a700a84 Author: Kyle McMartin Date: Sat Mar 17 11:17:31 2007 -0400 [PARISC] Wire up kexec_load syscall Definitely unimplemented at this point and will just trap to sys_ni_syscall... Signed-off-by: Kyle McMartin commit 47489e6820be06eb56ff316fedffc200d4c1e0b3 Author: Kyle McMartin Date: Sat Mar 17 11:15:01 2007 -0400 [PARISC] Move #undef to end of syscall table Signed-off-by: Kyle McMartin commit 7a0db34470039284350bbc4a1d5f7002d01fc382 Author: Alexandr Andreev Date: Tue Mar 6 02:44:13 2007 -0800 parisc: sync compat getdents Add VERIFY_WRITE check in the beginning like compat_sys_getdents() EFAULT on parisc if put_user() fails. Signed-off-by: Alexandr Andreev Signed-off-by: Alexey Dobriyan Cc: Kyle McMartin Cc: Matthew Wilcox Cc: Grant Grundler Signed-off-by: Andrew Morton Signed-off-by: Kyle McMartin commit a1adb1fdd50e4fd2b1b089de90ef031e28b560cc Author: Alexey Dobriyan Date: Sat Mar 3 01:13:35 2007 +0000 parisc: make command_line[] static Signed-off-by: Alexey Dobriyan Signed-off-by: Andrew Morton Signed-off-by: Kyle McMartin arch/parisc/kernel/pci-dma.c | 94 ++++++++++++++++++++---------------- arch/parisc/kernel/setup.c | 2 - arch/parisc/kernel/sys_parisc32.c | 10 +++- arch/parisc/kernel/syscall_table.S | 11 ++-- include/asm-parisc/unistd.h | 3 + 5 files changed, 70 insertions(+), 50 deletions(-) diff --git a/arch/parisc/kernel/pci-dma.c b/arch/parisc/kernel/pci-dma.c index 0c3aecb..23c1388 100644 --- a/arch/parisc/kernel/pci-dma.c +++ b/arch/parisc/kernel/pci-dma.c @@ -21,6 +21,7 @@ #include #include #include #include +#include #include #include #include @@ -34,7 +35,6 @@ #include #include /* for purge_tlb_*() macros */ static struct proc_dir_entry * proc_gsc_root __read_mostly = NULL; -static int pcxl_proc_info(char *buffer, char **start, off_t offset, int length); static unsigned long pcxl_used_bytes __read_mostly = 0; static unsigned long pcxl_used_pages __read_mostly = 0; @@ -330,6 +330,54 @@ pcxl_free_range(unsigned long vaddr, siz dump_resmap(); } +static int proc_pcxl_dma_show(struct seq_file *m, void *v) +{ +#if 0 + u_long i = 0; + unsigned long *res_ptr = (u_long *)pcxl_res_map; +#endif + unsigned long total_pages = pcxl_res_size << 3; /* 8 bits per byte */ + + seq_printf(m, "\nDMA Mapping Area size : %d bytes (%ld pages)\n", + PCXL_DMA_MAP_SIZE, total_pages); + + seq_printf(m, "Resource bitmap : %d bytes\n", pcxl_res_size); + + seq_puts(m, " total: free: used: % used:\n"); + seq_printf(m, "blocks %8d %8ld %8ld %8ld%%\n", pcxl_res_size, + pcxl_res_size - pcxl_used_bytes, pcxl_used_bytes, + (pcxl_used_bytes * 100) / pcxl_res_size); + + seq_printf(m, "pages %8ld %8ld %8ld %8ld%%\n", total_pages, + total_pages - pcxl_used_pages, pcxl_used_pages, + (pcxl_used_pages * 100 / total_pages)); + +#if 0 + seq_puts(m, "\nResource bitmap:"); + + for(; i < (pcxl_res_size / sizeof(u_long)); ++i, ++res_ptr) { + if ((i & 7) == 0) + seq_puts(m,"\n "); + seq_printf(m, "%s %08lx", buf, *res_ptr); + } +#endif + seq_putc(m, '\n'); + return 0; +} + +static int proc_pcxl_dma_open(struct inode *inode, struct file *file) +{ + return single_open(file, proc_pcxl_dma_show, NULL); +} + +static const struct file_operations proc_pcxl_dma_ops = { + .owner = THIS_MODULE, + .open = proc_pcxl_dma_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; + static int __init pcxl_dma_init(void) { @@ -348,9 +396,10 @@ pcxl_dma_init(void) "pcxl_dma_init: Unable to create gsc /proc dir entry\n"); else { struct proc_dir_entry* ent; - ent = create_proc_info_entry("pcxl_dma", 0, - proc_gsc_root, pcxl_proc_info); - if (!ent) + ent = create_proc_entry("pcxl_dma", 0, proc_gsc_root); + if (ent) + ent->proc_fops = &proc_pcxl_dma_ops; + else printk(KERN_WARNING "pci-dma.c: Unable to create pcxl_dma /proc entry.\n"); } @@ -551,40 +600,3 @@ struct hppa_dma_ops pcx_dma_ops = { .dma_sync_sg_for_cpu = pa11_dma_sync_sg_for_cpu, .dma_sync_sg_for_device = pa11_dma_sync_sg_for_device, }; - - -static int pcxl_proc_info(char *buf, char **start, off_t offset, int len) -{ -#if 0 - u_long i = 0; - unsigned long *res_ptr = (u_long *)pcxl_res_map; -#endif - unsigned long total_pages = pcxl_res_size << 3; /* 8 bits per byte */ - - sprintf(buf, "\nDMA Mapping Area size : %d bytes (%ld pages)\n", - PCXL_DMA_MAP_SIZE, total_pages); - - sprintf(buf, "%sResource bitmap : %d bytes\n", buf, pcxl_res_size); - - strcat(buf, " total: free: used: % used:\n"); - sprintf(buf, "%sblocks %8d %8ld %8ld %8ld%%\n", buf, pcxl_res_size, - pcxl_res_size - pcxl_used_bytes, pcxl_used_bytes, - (pcxl_used_bytes * 100) / pcxl_res_size); - - sprintf(buf, "%spages %8ld %8ld %8ld %8ld%%\n", buf, total_pages, - total_pages - pcxl_used_pages, pcxl_used_pages, - (pcxl_used_pages * 100 / total_pages)); - -#if 0 - strcat(buf, "\nResource bitmap:"); - - for(; i < (pcxl_res_size / sizeof(u_long)); ++i, ++res_ptr) { - if ((i & 7) == 0) - strcat(buf,"\n "); - sprintf(buf, "%s %08lx", buf, *res_ptr); - } -#endif - strcat(buf, "\n"); - return strlen(buf); -} - diff --git a/arch/parisc/kernel/setup.c b/arch/parisc/kernel/setup.c index 9818919..b570348 100644 --- a/arch/parisc/kernel/setup.c +++ b/arch/parisc/kernel/setup.c @@ -45,7 +45,7 @@ #include #include #include -char __initdata command_line[COMMAND_LINE_SIZE]; +static char __initdata command_line[COMMAND_LINE_SIZE]; /* Intended for ccio/sba/cpu statistics under /proc/bus/{runway|gsc} */ struct proc_dir_entry * proc_runway_root __read_mostly = NULL; diff --git a/arch/parisc/kernel/sys_parisc32.c b/arch/parisc/kernel/sys_parisc32.c index ce3245f..a8ebac4 100644 --- a/arch/parisc/kernel/sys_parisc32.c +++ b/arch/parisc/kernel/sys_parisc32.c @@ -350,6 +350,10 @@ sys32_getdents (unsigned int fd, void __ struct getdents32_callback buf; int error; + error = -EFAULT; + if (!access_ok(VERIFY_WRITE, dirent, count)) + goto out; + error = -EBADF; file = fget(fd); if (!file) @@ -366,8 +370,10 @@ sys32_getdents (unsigned int fd, void __ error = buf.error; lastdirent = buf.previous; if (lastdirent) { - put_user(file->f_pos, &lastdirent->d_off); - error = count - buf.count; + if (put_user(file->f_pos, &lastdirent->d_off)) + error = -EFAULT; + else + error = count - buf.count; } out_putf: diff --git a/arch/parisc/kernel/syscall_table.S b/arch/parisc/kernel/syscall_table.S index 8bf87e5..7e04db6 100644 --- a/arch/parisc/kernel/syscall_table.S +++ b/arch/parisc/kernel/syscall_table.S @@ -30,11 +30,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#undef ENTRY_SAME -#undef ENTRY_DIFF -#undef ENTRY_UHOH -#undef ENTRY_COMP -#undef ENTRY_OURS #if defined(CONFIG_64BIT) && !defined(SYSCALL_TABLE_64BIT) /* Use ENTRY_SAME for 32-bit syscalls which are the same on wide and * narrow palinux. Use ENTRY_DIFF for those where a 32-bit specific @@ -405,5 +400,11 @@ #endif ENTRY_SAME(epoll_pwait) ENTRY_COMP(statfs64) ENTRY_COMP(fstatfs64) + ENTRY_COMP(kexec_load) /* 300 */ /* Nothing yet */ +#undef ENTRY_SAME +#undef ENTRY_DIFF +#undef ENTRY_UHOH +#undef ENTRY_COMP +#undef ENTRY_OURS diff --git a/include/asm-parisc/unistd.h b/include/asm-parisc/unistd.h index 2f7c408..693743f 100644 --- a/include/asm-parisc/unistd.h +++ b/include/asm-parisc/unistd.h @@ -792,8 +792,9 @@ #define __NR_getcpu (__NR_Linux + 296) #define __NR_epoll_pwait (__NR_Linux + 297) #define __NR_statfs64 (__NR_Linux + 298) #define __NR_fstatfs64 (__NR_Linux + 299) +#define __NR_kexec_load (__NR_Linux + 300) -#define __NR_Linux_syscalls (__NR_fstatfs64 + 1) +#define __NR_Linux_syscalls (__NR_kexec_load + 1) #define HPUX_GATEWAY_ADDR 0xC0000004 #define LINUX_GATEWAY_ADDR 0x100