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 #ifndef CHROME_BROWSER_STORAGE_MONITOR_UDEV_UTIL_LINUX_H_
6 #define CHROME_BROWSER_STORAGE_MONITOR_UDEV_UTIL_LINUX_H_
12 #include "base/memory/scoped_generic_obj.h"
20 // ScopedGenericObj functor for UdevObjectRelease().
21 class ScopedReleaseUdevObject
{
23 void operator()(struct udev
* udev
) const {
27 typedef ScopedGenericObj
<struct udev
*,
28 ScopedReleaseUdevObject
> ScopedUdevObject
;
30 // ScopedGenericObj functor for UdevDeviceObjectRelease().
31 class ScopedReleaseUdevDeviceObject
{
33 void operator()(struct udev_device
* device
) const {
34 udev_device_unref(device
);
37 typedef ScopedGenericObj
<struct udev_device
*,
38 ScopedReleaseUdevDeviceObject
> ScopedUdevDeviceObject
;
40 // Wrapper function for udev_device_get_property_value() that also checks for
41 // valid but empty values.
42 std::string
GetUdevDevicePropertyValue(struct udev_device
* udev_device
,
45 // Helper for udev_device_new_from_syspath()/udev_device_get_property_value()
46 // pair. |device_path| is the absolute path to the device, including /sys.
47 bool GetUdevDevicePropertyValueByPath(const base::FilePath
& device_path
,
53 #endif // CHROME_BROWSER_STORAGE_MONITOR_UDEV_UTIL_LINUX_H_