Commit Graph

52 Commits

Author SHA1 Message Date
bapt
6adce30d28 Convert libraries to use LIBADD
While here reduce a bit overlinking
2014-11-25 11:07:26 +00:00
jhb
59f001963a Explicitly specify MAP_SHARED when mapping the stats file descriptor.
Reviewed by:	kib
MFC after:	1 week
2014-09-17 19:37:58 +00:00
benno
420e85e546 Systems with lots of geom providers can end up with a kern.geom.confxml
value too large for the buffer allocated. Work around this by retrying
a few times with larger buffer sizes.

Submitted by:	Scott Ferris <scott.ferris@isilon.com>
Reviewed by:	mlaier, ngie
Sponsored by:	EMC Isilon Storage Division
2014-09-04 03:31:48 +00:00
bapt
1f77f137dc use .Mt to mark up email addresses consistently (part3)
PR:		191174
Submitted by:	Franco Fichtner  <franco at lastsummer.de>
2014-06-23 08:23:05 +00:00
scottl
7dbfd863d4 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
2013-07-19 06:42:15 +00:00
hrs
a243c0eb2c Revert r253247. This change should be improved based on a lesson learnt
from r233646 first.

Pointed out by:	jmallett
2013-07-12 04:22:46 +00:00
hrs
7b04a1affb 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
2013-07-12 02:36:00 +00:00
jh
bb7ab7e9bb 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
2012-10-26 12:46:33 +00:00
jmallett
e1c6390e12 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
2012-04-10 17:37:24 +00:00
jmallett
0b58621565 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.)
2012-03-29 03:13:43 +00:00
jh
06cd6f2bc1 Remove stale link.
PR:		151252
2010-12-04 08:44:56 +00:00
pjd
d92ab85359 Remove code duplication by introducing static gctl_param_add() function which
is now used by both gctl_ro_param() and gctl_rw_param().
2010-10-21 10:38:14 +00:00
pjd
78a51a1509 - Simplify gctl_get_handle() a bit.
- Prefer 'unsigned int' over 'u_int' in userland code.
2010-10-21 10:36:36 +00:00
emaste
58eabff0a0 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
2010-10-05 15:27:44 +00:00
joel
dd1fff9bcb Fix typos, spelling, formatting and mdoc mistakes found by Nobuyuki while
translating these manual pages.  Minor corrections by me.

Submitted by:	Nobuyuki Koganemaru <n-kogane@syd.odn.ne.jp>
2010-08-16 15:18:30 +00:00
delphij
51274ad8de Correct a typo (when we talk about offset, it should
be offset, not size).

Submitted by:	pluknet at gmail com
2010-01-17 08:12:28 +00:00
delphij
16c4a5ec20 Expose stripe offset and stripe size through libgeom and geom(8) userland
utilities.

Reviewed by:	pjd, mav (earlier version)
2010-01-17 06:20:30 +00:00
ed
eec85dbb58 Add missing `void' keyword. 2009-12-31 01:37:26 +00:00
trasz
678fe0aa03 Add links to libgeom(3) where appropriate. 2009-05-19 12:10:48 +00:00
lulf
7646af6a7d - Update the libgeom manpage with a description of g_device_path and
g_providername utility functions.

Approved by:	kib (mentor)
2008-09-08 06:27:00 +00:00
lulf
8c52b542c0 - Add a new ioctl for getting the provider name of a geom provider.
- Add a routine for looking up a device and checking if it is a valid geom
  provider given a partial or full path to its device node.

Reviewed by:	phk
Approved by:	pjd (mentor)
2008-09-07 13:54:57 +00:00
des
c2c1c946ae 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
2008-08-09 11:14:05 +00:00
lulf
1547b99716 - 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)
2008-07-08 17:34:50 +00:00
thompsa
0dd1763fd6 Fix spelling.
PR:		docs/124561
Submitted by:	Sam Banks
2008-06-13 21:49:21 +00:00
pjd
03149c9265 Use 'dowrite' as an argument name instead of too general 'write'. 2008-05-20 11:45:05 +00:00
des
8b3c515d76 Remove parameter names from prototypes to avoid namespace issues. 2007-05-06 10:00:27 +00:00
pjd
06c3c94d09 Implement and document some utility functions that can be used to communicate
with GEOM providers.

OK'ed by:	phk
2007-05-06 01:17:46 +00:00
wkoszek
0e767958a5 Second call of sysctl() is used to gather a proper size of a memory chunk
needed to hold the GEOM tree. At this point, pointer 'p' has an improper
value (as it was used previously), and we're getting EFAULT. Fix this
functionality by passing NULL instead of 'p'.

This fixes mdconfig(8) -l output with high number of md(4) devices.

   Found by:	kris
Reviewed by:	phk
2007-05-01 10:47:09 +00:00
ru
3cf38aeba7 Fix prototype. 2005-11-24 10:43:35 +00:00
phk
bf57cca39d Check for NULL pointer return.
Spotted by:	marcus
2005-05-24 10:10:38 +00:00
ru
615a6a246a Markup, grammar, punctuation. 2004-07-01 18:20:57 +00:00
jhb
01eed200f9 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
2004-03-09 21:14:18 +00:00
phk
ceb3b7463e String the consumers into the list of the provider they are attached to.
Noticed by:	jhb
2004-03-08 16:37:08 +00:00
phk
ea1893785c Add manpages for the gctl API.
Submitted by:	le
Tweaks by:	phk
2004-03-07 16:07:57 +00:00
obrien
372364ee0f style.Makefile(5) 2003-08-18 15:25:39 +00:00
gordon
5901302929 Stage 3 of dynamic root support. Make all the libraries needed to run
binaries in /bin and /sbin installed in /lib. Only the versioned files
reside in /lib, the .so symlink continues to live /usr/lib so the
toolchain doesn't need to be modified.
2003-08-17 08:28:46 +00:00
markm
2bd4af6413 Remove GCC-specific debugging option.
OK'ed by:	phk
2003-07-24 19:53:02 +00:00
charnier
c27d1525f8 The .Fn function 2003-06-18 19:43:17 +00:00
phk
8f1078dc32 Add the part of the last commit which cvs appearantly didn't like
the first time.
2003-06-01 15:05:22 +00:00
ru
7ffefb5839 Moved libgeom.so dependencies to where they belong.
Reviewed by:	phk
Approved by:	re (scottl)
2003-05-17 19:05:17 +00:00
phk
aba647cbf4 Collapse the meta arguments into normal arguments, trying to distinguish
just makes our own life harder.
2003-04-22 19:31:00 +00:00
phk
2d56ed957a Run a revision on the OAM api.
Use prefix gctl_ systematically.
Add flag with access perms for each argument.
Add ro/rw versions of argument building functions.
General cleanup.
2003-03-27 14:35:00 +00:00
phk
daa779779c Add marshalling functions for OAM api. 2003-03-23 10:15:02 +00:00
phk
88560bfa93 Use devstat instead of GEOM private statistics structure. 2003-03-18 09:53:46 +00:00
phk
884a12a930 Constify arg to geom_lookupid().
Improve a diagnostic printf.
2003-03-17 08:22:48 +00:00
ru
0dea541567 mdoc(7) police: Scheduled sweep. 2003-02-24 22:53:26 +00:00
phantom
2061f43aeb Add appropriate MLINKS for functions documented in libgeom.3 2003-02-13 18:27:05 +00:00
phantom
c542a27983 Fix some mdoc issues: add .Nd to NAME section, use valid .Lb argument,
use .Fn there appropriate
2003-02-13 18:25:48 +00:00
phk
a616f22441 Leak more stuff into libgeom. 2003-02-10 00:11:43 +00:00
phk
af6bbda282 Lower WARNS to 3 until I track down a way to explain that I know what
I'm doing to sparc64's gcc
2003-02-08 16:08:17 +00:00