]> git.karo-electronics.de Git - karo-tx-linux.git/commit
vmcore: calculate vmcore file size from buffer size and total size of vmcore objects
authorHATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
Wed, 19 Jun 2013 00:06:09 +0000 (10:06 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 19 Jun 2013 07:13:06 +0000 (17:13 +1000)
commit5d8d108ea5a1a75b5061dd48f184bc6c8ffc8a48
tree0e8b85e95b55d7e4519b6e3b7f0a533238496c30
parent9387b3d8592b86630b817b3d68bdd77d217f2da2
vmcore: calculate vmcore file size from buffer size and total size of vmcore objects

The previous patches newly added holes before each chunk of memory and the
holes need to be count in vmcore file size.  There are two ways to count
file size in such a way:

1) suppose m is a poitner to the last vmcore object in vmcore_list.
   Then file size is (m->offset + m->size), or

2) calculate sum of size of buffers for ELF header, program headers,
   ELF note segments and objects in vmcore_list.

Although 1) is more direct and simpler than 2), 2) seems better in that it
reflects internal object structure of /proc/vmcore.  Thus, this patch
changes get_vmcore_size_elf{64, 32} so that it calculates size in the way
of 2).

As a result, both get_vmcore_size_elf{64, 32} have the same definition.
Merge them as get_vmcore_size.

Signed-off-by: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
Acked-by: Vivek Goyal <vgoyal@redhat.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Atsushi Kumagai <kumagai-atsushi@mxc.nes.nec.co.jp>
Cc: Lisa Mitchell <lisa.mitchell@hp.com>
Cc: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
fs/proc/vmcore.c