These patches were integrated into 5.30 release and are not needed anymore.

This commit is contained in:
Sergey Svishchev 2004-03-15 16:39:04 +00:00 committed by Thomas Klausner
parent 962de65b77
commit 72e27d8a6f
9 changed files with 0 additions and 620 deletions

View file

@ -1,339 +0,0 @@
/*
* os_netbsd.c
*
* Home page of code is: http://smartmontools.sourceforge.net
*
* Copyright (C) 2003 Sergey Svishchev <smartmontools-support@lists.sourceforge.net>
*
* 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
* (for example COPYING); if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* This code was originally developed as a Senior Thesis by Michael Cornwell
* at the Concurrent Systems Laboratory (now part of the Storage Systems
* Research Center), Jack Baskin School of Engineering, University of
* California, Santa Cruz. http://ssrc.soe.ucsc.edu/
*
*/
#include "config.h"
#include "atacmds.h"
#include "scsicmds.h"
#include "utility.h"
#include "os_netbsd.h"
const char *os_XXXX_c_cvsid = "$Id: os_netbsd.c,v 1.1.1.1 2003/12/25 23:03:54 shattered Exp $" \
ATACMDS_H_CVSID OS_NETBSD_H_CVSID SCSICMDS_H_CVSID UTILITY_H_CVSID;
/* global variable holding byte count of allocated memory */
extern long long bytes;
enum warnings {BAD_SMART, NO_3WARE, MAX_MSG};
/* Utility function for printing warnings */
void
printwarning(int msgNo, const char *extra)
{
static int printed[] = {0, 0};
static const char *message[] = {
"Error: SMART Status command failed.\nPlease get assistance from \n" PROJECTHOME "\nRegister values returned from SMART Status command are:\n",
PACKAGE_STRING " does not currentlly support twe(4) devices (3ware Escalade)\n",
};
if (msgNo >= 0 && msgNo <= MAX_MSG) {
if (!printed[msgNo]) {
printed[msgNo] = 1;
pout("%s", message[msgNo]);
if (extra)
pout("%s", extra);
}
}
return;
}
/* Guess device type(ata or scsi) based on device name */
static const char *net_dev_prefix = "/dev/";
static const char *net_dev_ata_disk = "wd";
static const char *net_dev_scsi_disk = "sd";
static const char *net_dev_scsi_tape = "enrst";
int
guess_device_type(const char *dev_name)
{
int len;
int dev_prefix_len = strlen(net_dev_prefix);
if (!dev_name || !(len = strlen(dev_name)))
return GUESS_DEVTYPE_DONT_KNOW;
if (!strncmp(net_dev_prefix, dev_name, dev_prefix_len)) {
if (len <= dev_prefix_len)
return GUESS_DEVTYPE_DONT_KNOW;
else
dev_name += dev_prefix_len;
}
if (!strncmp(net_dev_ata_disk, dev_name, strlen(net_dev_ata_disk)))
return GUESS_DEVTYPE_ATA;
if (!strncmp(net_dev_scsi_disk, dev_name, strlen(net_dev_scsi_disk)))
return GUESS_DEVTYPE_SCSI;
if (!strncmp(net_dev_scsi_tape, dev_name, strlen(net_dev_scsi_tape)))
return GUESS_DEVTYPE_SCSI;
return GUESS_DEVTYPE_DONT_KNOW;
}
int
get_dev_names(char ***names, const char *prefix)
{
int n = 0, rc;
int sysctl_mib[2];
size_t sysctl_len;
char *disknames, *p, **mp;
*names = NULL;
sysctl_mib[0] = CTL_HW;
sysctl_mib[1] = HW_DISKNAMES;
if (-1 == sysctl(sysctl_mib, 2, NULL, &sysctl_len, NULL, 0)) {
pout("Failed to get value of sysctl `hw.disknames'\n");
return -1;
}
if (!(disknames = malloc(sysctl_len))) {
pout("Out of memory constructing scan device list\n");
return -1;
}
if (-1 == sysctl(sysctl_mib, 2, disknames, &sysctl_len, NULL, 0)) {
pout("Failed to get value of sysctl `hw.disknames'\n");
return -1;
}
if (!(mp = (char **) calloc(strlen(disknames) / 2, sizeof(char *)))) {
pout("Out of memory constructing scan device list\n");
return -1;
}
for (p = strtok(disknames, " "); p; p = strtok(NULL, " ")) {
if (strncmp(p, prefix, strlen(prefix))) {
continue;
}
mp[n] = malloc(strlen(net_dev_prefix) + strlen(p) + 2);
if (!mp[n]) {
pout("Out of memory constructing scan device list\n");
return -1;
}
sprintf(mp[n], "%s%s%c", net_dev_prefix, p, 'a' + getrawpartition());
bytes += strlen(mp[n]) + 1;
n++;
}
mp = realloc(mp, n * (sizeof(char *)));
bytes += (n) * (sizeof(char *));
*names = mp;
return n;
}
int
make_device_names(char ***devlist, const char *name)
{
if (!strcmp(name, "SCSI"))
return get_dev_names(devlist, net_dev_scsi_disk);
else if (!strcmp(name, "ATA"))
return get_dev_names(devlist, net_dev_ata_disk);
else
return 0;
}
int
deviceopen(const char *pathname, char *type)
{
if (!strcmp(type, "SCSI")) {
int fd = open(pathname, O_RDWR | O_NONBLOCK);
if (fd < 0 && errno == EROFS)
fd = open(pathname, O_RDONLY | O_NONBLOCK);
return fd;
} else if (!strcmp(type, "ATA"))
return open(pathname, O_RDONLY | O_NONBLOCK);
else
return -1;
}
int
deviceclose(int fd)
{
return close(fd);
}
int
ata_command_interface(int fd, smart_command_set command, int select, char *data)
{
struct atareq req;
unsigned char inbuf[DEV_BSIZE];
int retval, copydata = 0;
memset(&req, 0, sizeof(req));
memset(&inbuf, 0, sizeof(inbuf));
switch (command) {
case READ_VALUES:
req.flags = ATACMD_READ;
req.features = WDSM_RD_DATA;
req.command = WDCC_SMART;
req.databuf = (caddr_t) inbuf;
req.datalen = sizeof(inbuf);
req.cylinder = htole16(WDSMART_CYL);
req.timeout = 1000;
copydata = 1;
break;
case READ_THRESHOLDS:
req.flags = ATACMD_READ;
req.features = WDSM_RD_THRESHOLDS;
req.command = WDCC_SMART;
req.databuf = (caddr_t) inbuf;
req.datalen = sizeof(inbuf);
req.cylinder = htole16(WDSMART_CYL);
req.timeout = 1000;
copydata = 1;
break;
case READ_LOG:
req.flags = ATACMD_READ;
req.features = SMART_READ_LOG_SECTOR; /* XXX missing from wdcreg.h */
req.command = WDCC_SMART;
req.databuf = (caddr_t) inbuf;
req.datalen = sizeof(inbuf);
req.cylinder = htole16(WDSMART_CYL);
req.sec_num = select;
req.sec_count = 1;
req.timeout = 1000;
copydata = 1;
break;
case IDENTIFY:
req.flags = ATACMD_READ;
req.command = WDCC_IDENTIFY;
req.databuf = (caddr_t) inbuf;
req.datalen = sizeof(inbuf);
req.timeout = 1000;
copydata = 1;
break;
case PIDENTIFY:
req.flags = ATACMD_READ;
req.command = ATAPI_IDENTIFY_DEVICE;
req.databuf = (caddr_t) inbuf;
req.datalen = sizeof(inbuf);
req.timeout = 1000;
copydata = 1;
break;
case ENABLE:
req.flags = ATACMD_READ;
req.features = WDSM_ENABLE_OPS;
req.command = WDCC_SMART;
req.cylinder = htole16(WDSMART_CYL);
req.timeout = 1000;
break;
case DISABLE:
req.flags = ATACMD_READ;
req.features = WDSM_DISABLE_OPS;
req.command = WDCC_SMART;
req.cylinder = htole16(WDSMART_CYL);
req.timeout = 1000;
break;
case AUTO_OFFLINE:
/* NOTE: According to ATAPI 4 and UP, this command is obsolete */
req.flags = ATACMD_READ;
req.features = SMART_AUTO_OFFLINE; /* XXX missing from wdcreg.h */
req.command = WDCC_SMART;
req.databuf = (caddr_t) inbuf;
req.datalen = sizeof(inbuf);
req.cylinder = htole16(WDSMART_CYL);
req.sec_num = select;
req.sec_count = 1;
req.timeout = 1000;
break;
case AUTOSAVE:
req.flags = ATACMD_READ;
req.features = SMART_AUTOSAVE; /* XXX missing from wdcreg.h */
req.command = WDCC_SMART;
req.cylinder = htole16(WDSMART_CYL);
req.sec_count = 0xf1;
//to enable autosave
req.timeout = 1000;
break;
case IMMEDIATE_OFFLINE:
/* NOTE: According to ATAPI 4 and UP, this command is obsolete */
req.flags = ATACMD_READ;
req.features = SMART_IMMEDIATE_OFFLINE; /* XXX missing from wdcreg.h */
req.command = WDCC_SMART;
req.databuf = (caddr_t) inbuf;
req.datalen = sizeof(inbuf);
req.cylinder = htole16(WDSMART_CYL);
req.sec_num = select;
req.sec_count = 1;
req.timeout = 1000;
break;
case STATUS_CHECK:
/* same command, no HDIO in NetBSD */
case STATUS:
req.flags = ATACMD_READ;
req.features = WDSM_STATUS;
req.command = WDCC_SMART;
req.cylinder = htole16(WDSMART_CYL);
req.timeout = 1000;
break;
default:
pout("Unrecognized command %d in ata_command_interface()\n", command);
errno = ENOSYS;
return -1;
}
if (command == STATUS_CHECK) {
unsigned const short normal = WDSMART_CYL, failed = 0x2cf4;
if ((retval = ioctl(fd, ATAIOCCOMMAND, &req))) {
perror("Failed command");
return -1;
}
/* Cyl low and Cyl high unchanged means "Good SMART status" */
if (le16toh(req.cylinder) == normal)
return 0;
/* These values mean "Bad SMART status" */
if (le16toh(req.cylinder) == failed)
return 1;
/* We haven 't gotten output that makes sense; print out some debugging
* info */
char buf[512];
snprintf(buf, sizeof(buf),
"CMD=0x%02x\nFR =0x%02x\nNS =0x%02x\nSC =0x%02x\nCL =0x%02x\nCH =0x%02x\nRETURN =0x%04x\n",
(int) req.command, (int) req.features, (int) req.sec_count, (int) req.sec_num,
(int) (le16toh(req.cylinder) & 0xff), (int) ((le16toh(req.cylinder) >> 8) & 0xff),
(int) req.error);
printwarning(BAD_SMART, buf);
return 0;
}
if ((retval = ioctl(fd, ATAIOCCOMMAND, &req))) {
perror("Failed command");
return -1;
}
if (copydata)
memcpy(data, inbuf, 512);
return 0;
}
int
escalade_command_interface(int fd, int disknum, smart_command_set command, int select, char *data)
{
printwarning(NO_3WARE, NULL);
return -1;
}
int
do_scsi_cmnd_io(int fd, struct scsi_cmnd_io * iop, int report)
{
return -ENOSYS;
}

View file

@ -1,37 +0,0 @@
/*
* os_netbsd.h
*
* Home page of code is: http://smartmontools.sourceforge.net
*
* Copyright (C) 2003 Sergey Svishchev <smartmontools-support@lists.sourceforge.net>
*
* 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
* (for example COPYING); if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* This code was originally developed as a Senior Thesis by Michael Cornwell
* at the Concurrent Systems Laboratory (now part of the Storage Systems
* Research Center), Jack Baskin School of Engineering, University of
* California, Santa Cruz. http://ssrc.soe.ucsc.edu/
*
*/
#ifndef OS_NETBSD_H_
#define OS_NETBSD_H_
#define OS_NETBSD_H_CVSID "$Id: os_netbsd.h,v 1.1.1.1 2003/12/25 23:03:54 shattered Exp $\n"
#include <sys/param.h>
#include <sys/sysctl.h>
#include <dev/ata/atareg.h>
#include <dev/ata/atavar.h>
#include <dev/ic/wdcreg.h>
#include <sys/ataio.h>
#include <util.h>
#endif /* OS_NETBSD_H_ */

View file

@ -1,31 +0,0 @@
$NetBSD: patch-aa,v 1.1.1.1 2003/12/25 23:03:52 shattered Exp $
--- atacmds.c.orig 2003-11-29 02:21:58.000000000 +0300
+++ atacmds.c 2003-12-14 18:54:03.000000000 +0300
@@ -951,7 +951,7 @@
return 0;
}
-int ataReadSmartThresholds (int device, struct ata_smart_thresholds *data){
+int ataReadSmartThresholds (int device, struct ata_smart_thresholds_pvt *data){
// get data from device
if (smartcommandhandler(device, READ_THRESHOLDS, 0, (char *)data)){
@@ -1232,7 +1232,7 @@
// onlyfailed=0 : are or were any age or prefailure attributes <= threshold
// onlyfailed=1: are any prefailure attributes <= threshold now
int ataCheckSmart(struct ata_smart_values *data,
- struct ata_smart_thresholds *thresholds,
+ struct ata_smart_thresholds_pvt *thresholds,
int onlyfailed){
int i;
@@ -1269,7 +1269,7 @@
// prefail attribute. Else we return minus the attribute number if it
// is a usage attribute.
int ataCheckAttribute(struct ata_smart_values *data,
- struct ata_smart_thresholds *thresholds,
+ struct ata_smart_thresholds_pvt *thresholds,
int n){
struct ata_smart_attribute *disk;
struct ata_smart_threshold_entry *thre;

View file

@ -1,45 +0,0 @@
$NetBSD: patch-ab,v 1.1.1.1 2003/12/25 23:03:52 shattered Exp $
--- atacmds.h.orig 2003-10-15 18:06:02.000000000 +0400
+++ atacmds.h 2003-12-14 18:53:19.000000000 +0300
@@ -204,7 +204,7 @@
/* Format of Read SMART THreshold Command */
/* Compare to ata_smart_values above */
#pragma pack(1)
-struct ata_smart_thresholds {
+struct ata_smart_thresholds_pvt {
unsigned short int revnumber;
struct ata_smart_threshold_entry thres_entries[NUMBER_ATA_SMART_ATTRIBUTES];
unsigned char reserved[149];
@@ -333,11 +333,11 @@
/* Read S.M.A.R.T information from drive */
int ataReadHDIdentity(int device, struct ata_identify_device *buf);
int ataReadSmartValues(int device,struct ata_smart_values *);
-int ataReadSmartThresholds(int device, struct ata_smart_thresholds *);
+int ataReadSmartThresholds(int device, struct ata_smart_thresholds_pvt *);
int ataReadErrorLog(int device, struct ata_smart_errorlog *);
int ataReadSelfTestLog(int device, struct ata_smart_selftestlog *);
int ataSmartStatus(int device);
-int ataSetSmartThresholds(int device, struct ata_smart_thresholds *);
+int ataSetSmartThresholds(int device, struct ata_smart_thresholds_pvt *);
int ataReadLogDirectory(int device, struct ata_smart_log_directory *);
/* Enable/Disable SMART on device */
@@ -377,7 +377,7 @@
/* Check SMART for Threshold failure */
// onlyfailed=0 : are or were any age or prefailure attributes <= threshold
// onlyfailed=1: are any prefailure attributes <= threshold now
-int ataCheckSmart ( struct ata_smart_values *data, struct ata_smart_thresholds *thresholds, int onlyfailed);
+int ataCheckSmart ( struct ata_smart_values *data, struct ata_smart_thresholds_pvt *thresholds, int onlyfailed);
int ataSmartStatus2(int device);
@@ -428,7 +428,7 @@
// prefail attribute. Else we return minus the attribute number if it
// is a usage attribute.
int ataCheckAttribute(struct ata_smart_values *data,
- struct ata_smart_thresholds *thresholds,
+ struct ata_smart_thresholds_pvt *thresholds,
int n);
// External handler function, for when a checksum is not correct. Can

View file

@ -1,31 +0,0 @@
$NetBSD: patch-ac,v 1.1.1.1 2003/12/25 23:03:53 shattered Exp $
--- ataprint.c.orig 2003-11-27 01:20:15.000000000 +0300
+++ ataprint.c 2003-12-14 19:39:48.000000000 +0300
@@ -541,7 +541,7 @@
// onlyfailed=1: just ones that are currently failed and have prefailure bit set
// onlyfailed=2: ones that are failed, or have failed with or without prefailure bit set
void PrintSmartAttribWithThres (struct ata_smart_values *data,
- struct ata_smart_thresholds *thresholds,
+ struct ata_smart_thresholds_pvt *thresholds,
int onlyfailed){
int i;
int needheader=1;
@@ -949,7 +949,7 @@
}
void ataPseudoCheckSmart ( struct ata_smart_values *data,
- struct ata_smart_thresholds *thresholds) {
+ struct ata_smart_thresholds_pvt *thresholds) {
int i;
int failed = 0;
for (i = 0 ; i < NUMBER_ATA_SMART_ATTRIBUTES ; i++) {
@@ -1013,7 +1013,7 @@
// Initialize to zero just in case some SMART routines don't work
struct ata_identify_device drive;
struct ata_smart_values smartval;
-struct ata_smart_thresholds smartthres;
+struct ata_smart_thresholds_pvt smartthres;
struct ata_smart_errorlog smarterror;
struct ata_smart_selftestlog smartselftest;

View file

@ -1,29 +0,0 @@
$NetBSD: patch-ad,v 1.1.1.1 2003/12/25 23:03:53 shattered Exp $
--- ataprint.h.orig 2003-10-12 13:10:03.000000000 +0400
+++ ataprint.h 2003-12-14 18:54:49.000000000 +0300
@@ -42,7 +42,7 @@
void ataPrintGeneralSmartValues(struct ata_smart_values *, struct ata_identify_device *);
-void ataPrintSmartThresholds(struct ata_smart_thresholds *);
+void ataPrintSmartThresholds(struct ata_smart_thresholds_pvt *);
// returns number of errors in Errorlog
int ataPrintSmartErrorlog(struct ata_smart_errorlog *);
@@ -52,13 +52,13 @@
void PrintSmartAttributes(struct ata_smart_values *);
void PrintSmartAttribWithThres(struct ata_smart_values *,
- struct ata_smart_thresholds *,
+ struct ata_smart_thresholds_pvt *,
int onlyfailed);
// returns number of entries that had logged errors
int ataPrintSmartSelfTestlog(struct ata_smart_selftestlog *, int allentries);
-void ataPseudoCheckSmart(struct ata_smart_values *, struct ata_smart_thresholds *);
+void ataPseudoCheckSmart(struct ata_smart_values *, struct ata_smart_thresholds_pvt *);
// Convenience function for formatting strings from ata_identify_device.
void formatdriveidstring(char *out, const char *in, int n);

View file

@ -1,16 +0,0 @@
$NetBSD: patch-ae,v 1.1.1.1 2003/12/25 23:03:53 shattered Exp $
--- configure.orig 2003-11-29 02:41:39.000000000 +0300
+++ configure 2003-12-13 17:15:12.000000000 +0300
@@ -4027,6 +4027,11 @@
os_libs=''
;;
+ *-*-netbsd*)
+ os_deps='os_netbsd.o'
+
+ os_libs='-lutil'
+ ;;
*)
os_deps='os_generic.o'

View file

@ -1,14 +0,0 @@
$NetBSD: patch-af,v 1.1.1.1 2003/12/25 23:03:53 shattered Exp $
--- configure.in.orig 2003-11-27 15:43:03.000000000 +0300
+++ configure.in 2003-12-13 17:14:30.000000000 +0300
@@ -83,6 +83,9 @@
*-*-solaris*)
AC_SUBST([os_deps], ['os_solaris.o'])
AC_SUBST([os_libs], ['']) ;;
+ *-*-netbsd*)
+ AC_SUBST([os_deps], ['os_netbsd.o'])
+ AC_SUBST([os_libs], ['-lutil']) ;;
*)
AC_SUBST([os_deps], ['os_generic.o'])
AC_SUBST([os_libs], ['']) ;;

View file

@ -1,78 +0,0 @@
$NetBSD: patch-ag,v 1.1.1.1 2003/12/25 23:03:53 shattered Exp $
--- smartd.c.orig 2003-11-20 06:08:16.000000000 +0300
+++ smartd.c 2003-12-14 18:55:17.000000000 +0300
@@ -177,7 +177,7 @@
cfg->name = FreeNonZero(cfg->name, -1,__LINE__,__FILE__);
cfg->address = FreeNonZero(cfg->address, -1,__LINE__,__FILE__);
cfg->emailcmdline = FreeNonZero(cfg->emailcmdline, -1,__LINE__,__FILE__);
- cfg->smartthres = FreeNonZero(cfg->smartthres, sizeof(struct ata_smart_thresholds),__LINE__,__FILE__);
+ cfg->smartthres = FreeNonZero(cfg->smartthres, sizeof(struct ata_smart_thresholds_pvt),__LINE__,__FILE__);
cfg->smartval = FreeNonZero(cfg->smartval, sizeof(struct ata_smart_values),__LINE__,__FILE__);
cfg->monitorattflags = FreeNonZero(cfg->monitorattflags, NMONITOR*32,__LINE__,__FILE__);
cfg->attributedefs = FreeNonZero(cfg->attributedefs, MAX_ATTRIBUTE_NUM,__LINE__,__FILE__);
@@ -863,13 +863,13 @@
// do we need to get SMART data?
if (retainsmartdata || cfg->autoofflinetest || cfg->selftest || cfg->errorlog) {
cfg->smartval=(struct ata_smart_values *)calloc(1,sizeof(struct ata_smart_values));
- cfg->smartthres=(struct ata_smart_thresholds *)calloc(1,sizeof(struct ata_smart_thresholds));
+ cfg->smartthres=(struct ata_smart_thresholds_pvt *)calloc(1,sizeof(struct ata_smart_thresholds_pvt));
if (cfg->smartval)
bytes+=sizeof(struct ata_smart_values);
if (cfg->smartthres)
- bytes+=sizeof(struct ata_smart_thresholds);
+ bytes+=sizeof(struct ata_smart_thresholds_pvt);
if (!cfg->smartval || !cfg->smartthres){
PrintOut(LOG_CRIT,"Not enough memory to obtain SMART data\n");
@@ -951,7 +951,7 @@
}
if (cfg->smartthres) {
cfg->smartthres=CheckFree(cfg->smartthres, __LINE__,__FILE__);
- bytes-=sizeof(struct ata_smart_thresholds);
+ bytes-=sizeof(struct ata_smart_thresholds_pvt);
}
}
@@ -1075,7 +1075,7 @@
cfg->monitorattflags = FreeNonZero(cfg->monitorattflags, NMONITOR*32,__LINE__,__FILE__);
cfg->attributedefs = FreeNonZero(cfg->attributedefs, MAX_ATTRIBUTE_NUM,__LINE__,__FILE__);
cfg->smartval = FreeNonZero(cfg->smartval, sizeof(struct ata_smart_values),__LINE__,__FILE__);
- cfg->smartthres = FreeNonZero(cfg->smartthres, sizeof(struct ata_smart_thresholds),__LINE__,__FILE__);
+ cfg->smartthres = FreeNonZero(cfg->smartthres, sizeof(struct ata_smart_thresholds_pvt),__LINE__,__FILE__);
// Check if scsiCheckIE() is going to work
{
@@ -1138,7 +1138,7 @@
int ATACompareValues(changedattribute_t *delta,
struct ata_smart_values *new,
struct ata_smart_values *old,
- struct ata_smart_thresholds *thresholds,
+ struct ata_smart_thresholds_pvt *thresholds,
int n, char *name){
struct ata_smart_attribute *now,*was;
struct ata_smart_threshold_entry *thre;
@@ -1315,7 +1315,7 @@
// Check everything that depends upon SMART Data (eg, Attribute values)
if (cfg->usagefailed || cfg->prefail || cfg->usage){
struct ata_smart_values curval;
- struct ata_smart_thresholds *thresh=cfg->smartthres;
+ struct ata_smart_thresholds_pvt *thresh=cfg->smartthres;
// Read current attribute values. *drive contains old values and thresholds
if (ataReadSmartValues(fd,&curval)){
@@ -1994,10 +1994,10 @@
}
if (add->smartthres) {
- if (!(add->smartthres=(struct ata_smart_thresholds *)calloc(1,sizeof(struct ata_smart_thresholds))))
+ if (!(add->smartthres=(struct ata_smart_thresholds_pvt *)calloc(1,sizeof(struct ata_smart_thresholds_pvt))))
goto badexit;
else
- bytes+=sizeof(struct ata_smart_thresholds);
+ bytes+=sizeof(struct ata_smart_thresholds_pvt);
}
return add;