blob: 10e15996b2710af53856eba44df72aa3d362c2c6 [file] [log] [blame]
Jakub Pawlowski3eb4a482016-02-24 10:39:46 -08001/******************************************************************************
2 *
3 * Copyright (C) 2016 Google, Inc.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at:
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 ******************************************************************************/
18
19#include <string.h>
20
21#include "osi/include/properties.h"
22
23int osi_property_get(const char *key, char *value, const char *default_value) {
24#if defined(OS_GENERIC)
25 /* For linux right now just return default value, if present */
26 int len = -1;
27 if (!default_value)
28 return len;
29
30 len = strlen(default_value);
31 if (len >= PROPERTY_VALUE_MAX)
32 len = PROPERTY_VALUE_MAX - 1;
33
34 memcpy(value, default_value, len);
35 value[len] = '\0';
36 return len;
37#else
38 return property_get(key, value, default_value);
39#endif // defined(OS_GENERIC)
40}
41
42int osi_property_set(const char *key, const char *value) {
43#if defined(OS_GENERIC)
44 return -1;
45#else
46 return property_set(key, value);
47#endif // defined(OS_GENERIC)
Marie Janssend19e0782016-07-15 12:48:27 -070048}