| Matt Spinler | 711d51d | 2019-11-06 09:36:51 -0600 | [diff] [blame] | 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 |  */ | 
| Matt Spinler | df13bdb | 2019-07-10 16:54:13 -0500 | [diff] [blame] | 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; | 
| Matt Spinler | 8d5f3a2 | 2020-07-07 10:30:33 -0500 | [diff] [blame] | 28 | static constexpr size_t defaultRepoSize = 20 * 1024 * 1024; | 
 | 29 | static constexpr size_t defaultMaxNumPELs = 3000; | 
| Matt Spinler | df13bdb | 2019-07-10 16:54:13 -0500 | [diff] [blame] | 30 |  | 
 | 31 | fs::path getPELIDFile() | 
 | 32 | { | 
 | 33 |     fs::path logIDPath{EXTENSION_PERSIST_DIR}; | 
 | 34 |     logIDPath /= fs::path{"pels"} / fs::path{"pelID"}; | 
 | 35 |     return logIDPath; | 
 | 36 | } | 
 | 37 |  | 
| Matt Spinler | 89fa082 | 2019-07-17 13:54:30 -0500 | [diff] [blame] | 38 | fs::path getPELRepoPath() | 
 | 39 | { | 
 | 40 |     std::filesystem::path repoPath{EXTENSION_PERSIST_DIR}; | 
 | 41 |     repoPath /= "pels"; | 
 | 42 |     return repoPath; | 
 | 43 | } | 
 | 44 |  | 
| Matt Spinler | 0d804ef | 2020-05-12 16:16:26 -0500 | [diff] [blame] | 45 | fs::path getPELReadOnlyDataPath() | 
| Matt Spinler | 367144c | 2019-09-19 15:33:52 -0500 | [diff] [blame] | 46 | { | 
 | 47 |     return std::filesystem::path{"/usr/share/phosphor-logging/pels"}; | 
 | 48 | } | 
| Matt Spinler | df13bdb | 2019-07-10 16:54:13 -0500 | [diff] [blame] | 49 |  | 
| Matt Spinler | 8d5f3a2 | 2020-07-07 10:30:33 -0500 | [diff] [blame] | 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 |  | 
| Matt Spinler | 367144c | 2019-09-19 15:33:52 -0500 | [diff] [blame] | 64 | } // namespace pels | 
| Matt Spinler | df13bdb | 2019-07-10 16:54:13 -0500 | [diff] [blame] | 65 | } // namespace openpower |