sysfs-show.c revision 06acf2d46a38bec212d78094e6ef8b100679048a
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
/***
This file is part of systemd.
Copyright 2010 Lennart Poettering
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/>.
***/
#include <errno.h>
#include <string.h>
#include <libudev.h>
#include "util.h"
#include "sysfs-show.h"
#include "path-util.h"
#include "udev-util.h"
static int show_sysfs_one(
const char *seat,
struct udev_list_entry **item,
const char *sub,
const char *prefix,
unsigned n_columns) {
while (*item) {
bool is_master;
return 0;
if (!d) {
continue;
}
sn = "seat0";
/* Explicitly also check for tag 'seat' here */
continue;
}
if (!name)
/* Look if there's more coming after this */
while (lookahead) {
const char *lookahead_sysfs;
if (lookahead_d) {
const char *lookahead_sn;
if (isempty(lookahead_sn))
lookahead_sn = "seat0";
break;
}
}
}
if (!k)
return -ENOMEM;
if (asprintf(&l,
"%s%s:%s%s%s%s",
return -ENOMEM;
free(k);
if (!k)
return -ENOMEM;
if (*item) {
_cleanup_free_ char *p = NULL;
if (!p)
return -ENOMEM;
}
}
return 0;
}
int r;
if (n_columns <= 0)
if (!prefix)
prefix = "";
seat = "seat0";
if (!udev)
return -ENOMEM;
e = udev_enumerate_new(udev);
if (!e)
return -ENOMEM;
r = udev_enumerate_add_match_tag(e, seat);
else
r = udev_enumerate_add_match_tag(e, "seat");
if (r < 0)
return r;
if (r < 0)
return r;
r = udev_enumerate_scan_devices(e);
if (r < 0)
return r;
if (first)
return r;
}