History log of /freebsd-current/lib/libgeom/geom_xml2tree.c
Revision Date Author Comments
# b3e76948 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: two-line .h pattern

Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/


# eb8f8877 10-May-2023 Warner Losh <imp@FreeBSD.org>

spdx: The BSD-3-Clause-FreeBSD identifier never was, drop -FreeBSD

There never was a BSD-3-Clause-FreeBSD SPDX identifier. Replace it
with BSD-3-Clause.

Discussed with: pfg
MFC After: 3 days
Sponsored by: Netflix


# bd0f3d34 15-Mar-2022 Alexander Motin <mav@FreeBSD.org>

GEOM: Fix regression after 7f16b501e25.

find_geom() in some classes trim leading "/dev/" from geom names.
Lack of that in geom_gettree_geom() broke some existing scripts.

PR: 262554
MFC after: 2 months


# 7f16b501 12-Mar-2022 Alexander Motin <mav@FreeBSD.org>

GEOM: Introduce partial confxml API

Traditionally the GEOM's primary channel of information from kernel to
user-space was confxml, fetched by libgeom through kern.geom.confxml
sysctl. It is convenient and informative, representing full state of
GEOM in a single XML document. But problems start to arise on systems
with hundreds of disks, where the full confxml size reaches many
megabytes, taking significant time to first write it and then parse.

This patch introduces alternative solution, allowing to fetch much
smaller XML document, subset of the full confxml, limited to 64KB and
representing only one specified geom and optionally its parents. It
uses existing GEOM control interface, extended with new "getxml" verb.
In case of any error, such as the buffer overflow, it just transparently
falls back to traditional full confxml. This patch uses the new API in
user-space GEOM tools where it is possible.

Reviewed by: imp
MFC after: 2 month
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D34529


# 3874c0ab 07-Jul-2021 Alan Somers <asomers@FreeBSD.org>

[skip ci] correct a few SPDX license tags

These were all incorrectly labeled as 2-clause BSD licenses by a
semi-automated process, when in fact they are 3-clause.

Discussed with: pfg, imp
MFC after: 2 weeks
Sponsored by: Axcient


# 5e53a4f9 25-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

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.


# ef9fc4af 28-Aug-2015 Xin LI <delphij@FreeBSD.org>

Plug memory leaks when running out of memory.

Reported by: clang scan-build
MFC after: 2 weeks


# 0aedf4e8 13-Aug-2015 Alexander Motin <mav@FreeBSD.org>

Revert part of r280687, reporting "1" (true) for empty value.

For example, it made gpart partitions without label report "1" as label.

PR: 202089
MFC after: 3 days


# e5437982 22-Apr-2015 Pedro F. Giffuni <pfg@FreeBSD.org>

libgeom: plug memory leak in EndElement.

CID: 1016696
Found by: Clang static checker
MFC after: 1 week


# 5523c82c 25-Mar-2015 Alexander Motin <mav@FreeBSD.org>

Make GEOM_PART work in presence of previous withered self.

MFC after: 2 weeks
Sponsored by: iXsystems, Inc.


# 748e404f 19-Jul-2013 Scott Long <scottl@FreeBSD.org>

Since there's no defined schema for the XML that's generated by the
kern.geom.confxml sysctl, it's silly to warn about tags in libgeom,
especially since libgeom exists simply to build a tree out of the conf
information.

Obtained from: Netflix
MFC after: 3 days


# c70d61d5 11-Jul-2013 Hiroki Sato <hrs@FreeBSD.org>

Revert r253247. This change should be improved based on a lesson learnt
from r233646 first.

Pointed out by: jmallett


# aae0d5e5 11-Jul-2013 Hiroki Sato <hrs@FreeBSD.org>

Use strtoumax() instead of strtoul() for id/ref attr in XML elements.
This improves compatibility when running an ILP32 binary on LP64 kernel.

Spotted by: gjb


# e8f6ee4a 25-Oct-2012 Jaakko Heinonen <jh@FreeBSD.org>

Improve libgeom XML parsing error handling.

- Abort parsing and return an error if we run out of memory.
- Return EILSEQ from geom_xml2tree() for XML syntax errors.

Silence on: freebsd-geom


# 019100de 10-Apr-2012 Juli Mallett <jmallett@FreeBSD.org>

Back out r233646. Although it fixed most libgeom consumers under 32-bit
compatibility, it broke programs using devstat, under 32-bit compatibility and
not.

It's very difficult to fix the identifiers used by devstat, so this change is
simply being backed out. Since changes to 3rd-party code seem likely, and may be
necessary to properly fix 32-bit binaries on 64-bit kernel, it would seem better
to make more invasive changes to fix GEOM's problems with 32-bit compatibility in
general.

The right thing to do is to replace all of the use of pointers as opaque
identifiers with a fixed-size (64-bit or even 32-bit should be enough for tracking
unique GEOM elments) field. That probably maintains source compatibility with
most GEOM consumers, and allows xml2tree to make better assumptions about how to
decode the identifiers.

Submitted by: Anton Yuzhaninov


# 3dce589c 28-Mar-2012 Juli Mallett <jmallett@FreeBSD.org>

Fix 32-bit libgeom consumers run on 64-bit kernels with COMPAT_FREEBSD32.

Kernel pointer values are used as opaque unique identifiers, which are then
used to reconstruct references between various providers, classes, etc., inside
libgeom from the source XML. Unfortunately, they're converted to pointer-width
integers (in the form of pointers) to do this, and 32-bit userland pointers
cannot hold sensible representations (however opaque) of 64-bit kernel pointers
on all systems.

In the case where the leading bits are zero and 32 distinct bits of pointer can
be identified, this will happen to work. On systems where the upper 32-bits of
kernel pointers are non-zero and the same for all kernel pointers, this will
result in double frees and all kinds of bizarre crashes and linkage between
objects inside libgeom.

To mitigate this problem, treat the opaque identifiers in the XML as C strings
instead, and internalize them to give unique and consistent per-object pointer
values in userland for each identifier in the XML. This allows us to keep the
libgeom logic the same with only minor changes to initial setup and parsing.

It might be more sensible for speed reasons to treat the identifiers as numbers
of a large size (uintmax_t, say) rather than strings, but strings seem fine for
now.

(As an added side-effect, this makes it slightly easier to identify unresolved
references, but nothing has been added to inform the user of those.)


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# 2cf6dafa 05-Oct-2010 Ed Maste <emaste@FreeBSD.org>

Handle null return from XML_ParserCreate and fix a few memory leaks on
error conditions.

Submitted by: Mark Johnston <mjohnston at sandvine dot com>
MFC after: 2 weeks


# fe0506d7 09-Mar-2010 Marcel Moolenaar <marcel@FreeBSD.org>

Create the altix project branch. The altix project will add support
for the SGI Altix 350 to FreeBSD/ia64. The hardware used for porting
is a two-module system, consisting of a base compute module and a
CPU expansion module. SGI's NUMAFlex architecture can be an excellent
platform to test CPU affinity and NUMA-aware features in FreeBSD.


# 35daa28f 16-Jan-2010 Xin LI <delphij@FreeBSD.org>

Expose stripe offset and stripe size through libgeom and geom(8) userland
utilities.

Reviewed by: pjd, mav (earlier version)


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# 2616144e 09-Aug-2008 Dag-Erling Smørgrav <des@FreeBSD.org>

Add sbuf_new_auto as a shortcut for the very common case of creating a
completely dynamic sbuf.

Obtained from: Varnish
MFC after: 2 weeks


# 7b6942a1 08-Jul-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Simplify the procedure of retrieving XML-data from the kernel.
- Fix a number of potential memory leaks in libgeom related to doing realloc
without freeing old pointer if things go wrong.
- Fix a number of places in libgeom where malloc and calloc return values
were not checked.
- Check malloc return value and provide sufficient warning messages when XML
parsing fails.

PR: kern/83464
Submitted by: Dan Lukes <dan - at - obluda.cz>
Approved by: kib (mentor)


# 90d93f71 24-May-2005 Poul-Henning Kamp <phk@FreeBSD.org>

Check for NULL pointer return.

Spotted by: marcus


# ccac9da4 09-Mar-2004 John Baldwin <jhb@FreeBSD.org>

Make libgeom usable by C++ programs:
- Add DECL wrappers to libgeom.h.
- Rename structure members in libgeom.h to use a lg_ prefix for member
names. This is required because a few structures had members named
'class' which made g++ very unhappy.
- Catch gstat(8) and gconcat(8) up to these API changes.

Reviewed by: phk


# 4aa50d28 08-Mar-2004 Poul-Henning Kamp <phk@FreeBSD.org>

String the consumers into the list of the provider they are attached to.

Noticed by: jhb


# 2ad2651a 17-Mar-2003 Poul-Henning Kamp <phk@FreeBSD.org>

Constify arg to geom_lookupid().

Improve a diagnostic printf.


# 7bd4e7b4 09-Feb-2003 Poul-Henning Kamp <phk@FreeBSD.org>

Leak more stuff into libgeom.