Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(216)

Side by Side Diff: components/storage_monitor/udev_util_linux.cc

Issue 982883004: Move GetUdevDevicePropertyValue from components/storage_monitor to device/udev_linux and rename to … (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert incorrect change in chromeos Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/storage_monitor/udev_util_linux.h ('k') | device/udev_linux/udev.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/storage_monitor/udev_util_linux.h" 5 #include "components/storage_monitor/udev_util_linux.h"
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "device/udev_linux/scoped_udev.h" 8 #include "device/udev_linux/scoped_udev.h"
9 9
10 namespace storage_monitor { 10 namespace storage_monitor {
11 11
12 std::string GetUdevDevicePropertyValue(udev_device* udev_device,
13 const char* key) {
14 const char* value = device::udev_device_get_property_value(udev_device, key);
15 return value ? value : std::string();
16 }
17
18 bool GetUdevDevicePropertyValueByPath(const base::FilePath& device_path, 12 bool GetUdevDevicePropertyValueByPath(const base::FilePath& device_path,
19 const char* key, 13 const char* key,
20 std::string* result) { 14 std::string* result) {
21 device::ScopedUdevPtr udev(device::udev_new()); 15 device::ScopedUdevPtr udev(device::udev_new());
22 if (!udev.get()) 16 if (!udev.get())
23 return false; 17 return false;
24 device::ScopedUdevDevicePtr device(device::udev_device_new_from_syspath( 18 device::ScopedUdevDevicePtr device(device::udev_device_new_from_syspath(
25 udev.get(), device_path.value().c_str())); 19 udev.get(), device_path.value().c_str()));
26 if (!device.get()) 20 if (!device.get())
27 return false; 21 return false;
28 *result = GetUdevDevicePropertyValue(device.get(), key); 22 *result = device::UdevDeviceGetPropertyValue(device.get(), key);
29 return true; 23 return true;
30 } 24 }
31 25
32 } // namespace storage_monitor 26 } // namespace storage_monitor
OLDNEW
« no previous file with comments | « components/storage_monitor/udev_util_linux.h ('k') | device/udev_linux/udev.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698