xref: /openbmc/phosphor-logging/extensions/openpower-pels/pel_paths.cpp (revision 40fb54935ce7367636a7156039396ee91cc4d5e2)
1 // SPDX-License-Identifier: Apache-2.0
2 // SPDX-FileCopyrightText: Copyright 2019 IBM Corporation
3 
4 #include "config.h"
5 
6 #include "paths.hpp"
7 
8 #include <filesystem>
9 
10 namespace openpower
11 {
12 namespace pels
13 {
14 
15 namespace fs = std::filesystem;
16 static constexpr size_t defaultRepoSize = 20 * 1024 * 1024;
17 static constexpr size_t defaultMaxNumPELs = 3000;
18 
getPELIDFile()19 fs::path getPELIDFile()
20 {
21     fs::path logIDPath{phosphor::logging::paths::extension()};
22     logIDPath /= fs::path{"pels"} / fs::path{"pelID"};
23     return logIDPath;
24 }
25 
getPELRepoPath()26 fs::path getPELRepoPath()
27 {
28     std::filesystem::path repoPath{phosphor::logging::paths::extension()};
29     repoPath /= "pels";
30     return repoPath;
31 }
32 
getPELReadOnlyDataPath()33 fs::path getPELReadOnlyDataPath()
34 {
35     return std::filesystem::path{"/usr/share/phosphor-logging/pels"};
36 }
37 
getPELRepoSize()38 size_t getPELRepoSize()
39 {
40     // For now, always use 20MB, revisit in the future if different
41     // systems need different values so that we only put PEL
42     // content into configure.ac when absolutely necessary.
43     return defaultRepoSize;
44 }
45 
getMaxNumPELs()46 size_t getMaxNumPELs()
47 {
48     // Hardcode using the same reasoning as the repo size field.
49     return defaultMaxNumPELs;
50 }
51 
52 } // namespace pels
53 } // namespace openpower
54