dump_skip(): dump_seek() replacement taking coredump_params
Subsystems (3)
RFC PATCH 11/13 dump_skip(): dump_seek() replacement taking coredump_params
--- arch/x86/ia32/ia32_aout.c | 2 +- fs/binfmt_aout.c | 2 +- fs/binfmt_elf.c | 4 ++-- fs/binfmt_elf_fdpic.c | 11 +++-------- fs/coredump.c | 43 ++++++++++++++----------------------------- include/linux/coredump.h | 3 +-- 6 files changed, 22 insertions(+), 43 deletions(-)
arch/x86/ia32/ia32_aout.c +1 -1
@@ -187,7 +187,7 @@ static int aout_core_dump(struct coredump_params *cprm)if (!dump_emit (cprm, &dump,sizeof (dump))) goto end_coredump;/* Now dump all of the user data. Include malloced stuff as well */ -if (!dump_seek (cprm->file,PAGE_SIZE -sizeof (dump))) +if (!dump_skip (cprm,PAGE_SIZE -sizeof (dump))) goto end_coredump;/* now we start writing out the user space info */ set_fs (USER_DS );
fs/binfmt_aout.c +1 -1
@@ -87,7 +87,7 @@ static int aout_core_dump(struct coredump_params *cprm)if (!dump_emit (cprm, &dump,sizeof (dump))) goto end_coredump;/* Now dump all of the user data. Include malloced stuff as well */ -if (!dump_seek (cprm->file,PAGE_SIZE -sizeof (dump))) +if (!dump_skip (cprm,PAGE_SIZE -sizeof (dump))) goto end_coredump;/* now we start writing out the user space info */ set_fs (USER_DS );
fs/binfmt_elf.c +2 -2
@@ -2162,7 +2162,7 @@ static int elf_core_dump(struct coredump_params *cprm) goto end_coredump;/* Align to page */ -if (!dump_seek (cprm->file, dataoff - cprm->written)) +if (!dump_skip (cprm, dataoff - cprm->written)) goto end_coredump; for (vma = first_vma(current, gate_vma); vma != NULL;
@@ -2183,7 +2183,7 @@ static int elf_core_dump(struct coredump_params *cprm)kunmap (page);page_cache_release (page); }else - stop = !dump_seek (cprm->file,PAGE_SIZE ); + stop = !dump_skip (cprm,PAGE_SIZE );if (stop) goto end_coredump; }
fs/binfmt_elf_fdpic.c +3 -8
@@ -1510,7 +1510,7 @@ static bool elf_fdpic_dump_segments(struct coredump_params *cprm,kunmap (page);page_cache_release (page); }else { - res =dump_seek (file,PAGE_SIZE ); + res =dump_skip (cprm,PAGE_SIZE ); }if (!res)return false;
@@ -1548,11 +1548,10 @@ static int elf_fdpic_core_dump(struct coredump_params *cprm)int has_dumped =0 ;mm_segment_t fs;int segs; -size_t size =0 ;int i;struct vm_area_struct *vma;struct elfhdr *elf =NULL ; -loff_t offset =0 , dataoff, foffset; +loff_t offset =0 , dataoff;int numnote;struct memelfnote *notes =NULL ;struct elf_prstatus *prstatus =NULL ;/* NT_PRSTATUS */
@@ -1683,7 +1682,6 @@ static int elf_fdpic_core_dump(struct coredump_params *cprm) offset +=sizeof (*elf);/* Elf header */ offset += segs *sizeof (struct elf_phdr );/* Program headers */ - foffset = offset;/* Write notes phdr entry */ {
@@ -1752,8 +1750,6 @@ static int elf_fdpic_core_dump(struct coredump_params *cprm)if (!elf_core_write_extra_phdrs (cprm, offset)) goto end_coredump; - size = cprm->written; - cprm->written = foffset;/* write out the notes section */ for (i =0 ; i < numnote; i++)if (!writenote (notes + i, cprm))
@@ -1769,10 +1765,9 @@ static int elf_fdpic_core_dump(struct coredump_params *cprm) goto end_coredump; } -if (!dump_seek (cprm->file, dataoff - cprm->written)) +if (!dump_skip (cprm->file, dataoff - cprm->written)) goto end_coredump; - cprm->written = size;if (!elf_fdpic_dump_segments (cprm)) goto end_coredump;
fs/coredump.c +14 -29
60 lines not on this page · raw message
include/linux/coredump.h +1 -2
@@ -11,8 +11,7 @@* functions to write out all the necessary info. */ struct coredump_params ; -extern int dump_write (struct file *file,const void *addr,int nr); -extern int dump_seek (struct file *file,loff_t off); +extern int dump_skip (struct coredump_params *cprm,size_t nr);extern int dump_emit (struct coredump_params *cprm,const void *addr,int nr);#ifdef CONFIG_COREDUMP extern void do_coredump (siginfo_t *siginfo);
Signature · 1 line
1.7.2.5
Hi Al,
fs/coredump.c int dump_emit(struct coredump_params *cprm, const void *addr, int nr) · line 711
Quoted 13 lines · Al Viro
fs/coredump.c +2
-3@@ -714,32 +706,25 @@ int dump_emit(struct coredump_params *cprm, const void *addr, int nr) }EXPORT_SYMBOL (dump_emit); -int dump_seek (struct file *file,loff_t off) +int dump_skip (struct coredump_params *cprm,size_t nr) { -int ret =1 ; - +static char zeroes[PAGE_SIZE ];
Do we really need this to be static?
It's at the top of my v3.12.. bloat-o-meter report:
function old new delta
static.zeroes - 4096 +4096
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds