idev-internal.h revision c93e5a62ff599528c3bf2a8656825403aaebe093
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
/***
This file is part of systemd.
Copyright (C) 2014 David Herrmann <dh.herrmann@gmail.com>
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#pragma once
#include <inttypes.h>
#include <libudev.h>
#include <stdbool.h>
#include <stdlib.h>
#include <systemd/sd-event.h>
#include "hashmap.h"
#include "idev.h"
#include "list.h"
#include "util.h"
typedef struct idev_device_vtable idev_device_vtable;
typedef struct idev_element idev_element;
typedef struct idev_element_vtable idev_element_vtable;
/*
* Evdev Elements
*/
bool idev_is_evdev(idev_element *e);
/*
* Element Links
*/
struct idev_link {
/* element-to-device connection */
/* device-to-element connection */
};
/*
* Devices
*/
struct idev_device_vtable {
void (*free) (idev_device *d);
};
struct idev_device {
const idev_device_vtable *vtable;
char *name;
bool public : 1;
bool enabled : 1;
};
})
/*
* Elements
*/
struct idev_element_vtable {
void (*free) (idev_element *e);
void (*enable) (idev_element *e);
void (*disable) (idev_element *e);
void (*open) (idev_element *e);
void (*close) (idev_element *e);
};
struct idev_element {
const idev_element_vtable *vtable;
unsigned long n_open;
char *name;
bool enabled : 1;
bool readable : 1;
bool writable : 1;
};
})
/*
* Sessions
*/
struct idev_session {
char *name;
char *path;
void *userdata;
bool custom : 1;
bool managed : 1;
bool enabled : 1;
};
/*
* Contexts
*/
struct idev_context {
unsigned long ref;
};