History log of /freebsd-10.1-release/lib/libgeom/geom_xml2tree.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 272461 02-Oct-2014 gjb

Copy stable/10@r272459 to releng/10.1 as part of
the 10.1-RELEASE process.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

# 256281 10-Oct-2013 gjb

Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


# 253469 19-Jul-2013 scottl

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


# 253249 12-Jul-2013 hrs

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

Pointed out by: jmallett


# 253247 12-Jul-2013 hrs

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


# 242130 26-Oct-2012 jh

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


# 234107 10-Apr-2012 jmallett

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


# 233646 29-Mar-2012 jmallett

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.)


# 213451 05-Oct-2010 emaste

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


# 202454 17-Jan-2010 delphij

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

Reviewed by: pjd, mav (earlier version)


# 181463 09-Aug-2008 des

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


# 180369 08-Jul-2008 lulf

- 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)


# 146561 24-May-2005 phk

Check for NULL pointer return.

Spotted by: marcus


# 126786 09-Mar-2004 jhb

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


# 126748 08-Mar-2004 phk

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

Noticed by: jhb


# 112340 17-Mar-2003 phk

Constify arg to geom_lookupid().

Improve a diagnostic printf.


# 110603 09-Feb-2003 phk

Leak more stuff into libgeom.