1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/storage_monitor/udev_util_linux.h"
7 #include "base/files/file_path.h"
11 std::string
GetUdevDevicePropertyValue(struct udev_device
* udev_device
,
13 const char* value
= udev_device_get_property_value(udev_device
, key
);
14 return value
? value
: std::string();
17 bool GetUdevDevicePropertyValueByPath(const base::FilePath
& device_path
,
19 std::string
* result
) {
20 ScopedUdevObject
udev(udev_new());
23 ScopedUdevDeviceObject
device(udev_device_new_from_syspath(
24 udev
.get(), device_path
.value().c_str()));
27 *result
= GetUdevDevicePropertyValue(device
.get(), key
);