blob: f6dd794cb1622483d69e646e8a4870b4c6a05740 [file] [log] [blame]
Matt Spinler97f7abc2019-11-06 09:40:23 -06001/**
2 * Copyright © 2019 IBM Corporation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
Matt Spinlerdf13bdb2019-07-10 16:54:13 -050016#include "extensions/openpower-pels/paths.hpp"
17
18#include <filesystem>
19
20namespace openpower
21{
22namespace pels
23{
24
25// Use paths that work in unit tests.
26
27std::filesystem::path getPELIDFile()
28{
29 static std::string idFile;
30
31 if (idFile.empty())
32 {
33 char templ[] = "/tmp/logidtestXXXXXX";
34 std::filesystem::path dir = mkdtemp(templ);
35 idFile = dir / "logid";
36 }
37 return idFile;
38}
39
Matt Spinler89fa0822019-07-17 13:54:30 -050040std::filesystem::path getPELRepoPath()
41{
42 static std::string repoPath;
43
44 if (repoPath.empty())
45 {
46 char templ[] = "/tmp/repopathtestXXXXXX";
47 std::filesystem::path dir = mkdtemp(templ);
48 repoPath = dir;
49 }
50 return repoPath;
51}
52
Matt Spinler0d804ef2020-05-12 16:16:26 -050053std::filesystem::path getPELReadOnlyDataPath()
Matt Spinler367144c2019-09-19 15:33:52 -050054{
Matt Spinler0d804ef2020-05-12 16:16:26 -050055 static std::string dataPath;
Matt Spinler367144c2019-09-19 15:33:52 -050056
Matt Spinler0d804ef2020-05-12 16:16:26 -050057 if (dataPath.empty())
Matt Spinler367144c2019-09-19 15:33:52 -050058 {
Matt Spinler0d804ef2020-05-12 16:16:26 -050059 char templ[] = "/tmp/pelrodatatestXXXXXX";
60 dataPath = mkdtemp(templ);
Matt Spinler367144c2019-09-19 15:33:52 -050061 }
62
Matt Spinler0d804ef2020-05-12 16:16:26 -050063 return dataPath;
Matt Spinler367144c2019-09-19 15:33:52 -050064}
65
Matt Spinler8d5f3a22020-07-07 10:30:33 -050066size_t getPELRepoSize()
67{
68 // 100KB
69 return 100 * 1024;
70}
71
72size_t getMaxNumPELs()
73{
74 return 100;
75}
76
Matt Spinlerdf13bdb2019-07-10 16:54:13 -050077} // namespace pels
78} // namespace openpower