diff options
author | gbillock@chromium.org <gbillock@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-21 00:00:10 +0000 |
---|---|---|
committer | gbillock@chromium.org <gbillock@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-21 00:00:10 +0000 |
commit | f261762800a167f429ce0bf8a16ca3cee8d5b1c7 (patch) | |
tree | 8d3cf54b4951670a7d905712e28fb9faac6d52cb /chrome/browser/storage_monitor/udev_util_linux.h | |
parent | efe80d214e26fe552853aaccee59b4881c4b6e24 (diff) | |
download | chromium_src-f261762800a167f429ce0bf8a16ca3cee8d5b1c7.zip chromium_src-f261762800a167f429ce0bf8a16ca3cee8d5b1c7.tar.gz chromium_src-f261762800a167f429ce0bf8a16ca3cee8d5b1c7.tar.bz2 |
Rename browser/system_monitor to browser/storage_monitor.
R=vandebo@chromium.org
BUG=None
Review URL: https://chromiumcodereview.appspot.com/12312002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@183664 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/storage_monitor/udev_util_linux.h')
-rw-r--r-- | chrome/browser/storage_monitor/udev_util_linux.h | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/chrome/browser/storage_monitor/udev_util_linux.h b/chrome/browser/storage_monitor/udev_util_linux.h new file mode 100644 index 0000000..fe20f19 --- /dev/null +++ b/chrome/browser/storage_monitor/udev_util_linux.h @@ -0,0 +1,53 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_STORAGE_MONITOR_UDEV_UTIL_LINUX_H_ +#define CHROME_BROWSER_STORAGE_MONITOR_UDEV_UTIL_LINUX_H_ + +#include <libudev.h> + +#include <string> + +#include "base/memory/scoped_generic_obj.h" + +namespace base { +class FilePath; +} + +namespace chrome { + +// ScopedGenericObj functor for UdevObjectRelease(). +class ScopedReleaseUdevObject { + public: + void operator()(struct udev* udev) const { + udev_unref(udev); + } +}; +typedef ScopedGenericObj<struct udev*, + ScopedReleaseUdevObject> ScopedUdevObject; + +// ScopedGenericObj functor for UdevDeviceObjectRelease(). +class ScopedReleaseUdevDeviceObject { + public: + void operator()(struct udev_device* device) const { + udev_device_unref(device); + } +}; +typedef ScopedGenericObj<struct udev_device*, + ScopedReleaseUdevDeviceObject> ScopedUdevDeviceObject; + +// Wrapper function for udev_device_get_property_value() that also checks for +// valid but empty values. +std::string GetUdevDevicePropertyValue(struct udev_device* udev_device, + const char* key); + +// Helper for udev_device_new_from_syspath()/udev_device_get_property_value() +// pair. |device_path| is the absolute path to the device, including /sys. +bool GetUdevDevicePropertyValueByPath(const base::FilePath& device_path, + const char* key, + std::string* result); + +} // namespace chrome + +#endif // CHROME_BROWSER_STORAGE_MONITOR_UDEV_UTIL_LINUX_H_ |