Commit Graph

16 Commits

Author SHA1 Message Date
Warner Losh
4d846d260e spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD
The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of BSD-2-Clause.

Discussed with:		pfg
MFC After:		3 days
Sponsored by:		Netflix
2023-05-12 10:44:03 -06:00
Eric van Gyzen
32592d86df devinfo: fix memory leak on error paths
Refactor to create devinfo_free_dev().  Call it to plug a memory leak
on two error paths in devinfo_init_devices().

Reported by:	Coverity
MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
2020-08-04 21:05:53 +00:00
Warner Losh
cf72c10fd2 Update to device enumeration protocol 2
The new protocol from the kernel encodes things as a string table,
extract it into fields. strdup the strings, and free them when we're
done.

Differential Revision: https://reviews.freebsd.org/D15629
2018-05-31 02:58:03 +00:00
Warner Losh
92376fa76c Sanity check the return from the kernel.
We should be getting back as many bytes as we asked for, and we
don't handle shortages at all, so just reject anything that's
not right.

Differential Revision: https://reviews.freebsd.org/D15629
2018-05-31 02:57:51 +00:00
Warner Losh
51a9cfbf60 There's no meaningful errno when there's a version mismatch, so use
warnx. Also, report the mis-matched versions.
2018-05-30 15:08:46 +00:00
Warner Losh
41ec95c47f Bump number that's an insane number of devices from 1,000 to 10,000. I
have access to machines that are pushing 400 devices. When 1,000 was
selected, it was rare to get even 40 or 50 devices. Bump the limit by
10x to keep up with the times.

Sponsored by: Netflix
2017-12-21 04:21:59 +00:00
Pedro F. Giffuni
5e53a4f90f lib: further adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 2-Clause license, however the tool I
was using mis-identified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.
2017-11-26 02:00:33 +00:00
Stefan Farfeleder
60cd586318 Make the variadic macro debug() comply to C99. 2006-07-17 09:33:24 +00:00
John Baldwin
afc7f38c6b Clear devinfo_generation in devinfo_free() since we are freeing all of the
cached state.  Otherwise, a subsequent call to devinfo_init() would succeed
without reading the device tree from the kernel thinking that the cached
state was up to date since the generation count was the same.  However,
since the cached state was actually free'd, attempts to examine the tree
after the second devinfo_init() would fail.

Reported by:	Juho Vuori juho dot vuori at kepa dot fi
Submitted by:	Stefan Farfeleder stefan at fafoe dot narf dot at
Approved by:	re (dwhite)
MFC after:	1 week
2005-06-22 15:20:11 +00:00
Philippe Charnier
109a0e6b26 Remove unused variables. Whitespace cleaning. 2005-05-20 12:46:34 +00:00
Stefan Farfeleder
2af3af27a2 Fix typo in a comment. 2005-03-01 20:32:05 +00:00
Stefan Farfeleder
e60b9f5130 Prefer C99's __func__ over GCC's __FUNCTION__. 2004-09-22 16:56:49 +00:00
Warner Losh
43832002d3 Expose the new kernel data structures to libdevinfo:
o Added dd_pnpinfo, dd_location, dd_devflags, dd_flags and dd_state
	o Copy/initialize these as necessary.
	o Document the changes to the interface in devinfo.3.
2002-09-20 02:16:33 +00:00
Matthew Dillon
e67f5b9fca Implement __FBSDID() 2001-09-16 21:35:07 +00:00
John Baldwin
e495c5609b Include string.h for the strlen() prototype to quiet a warning. 2001-08-10 16:55:09 +00:00
Mike Smith
a2e6df2951 This is the Device Information Library, libdevinfo.
The devinfo library provides access to the kernel's internal device
hierarchy and to the I/O resource manager.  The library uses a
sysctl(9) interface to obtain a snapshot of the kernel's state which
is then made available to the application.
2001-04-20 05:53:30 +00:00