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