udev-builtin-hwdb.c revision a4bbef099209d4e3bccd913cd30da536f8971064
/***
This file is part of systemd.
Copyright 2012 Kay Sievers <kay@vrfy.org>
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 <stdio.h>
#include <errno.h>
#include <string.h>
#include <inttypes.h>
#include <ctype.h>
#include <stdlib.h>
#include <fnmatch.h>
#include <getopt.h>
#include "udev.h"
struct udev_list_entry *list;
struct udev_list_entry *entry;
int n = 0;
if (!hwdb)
return -ENOENT;
if (prefix) {
_cleanup_free_ const char *lookup;
if (!lookup)
return -ENOMEM;
} else
continue;
udev_list_entry_get_value(entry)) < 0)
return -ENOMEM;
n++;
}
return n;
}
const char *v, *p;
if (!v)
return NULL;
if (!p)
return NULL;
if (vn <= 0)
return NULL;
if (pn <= 0)
return NULL;
return s;
}
struct udev_device *d;
char s[16];
int n = 0;
for (d = srcdev; d; d = udev_device_get_parent(d)) {
const char *dsubsys;
if (!dsubsys)
continue;
/* look only at devices of a specific subsystem */
continue;
/* the usb_device does not have a modalias, compose one */
modalias = modalias_usb(d, s, sizeof(s));
if (!modalias)
if (!modalias)
continue;
if (n > 0)
break;
}
return n;
}
{}
};
struct udev_device *srcdev;
if (!hwdb)
return EXIT_FAILURE;
for (;;) {
int option;
if (option == -1)
break;
switch (option) {
case 'f':
break;
case 'd':
break;
case 's':
break;
case 'p':
break;
}
}
/* query a specific key given as argument */
return EXIT_SUCCESS;
return EXIT_FAILURE;
}
/* read data from another device than the device we will store the data */
if (device) {
if (!srcdev)
return EXIT_FAILURE;
} else
return EXIT_FAILURE;
return EXIT_SUCCESS;
}
/* called at udev startup and reload */
{
if (hwdb)
return 0;
if (!hwdb)
return -ENOMEM;
return 0;
}
/* called on udev shutdown and reload request */
{
}
/* called every couple of seconds during event activity; 'true' if config has changed */
{
return udev_hwdb_validate(hwdb);
}
const struct udev_builtin udev_builtin_hwdb = {
.name = "hwdb",
.cmd = builtin_hwdb,
.help = "hardware database",
};