This patch has been generated by applying flynt to the gem5 repo (ext has been excluded) JIRA: https://gem5.atlassian.net/browse/GEM5-831 Change-Id: I0935db6223d5426b99515959bde78e374cbadb04 Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com> Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/68957 Maintainer: Bobby Bruce <bbruce@ucdavis.edu> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
36 lines
1.1 KiB
Python
36 lines
1.1 KiB
Python
# http://stackoverflow.com/questions/15069127/python-configparser-module-\
|
|
# rename-a-section
|
|
def rename_section(cp, section_from, section_to):
|
|
items = cp.items(section_from)
|
|
cp.add_section(section_to)
|
|
for item in items:
|
|
cp.set(section_to, item[0], item[1])
|
|
cp.remove_section(section_from)
|
|
|
|
|
|
# Checkpoint version F renames an internal member of Process class.
|
|
def upgrader(cpt):
|
|
import re
|
|
|
|
for sec in cpt.sections():
|
|
fdm = "FdMap"
|
|
fde = "FDEntry"
|
|
if re.match(f".*\\.{fdm}.*", sec):
|
|
rename = re.sub(fdm, fde, sec)
|
|
split = re.split(fde, rename)
|
|
|
|
# rename the section and add the 'mode' field
|
|
rename_section(cpt, sec, rename)
|
|
cpt.set(rename, "mode", "0") # no proper value to set :(
|
|
|
|
# add in entries 257 to 1023
|
|
if split[1] == "0":
|
|
for x in range(257, 1024):
|
|
seq = (split[0], fde, f"{x}")
|
|
section = "".join(seq)
|
|
cpt.add_section(section)
|
|
cpt.set(section, "fd", "-1")
|
|
|
|
|
|
legacy_version = 15
|