1 /**
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  */
16 #include "config.h"
17 
18 #include "paths.hpp"
19 
20 #include <filesystem>
21 
22 namespace openpower
23 {
24 namespace pels
25 {
26 
27 namespace fs = std::filesystem;
28 static constexpr size_t defaultRepoSize = 20 * 1024 * 1024;
29 static constexpr size_t defaultMaxNumPELs = 3000;
30 
31 fs::path getPELIDFile()
32 {
33     fs::path logIDPath{phosphor::logging::paths::extension()};
34     logIDPath /= fs::path{"pels"} / fs::path{"pelID"};
35     return logIDPath;
36 }
37 
38 fs::path getPELRepoPath()
39 {
40     std::filesystem::path repoPath{phosphor::logging::paths::extension()};
41     repoPath /= "pels";
42     return repoPath;
43 }
44 
45 fs::path getPELReadOnlyDataPath()
46 {
47     return std::filesystem::path{"/usr/share/phosphor-logging/pels"};
48 }
49 
50 size_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 
58 size_t getMaxNumPELs()
59 {
60     // Hardcode using the same reasoning as the repo size field.
61     return defaultMaxNumPELs;
62 }
63 
64 } // namespace pels
65 } // namespace openpower
66