* Copyright (C) 2004-8 Geoffrey Keating <geoffk@geoffk.org>
* Copyright (C) 2014 Alex Samorukov <samm@os2.kiev.ua>
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * You should have received a copy of the GNU General Public License
- * along with smartmontools. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-License-Identifier: GPL-2.0-or-later
*/
#include <stdbool.h>
#include <CoreFoundation/CoreFoundation.h>
#include "config.h"
-#include "int64.h"
+
#include "atacmds.h"
#include "scsicmds.h"
#include "nvmecmds.h"
#define ARGUSED(x) ((void)(x))
// Needed by '-V' option (CVS versioning) of smartd/smartctl
-const char *os_darwin_cpp_cvsid="$Id: os_darwin.cpp 4552 2017-10-11 10:11:35Z samm2 $" \
-ATACMDS_H_CVSID CONFIG_H_CVSID INT64_H_CVSID OS_DARWIN_H_CVSID SCSICMDS_H_CVSID UTILITY_H_CVSID;
+const char *os_darwin_cpp_cvsid="$Id: os_darwin.cpp 4831 2018-11-09 07:18:23Z samm2 $" \
+ATACMDS_H_CVSID CONFIG_H_CVSID OS_DARWIN_H_CVSID SCSICMDS_H_CVSID UTILITY_H_CVSID;
// examples for smartctl
static const char smartctl_examples[] =
"=================================================== SMARTCTL EXAMPLES =====\n\n"
" smartctl -a disk0 (Prints all SMART information)\n\n"
" smartctl -t long /dev/disk0 (Executes extended disk self-test)\n\n"
-#ifdef HAVE_GETOPT_LONG
" smartctl --smart=on --saveauto=on /dev/rdisk0 (Enables SMART on first disk)\n\n"
" smartctl --attributes --log=selftest --quietmode=errorsonly /dev/disk0\n"
" (Prints Self-Test & Attribute errors)\n\n"
-#else
- " smartctl -s on -S on /dev/rdisk0 (Enables SMART on first disk)\n\n"
- " smartctl -A -l selftest -q errorsonly /dev/disk0\n"
- " (Prints Self-Test & Attribute errors)\n\n"
-#endif
" smartctl -a IOService:/MacRISC2PE/pci@f4000000/AppleMacRiscPCI/ata-6@D/AppleKauaiATA/ATADeviceNub@0/IOATABlockStorageDriver/IOATABlockStorageDevice\n"
" (You can use IOService: ...)\n\n"
" smartctl -c IODeviceTree:/pci@f4000000/ata-6@D/@0:0\n"
IONVMeSMARTInterface **smartIfNVMe;
} devices[20];
-const char * dev_darwin_cpp_cvsid = "$Id: os_darwin.cpp 4552 2017-10-11 10:11:35Z samm2 $"
+const char * dev_darwin_cpp_cvsid = "$Id: os_darwin.cpp 4831 2018-11-09 07:18:23Z samm2 $"
DEV_INTERFACE_H_CVSID;
/////////////////////////////////////////////////////////////////////////////
{
for (index = 0; index < result; index++)
if ((*devlist)[index])
- free ((*devlist)[index]);
- free (*devlist);
- }
+ free ((*devlist)[index]);
+ free (*devlist);
+ }
if(!result) // no devs found
return 0;
int rc = 0;
if (! ifp)
- return -1;
+ return false;
smartIf = *ifp;
clear_err(); errno = 0;
do {
err = -1; // thresholds exceeded condition
out.out_regs.lba_high = 0x2c; out.out_regs.lba_mid = 0xf4;
}
- else
+ else {
out.out_regs.lba_high = 0xc2; out.out_regs.lba_mid = 0x4f;
+ }
break;
}
else err = 0;
unsigned int page = in.cdw10 & 0xff;
if (! ifp)
- return -1;
+ return false;
smartIfNVMe = *ifp;
// currently only GetIdentifyData and SMARTReadData are supported
switch (in.opcode) {