197f7abcfSMatt Spinler /** 297f7abcfSMatt Spinler * Copyright © 2019 IBM Corporation 397f7abcfSMatt Spinler * 497f7abcfSMatt Spinler * Licensed under the Apache License, Version 2.0 (the "License"); 597f7abcfSMatt Spinler * you may not use this file except in compliance with the License. 697f7abcfSMatt Spinler * You may obtain a copy of the License at 797f7abcfSMatt Spinler * 897f7abcfSMatt Spinler * http://www.apache.org/licenses/LICENSE-2.0 997f7abcfSMatt Spinler * 1097f7abcfSMatt Spinler * Unless required by applicable law or agreed to in writing, software 1197f7abcfSMatt Spinler * distributed under the License is distributed on an "AS IS" BASIS, 1297f7abcfSMatt Spinler * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1397f7abcfSMatt Spinler * See the License for the specific language governing permissions and 1497f7abcfSMatt Spinler * limitations under the License. 1597f7abcfSMatt Spinler */ 16df13bdb6SMatt Spinler #include "extensions/openpower-pels/paths.hpp" 17df13bdb6SMatt Spinler 18df13bdb6SMatt Spinler #include <filesystem> 19df13bdb6SMatt Spinler 20df13bdb6SMatt Spinler namespace openpower 21df13bdb6SMatt Spinler { 22df13bdb6SMatt Spinler namespace pels 23df13bdb6SMatt Spinler { 24df13bdb6SMatt Spinler 25df13bdb6SMatt Spinler // Use paths that work in unit tests. 26df13bdb6SMatt Spinler getPELIDFile()27df13bdb6SMatt Spinlerstd::filesystem::path getPELIDFile() 28df13bdb6SMatt Spinler { 29df13bdb6SMatt Spinler static std::string idFile; 30df13bdb6SMatt Spinler 31df13bdb6SMatt Spinler if (idFile.empty()) 32df13bdb6SMatt Spinler { 33df13bdb6SMatt Spinler char templ[] = "/tmp/logidtestXXXXXX"; 34df13bdb6SMatt Spinler std::filesystem::path dir = mkdtemp(templ); 35df13bdb6SMatt Spinler idFile = dir / "logid"; 36df13bdb6SMatt Spinler } 37df13bdb6SMatt Spinler return idFile; 38df13bdb6SMatt Spinler } 39df13bdb6SMatt Spinler getPELRepoPath()4089fa082aSMatt Spinlerstd::filesystem::path getPELRepoPath() 4189fa082aSMatt Spinler { 4289fa082aSMatt Spinler static std::string repoPath; 4389fa082aSMatt Spinler 4489fa082aSMatt Spinler if (repoPath.empty()) 4589fa082aSMatt Spinler { 4689fa082aSMatt Spinler char templ[] = "/tmp/repopathtestXXXXXX"; 4789fa082aSMatt Spinler std::filesystem::path dir = mkdtemp(templ); 4889fa082aSMatt Spinler repoPath = dir; 4989fa082aSMatt Spinler } 5089fa082aSMatt Spinler return repoPath; 5189fa082aSMatt Spinler } 5289fa082aSMatt Spinler getPELReadOnlyDataPath()530d804ef5SMatt Spinlerstd::filesystem::path getPELReadOnlyDataPath() 54367144cfSMatt Spinler { 550d804ef5SMatt Spinler static std::string dataPath; 56367144cfSMatt Spinler 570d804ef5SMatt Spinler if (dataPath.empty()) 58367144cfSMatt Spinler { 590d804ef5SMatt Spinler char templ[] = "/tmp/pelrodatatestXXXXXX"; 600d804ef5SMatt Spinler dataPath = mkdtemp(templ); 61367144cfSMatt Spinler } 62367144cfSMatt Spinler 630d804ef5SMatt Spinler return dataPath; 64367144cfSMatt Spinler } 65367144cfSMatt Spinler getPELRepoSize()66*8d5f3a2bSMatt Spinlersize_t getPELRepoSize() 67*8d5f3a2bSMatt Spinler { 68*8d5f3a2bSMatt Spinler // 100KB 69*8d5f3a2bSMatt Spinler return 100 * 1024; 70*8d5f3a2bSMatt Spinler } 71*8d5f3a2bSMatt Spinler getMaxNumPELs()72*8d5f3a2bSMatt Spinlersize_t getMaxNumPELs() 73*8d5f3a2bSMatt Spinler { 74*8d5f3a2bSMatt Spinler return 100; 75*8d5f3a2bSMatt Spinler } 76*8d5f3a2bSMatt Spinler 77df13bdb6SMatt Spinler } // namespace pels 78df13bdb6SMatt Spinler } // namespace openpower 79