SES(4)

๐ŸŒธ SES(4) โ€” the SCSI Environmental Services driver, bestie edition ๐ŸŒธ

okay so welcome to the Kernel Interfaces Manual, and today's main character is ses โ€” the SCSI Environmental Services driver. she's the one who tells you if your enclosure is thriving or literally overheating. let's get into it ๐Ÿ’…


โœจ NAME โœจ

ses โ€” the SCSI Environmental Services driver. that's it, that's the name, and she ate.


๐ŸŽ€ SYNOPSIS ๐ŸŽ€

device ses

one line. one vibe. that's how you invite her to the kernel party.


๐Ÿ’– DESCRIPTION ๐Ÿ’–

so here's the tea: the ses driver provides support for all SCSI devices of the environmental services class that are attached to the system through a supported SCSI Host Adapter โ€” and yes, she also does emulated support for SAF-TE (SCSI Accessible Fault Tolerant Enclosures) ๐Ÿฆ‹

and what even is the environmental services class, you ask? bestie, they're generally enclosure devices that serve up environmental info like:

  • how many power supplies you have (and their state) ๐Ÿ”Œ
  • temperature ๐ŸŒก๏ธ
  • device slots ๐ŸŽฐ
  • and so on, and so on โœจ
โš ๏ธ heads up: a SCSI Host adapter has to be separately configured into the system before a SCSI Environmental Services device can be configured. no host adapter, no ses, periodt.

๐Ÿงš KERNEL CONFIGURATION ๐Ÿงš

the way that you only need to explicitly configure one ses device โ€” data structures are dynamically allocated as devices are found on the SCSI bus. so don't be out here listing forty of them, she scales herself ๐Ÿ’…

there's also a separate option, SES_ENABLE_PASSTHROUGH, which may be specified to allow the ses driver to perform functions on devices of other classes that claim to also support ses functionality. lowkey generous of her honestly ๐Ÿซถ


๐Ÿ”ฅ IOCTLS ๐Ÿ”ฅ

these ioctl(2) calls apply to ses devices, and they're all defined in the header file <cam/scsi/scsi_enc.h> (q.v. โ€” go read it, iykyk).

  • ENCIOC_GETNELM โ€” used to find out how many ses elements are driven by this particular device instance. how many little guys are we managing? this tells you ๐Ÿงฎ
  • ENCIOC_GETELMMAP โ€” read, from the kernel, an array of SES elements which contains the element identifier, which subenclosure it is in, and the ses type of the element. it's giving full roster, with receipts ๐Ÿ“‹
  • ENCIOC_GETENCSTAT โ€” get the overall enclosure status. the vibe check, but for your whole enclosure โœจ
  • ENCIOC_SETENCSTAT โ€” set the overall enclosure status. you get to decide the vibe now ๐Ÿ‘‘
  • ENCIOC_GETELMSTAT โ€” get the status of a particular element. one specific little guy's whole situation ๐Ÿ”
  • ENCIOC_SETELMSTAT โ€” set the status of a particular element. now you're the one writing his story ๐Ÿ“
  • ENCIOC_GETTEXT โ€” get the associated help text for an element (not yet implemented ๐Ÿ™ˆ). ses devices often have descriptive text for an element which can tell you things like location (e.g., "left power supply"). imagine the lore we could have. someday, bestie.
  • ENCIOC_INIT โ€” initialize the enclosure. factory reset her wig ๐Ÿ’ซ
  • ENCIOC_GETELMDESC โ€” get the element's descriptor string. her little name tag ๐Ÿท๏ธ
  • ENCIOC_GETELMDEVNAMES โ€” get the device names, if any, associated with this element. who is she actually attached to? ๐Ÿฆ‹
  • ENCIOC_GETSTRING โ€” used to read the SES String In Diagnostic Page. the contents of this page are device-specific, so no two are the same, main character energy fr ๐Ÿ“–
  • ENCIOC_SETSTRING โ€” used to set the SES String Out Diagnostic Page. the contents of this page are device-specific too. you're writing back to her โœ๏ธ
  • ENCIOC_GETENCNAME โ€” used to get the name of the enclosure. what's her government name ๐Ÿ‘€
  • ENCIOC_GETENCID โ€” used to get the Enclosure Logical Identifier. her literal government ID ๐Ÿชช

๐ŸŒˆ EXAMPLE USAGE ๐ŸŒˆ

not me about to hand you free homework: the files contained in </usr/share/examples/ses> show simple mechanisms for how to use these interfaces, as well as a very stupid simple monitoring daemon. she said "simple" twice and meant it, and honestly? iconic ๐Ÿ˜ญ


๐Ÿ“ FILES ๐Ÿ“

  • /dev/sesN โ€” the *N*th SES device. your girl, numbered ๐Ÿ’–

๐Ÿ’€ DIAGNOSTICS ๐Ÿ’€

when the kernel is configured with DEBUG enabled, the first open to an SES device will spit out overall enclosure parameters to the console. she will overshare โ€” but only once, and only if you asked for it ๐Ÿ—ฃ๏ธ


๐Ÿ‘‘ SEE ALSO ๐Ÿ‘‘

  • sesutil(8) โ€” go say hi, she's the bestie ๐Ÿ’œ

๐ŸŒธ HISTORY ๐ŸŒธ

the ses driver was originally written for the CAM SCSI subsystem by Matthew Jacob and first released in FreeBSD 4.3 ๐ŸŽ€ it was a functional equivalent of a similar driver available in Solaris, Release 7. then it was largely rewritten by Alexander Motin, Justin Gibbs, and Will Andrews for FreeBSD 9.2. a glow-up across two decades, we love to see it โœจ


and that's the whole page, bestie. this one came to you from Debian, dated November 12, 2019 โ€” so if anyone asks where you learned all this, you can say a Debian manual from late 2019 told you, and honestly? slay. now go check your power supplies ๐Ÿ’…๐Ÿซถ

๐Ÿ“ฆ where this page comes from