Implement multiple alternative services per origin.
[chromium-blink-merge.git] / components / storage_monitor / udev_util_linux.cc
blobe0a5a8f7d1d032fa0352954f40e5285cd3e13ca6
1 // Copyright 2014 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 "components/storage_monitor/udev_util_linux.h"
7 #include "base/files/file_path.h"
8 #include "device/udev_linux/scoped_udev.h"
10 namespace storage_monitor {
12 bool GetUdevDevicePropertyValueByPath(const base::FilePath& device_path,
13 const char* key,
14 std::string* result) {
15 device::ScopedUdevPtr udev(device::udev_new());
16 if (!udev.get())
17 return false;
18 device::ScopedUdevDevicePtr device(device::udev_device_new_from_syspath(
19 udev.get(), device_path.value().c_str()));
20 if (!device.get())
21 return false;
22 *result = device::UdevDeviceGetPropertyValue(device.get(), key);
23 return true;
26 } // namespace storage_monitor