summaryrefslogtreecommitdiff
path: root/src/sim/fd_array.cc
diff options
context:
space:
mode:
authorBrandon Potter <brandon.potter@amd.com>2018-04-18 14:42:31 -0400
committerAnthony Gutierrez <anthony.gutierrez@amd.com>2018-09-19 20:53:13 +0000
commitaa56ed4dc50255869e72b9399c671c21d88e88d4 (patch)
tree8d0b2e405e6a2334c505b8581dc7cedd728ec2e6 /src/sim/fd_array.cc
parent194d650536cb49c374efdb1fe0473b3eec5dea1e (diff)
downloadgem5-aa56ed4dc50255869e72b9399c671c21d88e88d4.tar.xz
syscall_emul: style changes and FDArray refactor
Some members were defined as public when they should have been privately declared so these were moved to the appropriate spot. The operator[] had inline specified for for an in-class definition which is redundant since inline definitions are always implicitly inline. Private members had the leading underscore applied to them to denote that they're private (consistent with style guide). Changed static const defined class variable into a constexpr with brace-list initialization. Change-Id: If3054416b57827d1542e9ebab428d67d0e767723 Reviewed-on: https://gem5-review.googlesource.com/12110 Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Maintainer: Jason Lowe-Power <jason@lowepower.com>
Diffstat (limited to 'src/sim/fd_array.cc')
-rw-r--r--src/sim/fd_array.cc30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/sim/fd_array.cc b/src/sim/fd_array.cc
index 174236e3e..0600e9ffe 100644
--- a/src/sim/fd_array.cc
+++ b/src/sim/fd_array.cc
@@ -48,15 +48,15 @@
FDArray::FDArray(std::string const& input, std::string const& output,
std::string const& errout)
- : _input(input), _output(output), _errout(errout), _fdArray(),
- imap {{"", -1},
- {"cin", STDIN_FILENO},
- {"stdin", STDIN_FILENO}},
- oemap{{"", -1},
- {"cout", STDOUT_FILENO},
- {"stdout", STDOUT_FILENO},
- {"cerr", STDERR_FILENO},
- {"stderr", STDERR_FILENO}}
+ : _fdArray(), _input(input), _output(output), _errout(errout),
+ _imap {{"", -1},
+ {"cin", STDIN_FILENO},
+ {"stdin", STDIN_FILENO}},
+ _oemap{{"", -1},
+ {"cout", STDOUT_FILENO},
+ {"stdout", STDOUT_FILENO},
+ {"cerr", STDERR_FILENO},
+ {"stderr", STDERR_FILENO}}
{
int sim_fd;
std::map<std::string, int>::iterator it;
@@ -65,7 +65,7 @@ FDArray::FDArray(std::string const& input, std::string const& output,
* Search through the input options and setup the default fd if match is
* found; otherwise, open an input file and seek to location.
*/
- if ((it = imap.find(input)) != imap.end())
+ if ((it = _imap.find(input)) != _imap.end())
sim_fd = it->second;
else
sim_fd = openInputFile(input);
@@ -77,7 +77,7 @@ FDArray::FDArray(std::string const& input, std::string const& output,
* Search through the output/error options and setup the default fd if
* match is found; otherwise, open an output file and seek to location.
*/
- if ((it = oemap.find(output)) != oemap.end())
+ if ((it = _oemap.find(output)) != _oemap.end())
sim_fd = it->second;
else
sim_fd = openOutputFile(output);
@@ -88,7 +88,7 @@ FDArray::FDArray(std::string const& input, std::string const& output,
if (output == errout)
; /* Reuse the same file descriptor if these match. */
- else if ((it = oemap.find(errout)) != oemap.end())
+ else if ((it = _oemap.find(errout)) != _oemap.end())
sim_fd = it->second;
else
sim_fd = openOutputFile(errout);
@@ -156,7 +156,7 @@ FDArray::restoreFileOffsets()
stdin_ffd->setFileOffset(0);
}
- if ((it = imap.find(stdin_ffd->getFileName())) != imap.end()) {
+ if ((it = _imap.find(stdin_ffd->getFileName())) != _imap.end()) {
stdin_ffd->setSimFD(it->second);
} else {
stdin_ffd->setSimFD(openInputFile(stdin_ffd->getFileName()));
@@ -180,7 +180,7 @@ FDArray::restoreFileOffsets()
stdout_ffd->setFileOffset(0);
}
- if ((it = oemap.find(stdout_ffd->getFileName())) != oemap.end()) {
+ if ((it = _oemap.find(stdout_ffd->getFileName())) != _oemap.end()) {
stdout_ffd->setSimFD(it->second);
} else {
stdout_ffd->setSimFD(openOutputFile(stdout_ffd->getFileName()));
@@ -207,7 +207,7 @@ FDArray::restoreFileOffsets()
if (stdout_ffd->getFileName() == stderr_ffd->getFileName()) {
/* Reuse the same sim_fd file descriptor if these match. */
stderr_ffd->setSimFD(stdout_ffd->getSimFD());
- } else if ((it = oemap.find(stderr_ffd->getFileName())) != oemap.end()) {
+ } else if ((it = _oemap.find(stderr_ffd->getFileName())) != _oemap.end()) {
stderr_ffd->setSimFD(it->second);
} else {
stderr_ffd->setSimFD(openOutputFile(stderr_ffd->getFileName()));