test-libudev.c revision c0c6a4fc1c843fc61d44dc9f0a2b14c01201db12
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering This file is part of systemd.
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering Copyright 2008-2012 Kay Sievers <kay@vrfy.org>
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering systemd is free software; you can redistribute it and/or modify it
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering under the terms of the GNU Lesser General Public License as published by
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering the Free Software Foundation; either version 2.1 of the License, or
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering (at your option) any later version.
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering systemd is distributed in the hope that it will be useful, but
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering WITHOUT ANY WARRANTY; without even the implied warranty of
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering Lesser General Public License for more details.
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering You should have received a copy of the GNU Lesser General Public License
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering along with systemd; If not, see <http://www.gnu.org/licenses/>.
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poetteringstatic void print_device(struct udev_device *device) {
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering printf("devnum: %u:%u\n", major(devnum), minor(devnum));
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(device)) {
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering printf("link: '%s'\n", udev_list_entry_get_name(list_entry));
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(device)) {
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering str = udev_device_get_property_value(device, "MAJOR");
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering str = udev_device_get_sysattr_value(device, "dev");
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poetteringstatic int test_device(struct udev *udev, const char *syspath) {
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering _cleanup_udev_device_unref_ struct udev_device *device;
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering printf("looking at device: %s\n", syspath);
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering device = udev_device_new_from_syspath(udev, syspath);
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poetteringstatic int test_device_parents(struct udev *udev, const char *syspath) {
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering _cleanup_udev_device_unref_ struct udev_device *device;
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering printf("looking at device: %s\n", syspath);
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering device = udev_device_new_from_syspath(udev, syspath);
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering device_parent = udev_device_get_parent(device_parent);
int count = 0;
count++;
return count;
int fd_ep;
if (fd_ep < 0) {
goto out;
goto out;
goto out;
goto out;
goto out;
goto out;
int fdcount;
for (i = 0; i < fdcount; i++) {
goto out;
out:
if (fd_ep >= 0)
goto out;
goto out;
goto out;
out: