Home | History | Annotate | Download | only in storage_monitor
      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.
      4 
      5 #ifndef COMPONENTS_STORAGE_MONITOR_UDEV_UTIL_LINUX_H_
      6 #define COMPONENTS_STORAGE_MONITOR_UDEV_UTIL_LINUX_H_
      7 
      8 #include <libudev.h>
      9 
     10 #include <string>
     11 
     12 #include "base/memory/scoped_ptr.h"
     13 
     14 namespace base {
     15 class FilePath;
     16 }
     17 
     18 namespace storage_monitor {
     19 
     20 // Wrapper function for udev_device_get_property_value() that also checks for
     21 // valid but empty values.
     22 std::string GetUdevDevicePropertyValue(struct udev_device* udev_device,
     23                                        const char* key);
     24 
     25 // Helper for udev_device_new_from_syspath()/udev_device_get_property_value()
     26 // pair. |device_path| is the absolute path to the device, including /sys.
     27 bool GetUdevDevicePropertyValueByPath(const base::FilePath& device_path,
     28                                       const char* key,
     29                                       std::string* result);
     30 
     31 }  // namespace storage_monitor
     32 
     33 #endif  // COMPONENTS_STORAGE_MONITOR_UDEV_UTIL_LINUX_H_
     34