recordmcount: Clarify what cleanup() does
authorMatt Helsley <mhelsley@vmware.com>
Wed, 31 Jul 2019 18:24:16 +0000 (11:24 -0700)
committerSteven Rostedt (VMware) <rostedt@goodmis.org>
Sat, 31 Aug 2019 16:19:40 +0000 (12:19 -0400)
commit4fbcf0741697a75eb766835cb34836cf4f3803da
treef7756cb891050d01290851512e2ca26549c6b3d6
parentc97fea26254b284c93a67b788968622f9cc03b30
recordmcount: Clarify what cleanup() does

cleanup() mostly frees/unmaps the malloc'd/privately-mapped
copy of the ELF file recordmcount is working on, which is
set up in mmap_file(). It also deals with positioning within
the pseduo prive-mapping of the file and appending to the ELF
file.

Split into two steps:
mmap_cleanup() for the mapping itself
file_append_cleanup() for allocations storing the
appended ELF data.

Also, move the global variable initializations out of the main,
per-object-file loop and nearer to the alloc/init (mmap_file())
and two cleanup functions so we can more clearly see how they're
related.

Link: http://lkml.kernel.org/r/2a387ac86d133d22c68f57b9933c32bab1d09a2d.1564596289.git.mhelsley@vmware.com
Signed-off-by: Matt Helsley <mhelsley@vmware.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
scripts/recordmcount.c