blob: 14e5d711fd723bed7ea413cc97f1ae793f522433 [file] [log] [blame]
Matt Spinler711d51d2019-11-06 09:36:51 -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 "config.h"
17
18#include "paths.hpp"
19
20#include <filesystem>
21
22namespace openpower
23{
24namespace pels
25{
26
27namespace fs = std::filesystem;
Matt Spinler8d5f3a22020-07-07 10:30:33 -050028static constexpr size_t defaultRepoSize = 20 * 1024 * 1024;
29static constexpr size_t defaultMaxNumPELs = 3000;
Matt Spinlerdf13bdb2019-07-10 16:54:13 -050030
31fs::path getPELIDFile()
32{
33 fs::path logIDPath{EXTENSION_PERSIST_DIR};
34 logIDPath /= fs::path{"pels"} / fs::path{"pelID"};
35 return logIDPath;
36}
37
Matt Spinler89fa0822019-07-17 13:54:30 -050038fs::path getPELRepoPath()
39{
40 std::filesystem::path repoPath{EXTENSION_PERSIST_DIR};
41 repoPath /= "pels";
42 return repoPath;
43}
44
Matt Spinler0d804ef2020-05-12 16:16:26 -050045fs::path getPELReadOnlyDataPath()
Matt Spinler367144c2019-09-19 15:33:52 -050046{
47 return std::filesystem::path{"/usr/share/phosphor-logging/pels"};
48}
Matt Spinlerdf13bdb2019-07-10 16:54:13 -050049
Matt Spinler8d5f3a22020-07-07 10:30:33 -050050size_t getPELRepoSize()
51{
52 // For now, always use 20MB, revisit in the future if different
53 // systems need different values so that we only put PEL
54 // content into configure.ac when absolutely necessary.
55 return defaultRepoSize;
56}
57
58size_t getMaxNumPELs()
59{
60 // Hardcode using the same reasoning as the repo size field.
61 return defaultMaxNumPELs;
62}
63
Matt Spinler367144c2019-09-19 15:33:52 -050064} // namespace pels
Matt Spinlerdf13bdb2019-07-10 16:54:13 -050065} // namespace openpower