blob: ace9c94149e337af32cd1f37a8a4b2bea0898394 [file] [log] [blame]
Alexander Hansen40fb5492025-10-28 17:56:12 +01001// SPDX-License-Identifier: Apache-2.0
2// SPDX-FileCopyrightText: Copyright 2019 IBM Corporation
3
Matt Spinlerdf13bdb2019-07-10 16:54:13 -05004#include "extensions/openpower-pels/paths.hpp"
5
6#include <filesystem>
7
8namespace openpower
9{
10namespace pels
11{
12
13// Use paths that work in unit tests.
14
15std::filesystem::path getPELIDFile()
16{
17 static std::string idFile;
18
19 if (idFile.empty())
20 {
21 char templ[] = "/tmp/logidtestXXXXXX";
22 std::filesystem::path dir = mkdtemp(templ);
23 idFile = dir / "logid";
24 }
25 return idFile;
26}
27
Matt Spinler89fa0822019-07-17 13:54:30 -050028std::filesystem::path getPELRepoPath()
29{
30 static std::string repoPath;
31
32 if (repoPath.empty())
33 {
34 char templ[] = "/tmp/repopathtestXXXXXX";
35 std::filesystem::path dir = mkdtemp(templ);
36 repoPath = dir;
37 }
38 return repoPath;
39}
40
Matt Spinler0d804ef2020-05-12 16:16:26 -050041std::filesystem::path getPELReadOnlyDataPath()
Matt Spinler367144c2019-09-19 15:33:52 -050042{
Matt Spinler0d804ef2020-05-12 16:16:26 -050043 static std::string dataPath;
Matt Spinler367144c2019-09-19 15:33:52 -050044
Matt Spinler0d804ef2020-05-12 16:16:26 -050045 if (dataPath.empty())
Matt Spinler367144c2019-09-19 15:33:52 -050046 {
Matt Spinler0d804ef2020-05-12 16:16:26 -050047 char templ[] = "/tmp/pelrodatatestXXXXXX";
48 dataPath = mkdtemp(templ);
Matt Spinler367144c2019-09-19 15:33:52 -050049 }
50
Matt Spinler0d804ef2020-05-12 16:16:26 -050051 return dataPath;
Matt Spinler367144c2019-09-19 15:33:52 -050052}
53
Matt Spinler8d5f3a22020-07-07 10:30:33 -050054size_t getPELRepoSize()
55{
56 // 100KB
57 return 100 * 1024;
58}
59
60size_t getMaxNumPELs()
61{
62 return 100;
63}
64
Matt Spinlerdf13bdb2019-07-10 16:54:13 -050065} // namespace pels
66} // namespace openpower