1*fa2d962bSPatrick Williams /** 2*fa2d962bSPatrick Williams * Copyright © 2019 IBM Corporation 3*fa2d962bSPatrick Williams * 4*fa2d962bSPatrick Williams * Licensed under the Apache License, Version 2.0 (the "License"); 5*fa2d962bSPatrick Williams * you may not use this file except in compliance with the License. 6*fa2d962bSPatrick Williams * You may obtain a copy of the License at 7*fa2d962bSPatrick Williams * 8*fa2d962bSPatrick Williams * http://www.apache.org/licenses/LICENSE-2.0 9*fa2d962bSPatrick Williams * 10*fa2d962bSPatrick Williams * Unless required by applicable law or agreed to in writing, software 11*fa2d962bSPatrick Williams * distributed under the License is distributed on an "AS IS" BASIS, 12*fa2d962bSPatrick Williams * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13*fa2d962bSPatrick Williams * See the License for the specific language governing permissions and 14*fa2d962bSPatrick Williams * limitations under the License. 15*fa2d962bSPatrick Williams */ 16*fa2d962bSPatrick Williams #include "config.h" 17*fa2d962bSPatrick Williams 18*fa2d962bSPatrick Williams #include "paths.hpp" 19*fa2d962bSPatrick Williams 20*fa2d962bSPatrick Williams #include <filesystem> 21*fa2d962bSPatrick Williams 22*fa2d962bSPatrick Williams namespace openpower 23*fa2d962bSPatrick Williams { 24*fa2d962bSPatrick Williams namespace pels 25*fa2d962bSPatrick Williams { 26*fa2d962bSPatrick Williams 27*fa2d962bSPatrick Williams namespace fs = std::filesystem; 28*fa2d962bSPatrick Williams static constexpr size_t defaultRepoSize = 20 * 1024 * 1024; 29*fa2d962bSPatrick Williams static constexpr size_t defaultMaxNumPELs = 3000; 30*fa2d962bSPatrick Williams getPELIDFile()31*fa2d962bSPatrick Williamsfs::path getPELIDFile() 32*fa2d962bSPatrick Williams { 33*fa2d962bSPatrick Williams fs::path logIDPath{phosphor::logging::paths::extension()}; 34*fa2d962bSPatrick Williams logIDPath /= fs::path{"pels"} / fs::path{"pelID"}; 35*fa2d962bSPatrick Williams return logIDPath; 36*fa2d962bSPatrick Williams } 37*fa2d962bSPatrick Williams getPELRepoPath()38*fa2d962bSPatrick Williamsfs::path getPELRepoPath() 39*fa2d962bSPatrick Williams { 40*fa2d962bSPatrick Williams std::filesystem::path repoPath{phosphor::logging::paths::extension()}; 41*fa2d962bSPatrick Williams repoPath /= "pels"; 42*fa2d962bSPatrick Williams return repoPath; 43*fa2d962bSPatrick Williams } 44*fa2d962bSPatrick Williams getPELReadOnlyDataPath()45*fa2d962bSPatrick Williamsfs::path getPELReadOnlyDataPath() 46*fa2d962bSPatrick Williams { 47*fa2d962bSPatrick Williams return std::filesystem::path{"/usr/share/phosphor-logging/pels"}; 48*fa2d962bSPatrick Williams } 49*fa2d962bSPatrick Williams getPELRepoSize()50*fa2d962bSPatrick Williamssize_t getPELRepoSize() 51*fa2d962bSPatrick Williams { 52*fa2d962bSPatrick Williams // For now, always use 20MB, revisit in the future if different 53*fa2d962bSPatrick Williams // systems need different values so that we only put PEL 54*fa2d962bSPatrick Williams // content into configure.ac when absolutely necessary. 55*fa2d962bSPatrick Williams return defaultRepoSize; 56*fa2d962bSPatrick Williams } 57*fa2d962bSPatrick Williams getMaxNumPELs()58*fa2d962bSPatrick Williamssize_t getMaxNumPELs() 59*fa2d962bSPatrick Williams { 60*fa2d962bSPatrick Williams // Hardcode using the same reasoning as the repo size field. 61*fa2d962bSPatrick Williams return defaultMaxNumPELs; 62*fa2d962bSPatrick Williams } 63*fa2d962bSPatrick Williams 64*fa2d962bSPatrick Williams } // namespace pels 65*fa2d962bSPatrick Williams } // namespace openpower 66