xref: /openbmc/hiomapd/vpnor/backend.h (revision 4519bb82)
1 /* SPDX-License-Identifier: Apache-2.0 */
2 /* Copyright (C) 2018 IBM Corp. */
3 #pragma once
4 
5 #include <limits.h>
6 
7 struct mbox_context;
8 struct vpnor_partition_table;
9 
10 struct vpnor_partition_paths
11 {
12     char ro_loc[PATH_MAX];
13     char rw_loc[PATH_MAX];
14     char prsv_loc[PATH_MAX];
15     char patch_loc[PATH_MAX];
16 };
17 
18 struct vpnor_data {
19 	struct vpnor_partition_table *vpnor;
20 	struct vpnor_partition_paths paths;
21 };
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 /** @brief Populate the path object with the default partition paths
28  *
29  *  @param[in/out] paths - A paths object in which to store the defaults
30  *
31  *  Returns 0 if the call succeeds, else a negative error code.
32  */
33 #ifdef VIRTUAL_PNOR_ENABLED
34 void vpnor_default_paths(struct vpnor_partition_paths *paths);
35 #else
36 static inline void vpnor_default_paths(struct vpnor_partition_paths *paths)
37 {
38     memset(paths, 0, sizeof(*paths));
39 }
40 #endif
41 
42 #ifdef __cplusplus
43 }
44 #endif
45