udev-builtin-hwdb.c revision b5efdb8af40ea759a1ea584c1bc44ecc81dd00ce
/***
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 <fnmatch.h>
#include <getopt.h>
#include <stdio.h>
#include <stdlib.h>
#include "sd-hwdb.h"
#include "alloc-util.h"
#include "hwdb-util.h"
#include "string-util.h"
#include "udev-util.h"
#include "udev.h"
int n = 0;
if (!hwdb)
return -ENOENT;
if (prefix) {
if (!lookup)
return -ENOMEM;
}
continue;
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];
bool last = false;
int r = 0;
if (!srcdev)
const char *dsubsys;
if (!dsubsys)
continue;
/* look only at devices of a specific subsystem */
continue;
/* if the usb_device does not have a modalias, compose one */
if (!modalias)
modalias = modalias_usb(d, s, sizeof(s));
/* avoid looking at any parent device, they are usually just a USB hub */
last = true;
}
if (!modalias)
continue;
if (r > 0)
break;
}
return r;
}
{}
};
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;
}
return EXIT_SUCCESS;
return EXIT_FAILURE;
}
/* called at udev startup and reload */
int r;
if (hwdb)
return 0;
r = sd_hwdb_new(&hwdb);
if (r < 0)
return r;
return 0;
}
/* called on udev shutdown and reload request */
}
/* called every couple of seconds during event activity; 'true' if config has changed */
return hwdb_validate(hwdb);
}
const struct udev_builtin udev_builtin_hwdb = {
.name = "hwdb",
.cmd = builtin_hwdb,
.help = "Hardware database",
};