blob: 16a4c2b5432b12dcd45e9840497878d13e60209c [file] [log] [blame]
Andrew Jeffery812923d2018-02-22 11:59:52 +10301// SPDX-License-Identifier: Apache-2.0
2// Copyright (C) 2018 IBM Corp.
3
4#include "test/vpnor/tmpd.hpp"
5
6namespace openpower
7{
8namespace virtual_pnor
9{
10namespace test
11{
12
13namespace fs = std::experimental::filesystem;
14
15size_t VpnorRoot::write(const std::string &name, const void *data, size_t len)
16{
17 fs::path path{root};
18 path /= name;
19
20 if (!fs::exists(path))
21 /* It's not in the ToC */
22 throw std::invalid_argument(name);
23
24 std::ofstream partitionFile(path.c_str());
25 partitionFile.write((const char *)data, len);
26 partitionFile.close();
27
28 return len;
29}
30
31} // test
32} // virtual_pnor
33} // openpower