gem5  v21.1.0.2
flag_tables.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011 ARM Limited
3  * All rights reserved
4  *
5  * The license below extends only to copyright in the software and shall
6  * not be construed as granting a license to any other intellectual
7  * property including but not limited to intellectual property relating
8  * to a hardware implementation of the functionality of the software
9  * licensed hereunder. You may use the software subject to the license
10  * terms below provided that you ensure that this notice is replicated
11  * unmodified and in its entirety in all distributions of the software,
12  * modified or unmodified, in source code or in binary form.
13  *
14  * Copyright (c) 2003-2005, 2006 The Regents of The University of Michigan
15  * Copyright (c) 2007-2008 The Florida State University
16  * Copyright (c) 2009 The University of Edinburgh
17  * All rights reserved.
18  *
19  * Redistribution and use in source and binary forms, with or without
20  * modification, are permitted provided that the following conditions are
21  * met: redistributions of source code must retain the above copyright
22  * notice, this list of conditions and the following disclaimer;
23  * redistributions in binary form must reproduce the above copyright
24  * notice, this list of conditions and the following disclaimer in the
25  * documentation and/or other materials provided with the distribution;
26  * neither the name of the copyright holders nor the names of its
27  * contributors may be used to endorse or promote products derived from
28  * this software without specific prior written permission.
29  *
30  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
31  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
32  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
33  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
34  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
35  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
36  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
37  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
38  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
39  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
40  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41  */
42 
43 #include <fcntl.h>
44 #include <sys/mman.h>
45 
46 /*
47  * @file flag_tables.hh
48  *
49  * This file contains definitions of flag translation tables for the
50  * open() system call. Since the tables are nearly identical
51  * across target platforms (other than the values of the target flags),
52  * we use a template to build the tables which is inherited by each target
53  * platform.
54  */
55 
56 namespace gem5
57 {
58 
59 template <typename Target>
61 {
62  public:
63  // open(2) flags translation table
64  static inline const std::map<int, int> openFlagTable = {
65 #ifdef _MSC_VER
66  { Target::TGT_O_RDONLY, _O_RDONLY },
67  { Target::TGT_O_WRONLY, _O_WRONLY },
68  { Target::TGT_O_RDWR, _O_RDWR },
69  { Target::TGT_O_CREAT, _O_CREAT },
70  { Target::TGT_O_EXCL, _O_EXCL },
71  { Target::TGT_O_TRUNC, _O_TRUNC },
72  { Target::TGT_O_APPEND, _O_APPEND },
73 #else /* !_MSC_VER */
74  { Target::TGT_O_RDONLY, O_RDONLY },
75  { Target::TGT_O_WRONLY, O_WRONLY },
76  { Target::TGT_O_RDWR, O_RDWR },
77  { Target::TGT_O_CREAT, O_CREAT },
78  { Target::TGT_O_EXCL, O_EXCL },
79  { Target::TGT_O_TRUNC, O_TRUNC },
80  { Target::TGT_O_APPEND, O_APPEND },
81  { Target::TGT_O_NOCTTY, O_NOCTTY },
82  { Target::TGT_O_NONBLOCK, O_NONBLOCK },
83 #ifdef O_DSYNC
84  { Target::TGT_O_DSYNC, O_DSYNC },
85 #endif
86 #ifdef O_ASYNC
87  { Target::TGT_FASYNC, O_ASYNC },
88 #endif
89 #ifdef O_DIRECT
90  { Target::TGT_O_DIRECT, O_DIRECT },
91 #endif
92 #ifdef O_LARGEFILE
93  { Target::TGT_O_LARGEFILE, O_LARGEFILE },
94 #endif
95 #ifdef O_DIRECTORY
96  { Target::TGT_O_DIRECTORY, O_DIRECTORY },
97 #endif
98 #ifdef O_NOFOLLOW
99  { Target::TGT_O_NOFOLLOW, O_NOFOLLOW },
100 #endif
101 #ifdef O_NOATIME
102  { Target::TGT_O_NOATIME, O_NOATIME },
103 #endif
104 #ifdef O_CLOEXEC
105  { Target::TGT_O_CLOEXEC, O_CLOEXEC },
106 #endif
107 #ifdef O_SYNC
108  { Target::TGT_O_SYNC, O_SYNC },
109 #endif
110 #ifdef O_PATH
111  { Target::TGT_O_PATH, O_PATH },
112 #endif
113 #endif /* _MSC_VER */
114  };
115 };
116 
117 } // namespace gem5
gem5::OpenFlagTable::openFlagTable
static const std::map< int, int > openFlagTable
Definition: flag_tables.hh:64
gem5::OpenFlagTable
Definition: flag_tables.hh:60
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: decoder.cc:40

Generated on Tue Sep 21 2021 12:25:25 for gem5 by doxygen 1.8.17