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 #ifndef COMPONENTS_STORAGE_MONITOR_UDEV_UTIL_LINUX_H_
6 #define COMPONENTS_STORAGE_MONITOR_UDEV_UTIL_LINUX_H_
12 #include "base/memory/scoped_ptr.h"
18 namespace storage_monitor
{
20 // Deleter for ScopedUdevObject.
22 void operator()(struct udev
* udev
);
24 typedef scoped_ptr
<struct udev
, UdevDeleter
> ScopedUdevObject
;
26 // Deleter for ScopedUdevDeviceObject().
27 struct UdevDeviceDeleter
{
28 void operator()(struct udev_device
* device
);
30 typedef scoped_ptr
<struct udev_device
, UdevDeviceDeleter
>
31 ScopedUdevDeviceObject
;
33 // Wrapper function for udev_device_get_property_value() that also checks for
34 // valid but empty values.
35 std::string
GetUdevDevicePropertyValue(struct udev_device
* udev_device
,
38 // Helper for udev_device_new_from_syspath()/udev_device_get_property_value()
39 // pair. |device_path| is the absolute path to the device, including /sys.
40 bool GetUdevDevicePropertyValueByPath(const base::FilePath
& device_path
,
44 } // namespace storage_monitor
46 #endif // COMPONENTS_STORAGE_MONITOR_UDEV_UTIL_LINUX_H_