blob: 529fe696b9d6c0ba780644af7cd06bf640b6f2e3 [file] [log] [blame]
Ken Rockotb5c17ad2014-07-21 12:56:05 -07001// Copyright 2014 The Chromium OS 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 PERMISSION_BROKER_UDEV_SCOPERS_H_
6#define PERMISSION_BROKER_UDEV_SCOPERS_H_
7
8#include <libudev.h>
9
Ben Chan38c94a72016-12-07 15:26:39 -080010#include <memory>
Ken Rockotb5c17ad2014-07-21 12:56:05 -070011
12namespace permission_broker {
13
14struct UdevDeleter {
15 void operator()(udev* udev) const;
16};
17
18struct UdevEnumerateDeleter {
19 void operator()(udev_enumerate* enumerate) const;
20};
21
22struct UdevDeviceDeleter {
23 void operator()(udev_device* device) const;
24};
25
Ben Chan38c94a72016-12-07 15:26:39 -080026typedef std::unique_ptr<udev, UdevDeleter> ScopedUdevPtr;
27typedef std::unique_ptr<udev_enumerate, UdevEnumerateDeleter>
28 ScopedUdevEnumeratePtr;
29typedef std::unique_ptr<udev_device, UdevDeviceDeleter> ScopedUdevDevicePtr;
Ken Rockotb5c17ad2014-07-21 12:56:05 -070030
31} // namespace permission_broker
32
Alex Vakulenko24a4e222014-07-31 09:58:08 -070033#endif // PERMISSION_BROKER_UDEV_SCOPERS_H_