blob: 0f245f3cbdb7209a47e1f39bf0225accda55a9ad [file] [log] [blame]
Alexander Hansen40fb5492025-10-28 17:56:12 +01001// SPDX-License-Identifier: Apache-2.0
2// SPDX-FileCopyrightText: Copyright 2019 IBM Corporation
3
Matt Spinlerdf13bdb2019-07-10 16:54:13 -05004#include "config.h"
5
6#include "paths.hpp"
7
8#include <filesystem>
9
10namespace openpower
11{
12namespace pels
13{
14
15namespace fs = std::filesystem;
Matt Spinler8d5f3a22020-07-07 10:30:33 -050016static constexpr size_t defaultRepoSize = 20 * 1024 * 1024;
17static constexpr size_t defaultMaxNumPELs = 3000;
Matt Spinlerdf13bdb2019-07-10 16:54:13 -050018
19fs::path getPELIDFile()
20{
Patrick Williamsfa2d9622024-09-30 16:25:43 -040021 fs::path logIDPath{phosphor::logging::paths::extension()};
Matt Spinlerdf13bdb2019-07-10 16:54:13 -050022 logIDPath /= fs::path{"pels"} / fs::path{"pelID"};
23 return logIDPath;
24}
25
Matt Spinler89fa0822019-07-17 13:54:30 -050026fs::path getPELRepoPath()
27{
Patrick Williamsfa2d9622024-09-30 16:25:43 -040028 std::filesystem::path repoPath{phosphor::logging::paths::extension()};
Matt Spinler89fa0822019-07-17 13:54:30 -050029 repoPath /= "pels";
30 return repoPath;
31}
32
Matt Spinler0d804ef2020-05-12 16:16:26 -050033fs::path getPELReadOnlyDataPath()
Matt Spinler367144c2019-09-19 15:33:52 -050034{
35 return std::filesystem::path{"/usr/share/phosphor-logging/pels"};
36}
Matt Spinlerdf13bdb2019-07-10 16:54:13 -050037
Matt Spinler8d5f3a22020-07-07 10:30:33 -050038size_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
46size_t getMaxNumPELs()
47{
48 // Hardcode using the same reasoning as the repo size field.
49 return defaultMaxNumPELs;
50}
51
Matt Spinler367144c2019-09-19 15:33:52 -050052} // namespace pels
Matt Spinlerdf13bdb2019-07-10 16:54:13 -050053} // namespace openpower