Page MenuHomeFreeBSD

D16660.id.diff
No OneTemporary

D16660.id.diff

Index: sbin/devmatch/devmatch.c
===================================================================
--- sbin/devmatch/devmatch.c
+++ sbin/devmatch/devmatch.c
@@ -97,47 +97,6 @@
return h;
}
-static void
-read_linker_hints(void)
-{
- char fn[MAXPATHLEN];
- char *modpath, *p, *q;
- size_t buflen, len;
-
- if (linker_hints == NULL) {
- if (sysctlbyname("kern.module_path", NULL, &buflen, NULL, 0) < 0)
- errx(1, "Can't find kernel module path.");
- modpath = malloc(buflen);
- if (modpath == NULL)
- err(1, "Can't get memory for modpath.");
- if (sysctlbyname("kern.module_path", modpath, &buflen, NULL, 0) < 0)
- errx(1, "Can't find kernel module path.");
- p = modpath;
- while ((q = strsep(&p, ";")) != NULL) {
- snprintf(fn, sizeof(fn), "%s/linker.hints", q);
- hints = read_hints(fn, &len);
- if (hints == NULL)
- continue;
- break;
- }
- if (q == NULL)
- errx(1, "Can't read linker hints file.");
- } else {
- hints = read_hints(linker_hints, &len);
- if (hints == NULL)
- err(1, "Can't open %s for reading", fn);
- }
-
- if (*(int *)(intptr_t)hints != LINKER_HINTS_VERSION) {
- warnx("Linker hints version %d doesn't match expected %d.",
- *(int *)(intptr_t)hints, LINKER_HINTS_VERSION);
- free(hints);
- hints = NULL;
- }
- if (hints != NULL)
- hints_end = (void *)((intptr_t)hints + (intptr_t)len);
-}
-
static int
getint(void **ptr)
{
@@ -476,7 +435,8 @@
char *bus, *p;
do {
- if (!all_flag && dev->dd_name[0] != '\0')
+ if (!all_flag && dev->dd_name[0] != '\0' &&
+ strcmp(dev->dd_name, "vgapci0") != 0)
break;
if (!(dev->dd_flags & DF_ENABLED))
break;
@@ -536,6 +496,36 @@
exit(0);
}
+static void
+process_hints(int len)
+{
+ struct devinfo_dev *root;
+
+ if (*(int *)(intptr_t)hints != LINKER_HINTS_VERSION) {
+ warnx("Linker hints version %d doesn't match expected %d.",
+ *(int *)(intptr_t)hints, LINKER_HINTS_VERSION);
+ free(hints);
+ hints = NULL;
+ }
+ if (hints != NULL)
+ hints_end = (void *)((intptr_t)hints + (intptr_t)len);
+
+ if (dump_flag) {
+ search_hints(NULL, NULL, NULL);
+ return;
+ }
+
+ if (nomatch_str != NULL)
+ find_nomatch(nomatch_str);
+ if (devinfo_init())
+ err(1, "devinfo_init");
+ if ((root = devinfo_handle_to_device(DEVINFO_ROOT_DEVICE)) == NULL)
+ errx(1, "can't find root device");
+
+ devinfo_foreach_device_child(root, find_unmatched, (void *)0);
+ devinfo_free();
+}
+
static void
usage(void)
{
@@ -546,7 +536,6 @@
int
main(int argc, char **argv)
{
- struct devinfo_dev *root;
int ch;
while ((ch = getopt_long(argc, argv, "adh:p:uv",
@@ -580,18 +569,32 @@
if (argc >= 1)
usage();
- read_linker_hints();
- if (dump_flag) {
- search_hints(NULL, NULL, NULL);
- exit(0);
- }
- if (nomatch_str != NULL)
- find_nomatch(nomatch_str);
- if (devinfo_init())
- err(1, "devinfo_init");
- if ((root = devinfo_handle_to_device(DEVINFO_ROOT_DEVICE)) == NULL)
- errx(1, "can't find root device");
- devinfo_foreach_device_child(root, find_unmatched, (void *)0);
- devinfo_free();
+ char fn[MAXPATHLEN];
+ char *modpath, *p, *q;
+ size_t buflen, len;
+
+ if (linker_hints == NULL) {
+ if (sysctlbyname("kern.module_path", NULL, &buflen, NULL, 0) < 0)
+ errx(1, "Can't find kernel module path.");
+ modpath = malloc(buflen);
+ if (modpath == NULL)
+ err(1, "Can't get memory for modpath.");
+ if (sysctlbyname("kern.module_path", modpath, &buflen, NULL, 0) < 0)
+ errx(1, "Can't find kernel module path.");
+ p = modpath;
+ while ((q = strsep(&p, ";")) != NULL) {
+ snprintf(fn, sizeof(fn), "%s/linker.hints", q);
+ hints = read_hints(fn, &len);
+ if (hints == NULL) {
+ continue;
+ }
+ process_hints(len);
+ }
+ } else {
+ hints = read_hints(linker_hints, &len);
+ if (hints == NULL)
+ err(1, "Can't open %s for reading", fn);
+ process_hints(len);
+ }
}

File Metadata

Mime Type
text/plain
Expires
Mon, Jul 13, 5:56 AM (13 h, 8 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35013481
Default Alt Text
D16660.id.diff (3 KB)

Event Timeline