Commit graph

12 commits

Author SHA1 Message Date
Warner Losh b3e7694832 Remove $FreeBSD$: two-line .h pattern
Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
2023-08-16 11:54:16 -06:00
Kirk McKusick 90e29718cf Clarify when GEOM utilities exit with success or failure.
Historically, GEOM utilities (gpart(8), gstripe(8), gmirror(8),
etc) used the gctl_error() routine to report errors. If they called
gctl_error() they would exit with EXIT_FAILURE, otherwise they would
return with EXIT_SUCCESS. If they used gctl_error() to output an
informational message, for example when run with the -v (verbose)
option, they would mistakenly exit with EXIT_FAILURE. A further
limitation of the gctl_error() function was that it could only be
called once. Messages from any additional calls to gctl_error()
would be silently discarded.

To resolve these problems a new function, gctl_msg() has been added.
It can be called multiple times to output multiple messages. It
also has an additional errno argument which should be zero if it is
an informational message or an errno value (EINVAL, EBUSY, etc) if
it is an error. When done the gctl_post_messages() function should
be called to indicate that all messages have been posted. If any
of the messages had a non-zero errno, the utility will EXIT_FAILURE.
If only informational messages (with zero errno) were posted, the
utility will EXIT_SUCCESS.

Tested by:   Peter Holm
PR:          265184
MFC after:   1 week
2022-07-16 10:26:51 -07:00
Alexander Motin 2117cdd4b4 GEOM: Introduce gctl_add_param() API.
Make gctl_add_param() API public, allowing more precise control over
parameter flags.  Previously it was impossible to properly declare
write-only ASCII parameters, used for result reporting, they were
declared as read-write binary instead, that was not nice.

MFC after:	1 month
2022-03-07 11:12:25 -05: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
Enji Cooper f06b2368bf Minor style(9) fixups
Delete trailing whitespace and sort headers.

Leave libgeom.h's placement alone, per reasoning in r317289.

MFC after:	5 weeks
Sponsored by:	Dell EMC Isilon
2017-04-23 03:36:03 +00:00
Pawel Jakub Dawidek 42e2e8990a 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
Pawel Jakub Dawidek 91cca30d9c - Simplify gctl_get_handle() a bit.
- Prefer 'unsigned int' over 'u_int' in userland code.
2010-10-21 10:36:36 +00:00
Ulf Lilleengen 7b6942a110 - 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
Poul-Henning Kamp 7e02e189ae Add the part of the last commit which cvs appearantly didn't like
the first time.
2003-06-01 15:05:22 +00:00
Poul-Henning Kamp 64a5766ef7 Collapse the meta arguments into normal arguments, trying to distinguish
just makes our own life harder.
2003-04-22 19:31:00 +00:00
Poul-Henning Kamp 63728c47e8 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
Poul-Henning Kamp 4b8938c1d5 Add marshalling functions for OAM api. 2003-03-23 10:15:02 +00:00