Date: Mon, 11 May 2026 22:21:18 +0000 From: Chuck Tuffli <chuck@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 7419d6e463fe - main - Add 'contrib/smart/' from commit 'eb3b1302382b1d0cbe37eeebabfcdd546aa2fc4e' Message-ID: <6a02565e.341f8.64b91f9e@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch main has been updated by chuck: URL: https://cgit.FreeBSD.org/src/commit/?id=7419d6e463fee40f0f52cd5bc46a93cbb7ac6114 commit 7419d6e463fee40f0f52cd5bc46a93cbb7ac6114 Merge: 95b4436e989d eb3b1302382b Author: Chuck Tuffli <chuck@FreeBSD.org> AuthorDate: 2026-05-11 21:50:04 +0000 Commit: Chuck Tuffli <chuck@FreeBSD.org> CommitDate: 2026-05-11 21:50:04 +0000 Add 'contrib/smart/' from commit 'eb3b1302382b1d0cbe37eeebabfcdd546aa2fc4e' git-subtree-dir: contrib/smart git-subtree-mainline: 95b4436e989df29f6368f13832cb13d7cbc52eac git-subtree-split: eb3b1302382b1d0cbe37eeebabfcdd546aa2fc4e contrib/smart/Changelog | 37 ++ contrib/smart/LICENSE | 13 + contrib/smart/Makefile | 26 + contrib/smart/README.md | 62 ++ contrib/smart/freebsd_dev.c | 828 +++++++++++++++++++++++++ contrib/smart/libsmart.c | 1359 +++++++++++++++++++++++++++++++++++++++++ contrib/smart/libsmart.h | 174 ++++++ contrib/smart/libsmart_desc.c | 158 +++++ contrib/smart/libsmart_dev.h | 60 ++ contrib/smart/libsmart_priv.h | 83 +++ contrib/smart/smart.8 | 245 ++++++++ contrib/smart/smart.c | 334 ++++++++++ 12 files changed, 3379 insertions(+) diff --cc contrib/smart/Changelog index 000000000000,42b79bc34070..42b79bc34070 mode 000000,100644..100644 --- a/contrib/smart/Changelog +++ b/contrib/smart/Changelog diff --cc contrib/smart/LICENSE index 000000000000,8b0a0bf6a4a6..8b0a0bf6a4a6 mode 000000,100644..100644 --- a/contrib/smart/LICENSE +++ b/contrib/smart/LICENSE diff --cc contrib/smart/Makefile index 000000000000,000000000000..64cab720e08f new file mode 100644 --- /dev/null +++ b/contrib/smart/Makefile @@@ -1,0 -1,0 +1,26 @@@ ++# ++# Copyright (c) 2016-2021 Chuck Tuffli <chuck@tuffli.net> ++# ++# Permission to use, copy, modify, and distribute this software for any ++# purpose with or without fee is hereby granted, provided that the above ++# copyright notice and this permission notice appear in all copies. ++# ++# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES ++# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF ++# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ++# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ++# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ++# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF ++# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ++# ++PROG= smart ++SRCS= smart.c libsmart.c libsmart_desc.c ++SRCS+= freebsd_dev.c ++LIBADD= cam xo ++MAN=smart.8 ++MLINKS= smart.8 diskhealth.8 ++#CFLAGS+= -ggdb -O0 ++CFLAGS+= -DLIBXO ++LINKS= ${BINDIR}/smart ${BINDIR}/diskhealth ++ ++.include <bsd.prog.mk> diff --cc contrib/smart/README.md index 000000000000,000000000000..57fc685a9ef8 new file mode 100644 --- /dev/null +++ b/contrib/smart/README.md @@@ -1,0 -1,0 +1,62 @@@ ++# README # ++ ++### What is this repository for? ### ++ ++* Application to output the SMART values of disks ++ ++### How do I get set up? ### ++ ++Clone this repository onto a FreeBSD box and run make ++ ++ $ git clone https://github.com/ctuffli/smart ++ $ cd smart && make ++ ++or install it from ports ( http://www.freshports.org/sysutils/smart/ ) ++ ++### How to use ++ Usage: smart [-htxi] [-a attribute[,attribute]...] <device name> ++ -h, --help ++ -t, --threshold : also print out the threshold values ++ -x, --hex : print the values out in hexadecimal ++ -a, --attribute : print a specific attribute(s) ++ -i, --info : print general device information ++ -d, --decode: decode the attribute IDs ++ -D, --no-decode: don't decode the attribute IDs ++ -v, --version : print the version and copyright ++ ++### Example ++* List the raw attributes of SATA device /dev/ada0 ++ ++ smart ada0 ++ ++* List the decoded attributes of NVMe device /dev/nda0 ++ ++ smart -d nda0 ++ ++ or ++ ++ diskhealth nda0 ++ ++### What does the raw output mean? ++The format and location of SMART / health data varies across protocols. ++To simplify the output, the application uses a Dumb Unified Model of ++SMART Buffers. In this model, SMART data is located in one or more log ++pages. Each page contains one or more values ("attributes") ++differentiated by an ID. Note that ID's are only unique within a log ++page. Thus, the application outputs: ++ ++ <Log Page ID> <Attribute ID> <Attribute value> ++for each selected attribute. Threshold values, if defined by the protocol ++and selected by the user, are printed after the attribute value. ++ ++See the shell scripts `atasmart`, `nvmesmart`, and `scsismart` for examples of parsing the output. ++ ++### What is the decoded output? ++Decoded output converts numeric values (Log Page, Attribute ID and Value tuples) into human-readable descriptions. ++ ++The output for protocols like NVMe and SCSI which provide standardized descriptions will match the text in the specification. ATA, however, allows vendors to define their own attributes. For ATA, descriptions come from the "SMART Attribute Descriptions (SAD)" (ANSI - INCITS TR-54) specification which documents attributes common to multiple ATA drive vendors. ++ ++### Protocol Specific Notes ++* __ATA__ : The attribute and values follow the 'standard'. The log page is the Feature value used in ATA command. Thus, the default page is 208 / 0xd0 (a.k.a SMART Read Data). The threshold values printed are status flags, current value, and worst value. The SMART Return Status (Feature 218 / 0xda) indicates the reliability status of the device and is sometimes used as a top-level SMART health indication. While this command does not return data, the application encodes "no errors" as 0x0 and "threshold exceeded" as 0x1 in attribute 0. ++* __NVMe__ : The Log Page is the SMART / Health Information LID value in the Get Log Page command (i.e. 0x2). The attribute ID is the byte offset within this page. ++* __SCSI__ : The Log Page ID is the Page Code value in the Mode Sense command. The attribute ID is the parameter code defined by this page (e.g. 0 in the Write Error Counters log page is 'Errors corrected without substantial delay'). The values will depend on the Page Codes supported by a drive. diff --cc contrib/smart/freebsd_dev.c index 000000000000,d1dda2289742..d1dda2289742 mode 000000,100644..100644 --- a/contrib/smart/freebsd_dev.c +++ b/contrib/smart/freebsd_dev.c diff --cc contrib/smart/libsmart.c index 000000000000,a1732de09ed9..a1732de09ed9 mode 000000,100644..100644 --- a/contrib/smart/libsmart.c +++ b/contrib/smart/libsmart.c diff --cc contrib/smart/libsmart.h index 000000000000,60346f3b3a70..60346f3b3a70 mode 000000,100644..100644 --- a/contrib/smart/libsmart.h +++ b/contrib/smart/libsmart.h diff --cc contrib/smart/libsmart_desc.c index 000000000000,bcfb31d66922..bcfb31d66922 mode 000000,100644..100644 --- a/contrib/smart/libsmart_desc.c +++ b/contrib/smart/libsmart_desc.c diff --cc contrib/smart/libsmart_dev.h index 000000000000,bbf028e73712..bbf028e73712 mode 000000,100644..100644 --- a/contrib/smart/libsmart_dev.h +++ b/contrib/smart/libsmart_dev.h diff --cc contrib/smart/libsmart_priv.h index 000000000000,f29fc1e1e033..f29fc1e1e033 mode 000000,100644..100644 --- a/contrib/smart/libsmart_priv.h +++ b/contrib/smart/libsmart_priv.h diff --cc contrib/smart/smart.8 index 000000000000,3215ff890001..3215ff890001 mode 000000,100644..100644 --- a/contrib/smart/smart.8 +++ b/contrib/smart/smart.8 diff --cc contrib/smart/smart.c index 000000000000,8b543fea1819..8b543fea1819 mode 000000,100644..100644 --- a/contrib/smart/smart.c +++ b/contrib/smart/smart.chome | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a02565e.341f8.64b91f9e>
