oto __device_info_tunneled_ata_out; - } - - fsmart->common.info.supported = ident_data.support.command1 & - ATA_SUPPORT_SMART; - - dprintf("ATA command1 = %#x\n", ident_data.support.command1); - -__device_info_tunneled_ata_out: - if (ccb) { - cam_freeccb(ccb); - } - - return rc; -} - -/** - * Retrieve the device information and use to populate the info structure - */ -static int32_t -__device_get_info(struct fbsd_smart *fsmart) -{ - union ccb *ccb; - int32_t rc = -1; - - if (!fsmart || !fsmart->camdev) { - warn("Bad handle %p", fsmart); - return -1; - } - - ccb = cam_getccb(fsmart->camdev); - if (ccb != NULL) { - struct ccb_getdev *cgd = &ccb->cgd; - - CCB_CLEAR_ALL_EXCEPT_HDR(cgd); - - /* - * GDEV_TYPE doesn't support NVMe. What we do get is: - * - device (ata/model, scsi/product) - * - revision (ata, scsi) - * - serial (ata) - * - vendor (scsi) - * - supported (ata) - * - * Serial # for all proto via ccb_dev_advinfo (buftype CDAI_TYPE_SERIAL_NUM) - */ - ccb->ccb_h.func_code = XPT_GDEV_TYPE; - - if (cam_send_ccb(fsmart->camdev, ccb) >= 0) { - if ((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) { - switch (cgd->protocol) { - case PROTO_ATA: - rc = __device_info_ata(fsmart, cgd); - break; - case PROTO_SCSI: - rc = __device_info_scsi(fsmart, cgd); - if (!rc && fsmart->common.protocol == SMART_PROTO_ATA) { - rc = __device_info_tunneled_ata(fsmart); - } - break; - case PROTO_NVME: - rc = __device_info_nvme(fsmart, cgd); - break; - default: - printf("%s: unsupported protocol %d\n", - __func__, cgd->protocol); - } - } - } - - cam_freeccb(ccb); - } - - return rc; -} diff --git a/contrib/smart/libsmart.c b/contrib/smart/libsmart.c deleted file mode 100644 index a1732de09ed9..000000000000 --- a/contrib/smart/libsmart.c +++ /dev/null @@ -1,1359 +0,0 @@ -/* - * Copyright (c) 2016-2026 Chuck Tuffli - * - * 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. - */ -#include -#include -#include -#include -#include -#include *** 2512 LINES SKIPPED ***