Commit Graph

45 Commits

Author SHA1 Message Date
Warner Losh
fa9896e082 Remove $FreeBSD$: two-line nroff pattern
Remove /^\.\\"\n\.\\"\s*\$FreeBSD\$$\n/
2023-08-16 11:55:10 -06:00
Warner Losh
d0b2dbfa0e Remove $FreeBSD$: one-line sh pattern
Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
2023-08-16 11:55:03 -06:00
Warner Losh
1d386b48a5 Remove $FreeBSD$: one-line .c pattern
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
2023-08-16 11:54:42 -06:00
Warner Losh
2a63c3be15 Remove $FreeBSD$: one-line .c comment pattern
Remove /^/[*/]\s*\$FreeBSD\$.*\n/
2023-08-16 11:54:29 -06:00
Simon J. Gerraty
d9a4274795 Update/fix Makefile.depend for userland 2023-04-18 17:14:23 -07:00
Alan Somers
57dc6f5e20 sesutil: fix "fault all" with zoned jbods
Some SAS JBODs support zoning.  This feature allows individual SAS
targets to be accessible by only some initiator ports.  One application
would be connecting two servers to the same JBOD, but they wouldn't be
able to see each other's disks.

A zoned JBOD should also prohibit initiators from accessing SES elements
corresponding to inaccessible SAS targets.  It reports that by setting
the element's status code to 0x8 (No Access Allowed).

The bug is that when doing "sesutil (fault|locate) all ...", sesutil
will attempt a ENCIOC_SETELMSTAT ioctl for every single element, even
the inaccessible ones.  The enclosure will reject the command, the
kernel will return EINVAL, and sesutil will exit.

The solution is to check the element's status, and skip trying to set it
if the status is 0x8.  But if the user actually supplied a ses ID, then
assume that he knows what he's doing and try to set it anyway.

PR:		270093
MFC after:	1 week
Sponsored by:	Axcient
Reviewed by:	mav, trasz
Differential Revision: https://reviews.freebsd.org/D39017
2023-03-27 13:43:35 -06:00
Alan Somers
4bd4e4b45e sesutil: don't malloc in a tight loop
Reported by:	mav
MFC after:	1 week
Sponsored by:	Axcient
Reviwed by:	mav
Differential Revision: https://reviews.freebsd.org/D38473
2023-02-13 09:04:05 -07:00
Alan Somers
09f29b03dd sesutil: plug memory leaks
MFC after:	1 week
Sponsored by:	Axcient
Reviewed by:	bapt
Differential Revision: https://reviews.freebsd.org/D33955
2023-02-09 14:43:17 -07:00
Mateusz Piotrowski
4e3dc91e4c sesutil.8: Polish
- Use right mdoc macros
- Fix synopsis. Some of the optional command modifiers were not optional
  after all.
- Sort options

MFC after:	1 week
2022-07-05 16:39:01 +02:00
Alan Somers
eea7c61590 Add tests for ses(4)
The tests require SES hardware.  Without it, the test cases will be
skipped.

Reviewed by:	ken
Differential Revision: https://reviews.freebsd.org/D31809
Sponsored by:	Axcient
MFC after:	2 weeks
2022-01-19 12:43:51 -07:00
Alan Somers
18acbeb392 sesutil: fix a comment
MFC after:	2 weeks
Sponsored by:	Axcient
2022-01-19 12:43:51 -07:00
Alexander Motin
2e19fae49f sesutil: Avoid setting reserved bits.
Weird side of SES specification is that some bits have different
meaning or semantics in status and control pages.  This patch fixes
non-zero writes into reserved fields, that caused errors on some
enclosures when trying to control locate/fault LEDs, keeping other
bits unchanged.

MFC after:	2 weeks
Sposonred by:	iXsystems, Inc.
2022-01-13 13:57:35 -05:00
Poul-Henning Kamp
79f38143bd sesutil: Widen "Desc" field to fit "Drive Slot 23" 2022-01-02 11:44:02 +00:00
Edward Tomasz Napierala
a157196713 sesutil: Fix status checking
Previously we would display "OK, Swapped" for swapped disks,
instead of the usual disk size.

Reviewed By:	allanjude
Differential Revision:	https://reviews.freebsd.org/D31219
2021-07-21 10:14:26 +01:00
Edward Tomasz Napierala
3d10bf72ef Fix misplaced voltages/temperatures labels in 'sesutil show'.
PR:		bin/247384
Reported by:	brd
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D25353
2020-06-30 16:49:43 +00:00
Alan Somers
f05cc0f136 sesutil: fix Coverity CIDs
* 1411604: file descriptor leak
* 1411586: memory leaks, null dereference on ENOMEM

Reported by:	Coverity Scan
Coverity CIDs:	1411604, 1411586
Reviewed by:	trasz
MFC after:	2 weeks
Sponsored by:	Axcient
Differential Revision:	https://reviews.freebsd.org/D23651
2020-02-13 15:28:56 +00:00
Edward Tomasz Napierala
8ad16e5541 Add 'sesutil show' subcommand to show enclosure and its contents
in a user-friendly way.

Reviewed by:	allanjude, bcr (manpages)
MFC after:	2 weeks
Relnotes:	yes
Sponsored by:	Klara Inc.
Differential Revision:	https://reviews.freebsd.org/D22567
2019-12-14 10:58:06 +00:00
Edward Tomasz Napierala
2b2710a70b Fix typos.
MFC after:	2 weeks
Sponsored by:	Klara, Inc
2019-11-27 10:26:37 +00:00
Alan Somers
9f96f106f8 sesutil: fix another memory leak
Instead of calloc()ing (and forgetting to free) in a tight loop, just put
this small array on the stack.

Reported by:	Coverity
Coverity CID:	1331665
MFC after:	2 weeks
Sponsored by:	Axcient
2019-11-12 23:57:57 +00:00
Alan Somers
a221b104de sesutil: fix some memory leaks
Reported by:	Coverity
Coverity CID:	1331665
MFC after:	2 weeks
Sponsored by:	Axcient
2019-11-12 23:09:55 +00:00
Alan Somers
691a834cb7 sesutil: fix an out-of-bounds array access
sesutil would allow the user to toggle an LED that was one past the maximum
element.  If he tried, ENCIOC_GETELMSTAT would return EINVAL.

Reported by:	Coverity
Coverity CID:	1398940
MFC after:	2 weeks
Sponsored by:	Axcient
2019-11-12 23:03:52 +00:00
Alexander Motin
fe74eaab7c Check element type before setting LEDs.
With r319610, sesutil started twiddling the bits of every SES device.
Not everything is a disk slot, there are also fan controllers, temperature
sensors, even power supplies, among other things controlled by SES.

Add a type check to make sure we are only operating on device slot and array
device slot elements.  Other type elements will be skipped, but it would be
simple to add additional cases for controlling the ident LEDs of other
element types (which are not necessarily the same bits).

Rather than doing raw bit manipulation of an unstructured byte array using
unnamed numeric constants, leverage existing code abstractions.

Submitted by:	Ryan Moeller <ryan@freqlabs.com>
MFC after:	1 week
Sponsored by:	iXsystems, Inc.
Differential Revision:	https://reviews.freebsd.org/D19052
2019-02-04 01:24:10 +00:00
Bryan Drewery
ea825d0274 DIRDEPS_BUILD: Update dependencies.
Sponsored by:	Dell EMC Isilon
2017-10-31 00:07:04 +00:00
Bryan Drewery
7c2f06da87 DIRDEPS_BUILD: Update dependencies.
Sponsored by:	Dell EMC Isilon
2017-07-10 23:52:04 +00:00
Baptiste Daroussin
d25c1ff64f Add libxo(3) support to sesutil(8)
This is useful to simplify parsing "sesutil map"

Submitted by:	nikita.kozlov@blade-group.com
MFC after:	3 weeks
Relnotes:	yes
Sponsored by:	blade
2017-06-29 18:52:36 +00:00
Baptiste Daroussin
4d17a48343 sesutil no longer depends on libsbuf
Sponsored by:	Gandi.net
2017-06-23 15:27:23 +00:00
Baptiste Daroussin
20a957e37a Directly print the extra status instead of filling a buffer
then printing it.

This prepares the code to make it libxo friendly

Reviewed by:	manu, Nikita Kozlov (nikita elyzion.net)
MFC after:	2 weeks
Sponsored by:	Gandi.net
2017-06-23 15:09:08 +00:00
Baptiste Daroussin
b556669269 Do not use sprintf(3) when not needed, while here,
prefer snprintf(3) over sprintf(3)
2017-06-23 13:26:13 +00:00
Allan Jude
24ffc64926 usr.sbin/sesutil: 'locate all off' does not deactivate empty slots
PR:		217409
Reported by:	asomers
Reviewed by:	asomers, bapt
MFC after:	1 week
Sponsored by:	ScaleEngine Inc.
Differential Revision:	https://reviews.freebsd.org/D10458
2017-06-06 02:03:22 +00:00
Alexander Motin
efab8bfdb3 Fix sesutil fault operation.
Fault and ident bits are located in different control bytes, so previous
code was just doing nothing, writing into reserved bit.

MFC after:	1 week
2016-09-30 20:35:12 +00:00
Baptiste Daroussin
f734685ea4 Plug memory leak
Reported by:	coverity
CID:		1331664, 1331665
2016-04-20 21:37:32 +00:00
Baptiste Daroussin
1427ff7da9 Cleanup headers
Found by:	include-what-you-use
2016-03-26 12:11:46 +00:00
Bryan Drewery
e3ebb82118 DIRDEPS_BUILD: Update dependencies.
Sponsored by:	EMC / Isilon Storage Division
2016-01-07 19:58:23 +00:00
Baptiste Daroussin
60f466403f Show the enclosure name and id in sesutil map
Sponsored by:	Gandi.net
2015-12-15 13:01:14 +00:00
Baptiste Daroussin
96e6c444c3 Fix sesutil locate when a sesid is passed to locate command 2015-12-11 21:11:02 +00:00
Baptiste Daroussin
d7654478d3 sesutil: Add extra information specific to some SES devices to sesutil map
Rework stat2ascii preparing a buffer of what could be printed. This prevent the
risk of overflowing a static buffer.

Do not print those informations anymore in the "status" but into a new
"extra status" only printed if there are actually extra things to print.

Now add those extra informations:

* Thermal sensor temperature
* Cooling devices speed
* Voltage sensors, current consumption

Tested by:	AllanJude
Sponsored by:	Gandi.net
Differential Revision:	https://reviews.freebsd.org/D4520
2015-12-11 20:45:39 +00:00
Baptiste Daroussin
f57605fb7d sesutils, pass the correct element type when printing the status of a given
element of the ses.

Sponsored by:	Gandi.net
2015-12-11 11:08:00 +00:00
Baptiste Daroussin
845614cd22 sesutil: fix map not printing the status of the LED device in an array
Sponsored by:	Gandi.net
2015-12-11 10:58:26 +00:00
Allan Jude
6af5d161e7 Rename some functions and variables inside sesutil(8) to make gcc happy
Reported by:	bz
Approved by:	bapt (implicit)
Sponsored by:	ScaleEngine Inc.
2015-09-19 18:41:24 +00:00
Bryan Drewery
6fcd667fd6 Connect sesutil(1) and numactl(1) for META_MODE.
Sponsored by:	EMC / Isilon Storage Division
2015-09-19 17:47:36 +00:00
Allan Jude
8729f5ec0e Improve and expand sesutil(8)
- Return an error if no matching device is found when the locate command is run
- Enhance the locate command to be able to address drive bays with no disk, or where the SES controller has not made the mapping to the device name
- Added the fault command, similar to locate, but a different SES property. On some of my controllers locate blinks the activity light, others the fault light. The fault command keeps the fault light on constant.
- Improve the usage() output and use it everywhere
- Added the map command, displays all elements connected to each (or the specified) ses(4) controller
- Added the status command, returns the overall status of the ses(4) controller

Reviewed by:	wblock (man page, earlier version)
Approved by:	bapt (mentor)
MFC after:	3 weeks
Relnotes:	yes
Sponsored by:	ScaleEngine Inc.
Differential Revision:	https://reviews.freebsd.org/D3580
2015-09-19 16:36:45 +00:00
Baptiste Daroussin
1bc54324e9 Yet another fix for gcc 4.2 2015-09-05 22:33:40 +00:00
Baptiste Daroussin
cb291e8aa1 Remove extra i++
Reported by:	allanjude@
2015-09-05 21:55:01 +00:00
Baptiste Daroussin
4569e7cfe2 Fix build with gcc 4.2
Reported by:	kib
2015-09-05 16:59:30 +00:00
Baptiste Daroussin
cddcb2599f Add a new sesutil(8) utility
This is an utility for managing SCSI Enclosure Services (SES) device.

For now only one command is supported "locate" which will change the test of the
external LED associated to a given disk.

Usage if the following:
sesutil locate disk [on|off]

Disk can be a device name: "da12" or a special keyword: "all".

Reviewed by:	mav
MFC after:	1 month
Relnotes:	yes
Sponsored by:	gandi.net
Differential Revision:	https://reviews.freebsd.org/D3544
2015-09-05 00:06:01 +00:00