pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/sysutils/smartmontools Make this work on big endian Ne...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/cfded05b8044
branches:  trunk
changeset: 498988:cfded05b8044
user:      martin <martin%pkgsrc.org@localhost>
date:      Wed Sep 07 07:32:10 2005 +0000

description:
Make this work on big endian NetBSD machines.
(Patches already forwarded to the maintainers)

diffstat:

 sysutils/smartmontools/Makefile         |    4 +-
 sysutils/smartmontools/distinfo         |    6 +-
 sysutils/smartmontools/patches/patch-ab |  137 ++++++++++++++++++++++++++++++-
 sysutils/smartmontools/patches/patch-ac |   22 +++++
 sysutils/smartmontools/patches/patch-ad |   16 +++
 5 files changed, 176 insertions(+), 9 deletions(-)

diffs (223 lines):

diff -r 48d4a73e7735 -r cfded05b8044 sysutils/smartmontools/Makefile
--- a/sysutils/smartmontools/Makefile   Wed Sep 07 02:15:12 2005 +0000
+++ b/sysutils/smartmontools/Makefile   Wed Sep 07 07:32:10 2005 +0000
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.7 2005/05/22 20:08:33 jlam Exp $
+# $NetBSD: Makefile,v 1.8 2005/09/07 07:32:10 martin Exp $
 
 DISTNAME=              smartmontools-5.32
-PKGREVISION=           2
+PKGREVISION=           3
 CATEGORIES=            sysutils
 MASTER_SITES=          ${MASTER_SITE_SOURCEFORGE:=smartmontools/}
 
diff -r 48d4a73e7735 -r cfded05b8044 sysutils/smartmontools/distinfo
--- a/sysutils/smartmontools/distinfo   Wed Sep 07 02:15:12 2005 +0000
+++ b/sysutils/smartmontools/distinfo   Wed Sep 07 07:32:10 2005 +0000
@@ -1,7 +1,9 @@
-$NetBSD: distinfo,v 1.7 2005/07/19 04:01:41 kristerw Exp $
+$NetBSD: distinfo,v 1.8 2005/09/07 07:32:10 martin Exp $
 
 SHA1 (smartmontools-5.32.tar.gz) = 2af09136578ea59565ad00b3638afe9700ed26a2
 RMD160 (smartmontools-5.32.tar.gz) = 6692df8996bc3f6a1b52b10286d92b116874e1cd
 Size (smartmontools-5.32.tar.gz) = 408224 bytes
 SHA1 (patch-aa) = 2f22d9bd911ce825c1ca888cceb4535bba606671
-SHA1 (patch-ab) = addb2f63f71244df8a14920b4299645027ea35be
+SHA1 (patch-ab) = d7429855c3aa67624d4aaea74e40817d98365232
+SHA1 (patch-ac) = 477db70947e5cab73264ff8603bbfce8496d2616
+SHA1 (patch-ad) = 95a89254e570bc48f2422d80b4015885ca4135bc
diff -r 48d4a73e7735 -r cfded05b8044 sysutils/smartmontools/patches/patch-ab
--- a/sysutils/smartmontools/patches/patch-ab   Wed Sep 07 02:15:12 2005 +0000
+++ b/sysutils/smartmontools/patches/patch-ab   Wed Sep 07 07:32:10 2005 +0000
@@ -1,13 +1,140 @@
-$NetBSD: patch-ab,v 1.4 2005/07/19 04:01:41 kristerw Exp $
+$NetBSD: patch-ab,v 1.5 2005/09/07 07:32:10 martin Exp $
 
---- os_netbsd.c.orig   Tue Apr 20 06:53:26 2004
-+++ os_netbsd.c        Tue Jul 19 05:49:51 2005
-@@ -23,2 +23,3 @@
+--- os_netbsd.c.orig   2004-04-20 06:53:26.000000000 +0200
++++ os_netbsd.c        2005-09-06 23:02:45.000000000 +0200
+@@ -21,4 +21,5 @@
+ #include "scsicmds.h"
+ #include "utility.h"
  #include "os_netbsd.h"
 +#include <unistd.h>
  
-@@ -383,3 +384,3 @@
+@@ -180,9 +181,9 @@ ata_command_interface(int fd, smart_comm
+     req.flags = ATACMD_READ;
+     req.features = WDSM_RD_DATA;
+     req.command = WDCC_SMART;
+-    req.databuf = (caddr_t) inbuf;
++    req.databuf = inbuf;
+     req.datalen = sizeof(inbuf);
+-    req.cylinder = htole16(WDSMART_CYL);
++    req.cylinder = WDSMART_CYL;
+     req.timeout = 1000;
+     copydata = 1;
+     break;
+@@ -190,9 +191,9 @@ ata_command_interface(int fd, smart_comm
+     req.flags = ATACMD_READ;
+     req.features = WDSM_RD_THRESHOLDS;
+     req.command = WDCC_SMART;
+-    req.databuf = (caddr_t) inbuf;
++    req.databuf = inbuf;
+     req.datalen = sizeof(inbuf);
+-    req.cylinder = htole16(WDSMART_CYL);
++    req.cylinder = WDSMART_CYL;
+     req.timeout = 1000;
+     copydata = 1;
+     break;
+@@ -200,9 +201,9 @@ ata_command_interface(int fd, smart_comm
+     req.flags = ATACMD_READ;
+     req.features = ATA_SMART_READ_LOG_SECTOR; /* XXX missing from wdcreg.h */
+     req.command = WDCC_SMART;
+-    req.databuf = (caddr_t) inbuf;
++    req.databuf = inbuf;
+     req.datalen = sizeof(inbuf);
+-    req.cylinder = htole16(WDSMART_CYL);
++    req.cylinder = WDSMART_CYL;
+     req.sec_num = select;
+     req.sec_count = 1;
+     req.timeout = 1000;
+@@ -213,9 +214,9 @@ ata_command_interface(int fd, smart_comm
+     req.flags = ATACMD_WRITE;
+     req.features = ATA_SMART_WRITE_LOG_SECTOR;        /* XXX missing from wdcreg.h */
+     req.command = WDCC_SMART;
+-    req.databuf = (caddr_t) inbuf;
++    req.databuf = inbuf;
+     req.datalen = sizeof(inbuf);
+-    req.cylinder = htole16(WDSMART_CYL);
++    req.cylinder = WDSMART_CYL;
+     req.sec_num = select;
+     req.sec_count = 1;
+     req.timeout = 1000;
+@@ -240,14 +241,14 @@ ata_command_interface(int fd, smart_comm
+     req.flags = ATACMD_READ;
+     req.features = WDSM_ENABLE_OPS;
+     req.command = WDCC_SMART;
+-    req.cylinder = htole16(WDSMART_CYL);
++    req.cylinder = 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.cylinder = WDSMART_CYL;
+     req.timeout = 1000;
+     break;
+   case AUTO_OFFLINE:
+@@ -255,9 +256,9 @@ ata_command_interface(int fd, smart_comm
+     req.flags = ATACMD_READ;
+     req.features = ATA_SMART_AUTO_OFFLINE;    /* XXX missing from wdcreg.h */
+     req.command = WDCC_SMART;
+-    req.databuf = (caddr_t) inbuf;
++    req.databuf = inbuf;
+     req.datalen = sizeof(inbuf);
+-    req.cylinder = htole16(WDSMART_CYL);
++    req.cylinder = WDSMART_CYL;
+     req.sec_num = select;
+     req.sec_count = 1;
+     req.timeout = 1000;
+@@ -266,7 +267,7 @@ ata_command_interface(int fd, smart_comm
+     req.flags = ATACMD_READ;
+     req.features = ATA_SMART_AUTOSAVE;        /* XXX missing from wdcreg.h */
+     req.command = WDCC_SMART;
+-    req.cylinder = htole16(WDSMART_CYL);
++    req.cylinder = WDSMART_CYL;
+     req.sec_count = 0xf1;
+     /* to enable autosave */
+     req.timeout = 1000;
+@@ -276,9 +277,9 @@ ata_command_interface(int fd, smart_comm
+     req.flags = ATACMD_READ;
+     req.features = ATA_SMART_IMMEDIATE_OFFLINE;       /* XXX missing from wdcreg.h */
+     req.command = WDCC_SMART;
+-    req.databuf = (caddr_t) inbuf;
++    req.databuf = inbuf;
+     req.datalen = sizeof(inbuf);
+-    req.cylinder = htole16(WDSMART_CYL);
++    req.cylinder = WDSMART_CYL;
+     req.sec_num = select;
+     req.sec_count = 1;
+     req.timeout = 1000;
+@@ -289,7 +290,7 @@ ata_command_interface(int fd, smart_comm
+     req.flags = ATACMD_READ;
+     req.features = WDSM_STATUS;
+     req.command = WDCC_SMART;
+-    req.cylinder = htole16(WDSMART_CYL);
++    req.cylinder = WDSMART_CYL;
+     req.timeout = 1000;
+     break;
+   case CHECK_POWER_MODE:
+@@ -313,11 +314,11 @@ ata_command_interface(int fd, smart_comm
+       return -1;
+     }
+     /* Cyl low and Cyl high unchanged means "Good SMART status" */
+-    if (le16toh(req.cylinder) == normal)
++    if (req.cylinder == normal)
+       return 0;
+ 
+     /* These values mean "Bad SMART status" */
+-    if (le16toh(req.cylinder) == failed)
++    if (req.cylinder == failed)
+       return 1;
+ 
+     /* We haven't gotten output that makes sense; 
+@@ -381,7 +382,7 @@ do_scsi_cmnd_io(int fd, struct scsi_cmnd
+   sc.databuf = iop->dxferp;
+   sc.datalen = iop->dxfer_len;
    sc.senselen = iop->max_sense_len;
 -  sc.timeout = iop->timeout == 0 ? 60000 : iop->timeout;      /* XXX */
 +  sc.timeout = iop->timeout == 0 ? 60000 : (iop->timeout * 1000);     /* XXX */
    sc.flags =
+     (iop->dxfer_dir == DXFER_NONE ? SCCMD_READ :      /* XXX */
+     (iop->dxfer_dir == DXFER_FROM_DEVICE ? SCCMD_READ : SCCMD_WRITE));
diff -r 48d4a73e7735 -r cfded05b8044 sysutils/smartmontools/patches/patch-ac
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/smartmontools/patches/patch-ac   Wed Sep 07 07:32:10 2005 +0000
@@ -0,0 +1,22 @@
+$NetBSD: patch-ac,v 1.1 2005/09/07 07:32:10 martin Exp $
+
+--- atacmds.c.orig     2004-06-03 05:47:06.000000000 +0200
++++ atacmds.c  2005-08-10 22:18:14.000000000 +0200
+@@ -673,7 +673,9 @@ int ataReadHDIdentity (int device, struc
+     }
+   }
+ 
++#ifndef __NetBSD__
+   // if machine is big-endian, swap byte order as needed
++  // (the NetBSD kernel does deliver the results in host byte order)
+   if (isbigendian()){
+     int i;
+     
+@@ -682,6 +684,7 @@ int ataReadHDIdentity (int device, struc
+     for (i=80; i<=87; i++)
+       swap2((char *)(rawshort+i));
+   }
++#endif
+   
+   // If there is a checksum there, validate it
+   if ((rawshort[255] & 0x00ff) == 0x00a5 && checksum(rawbyte))
diff -r 48d4a73e7735 -r cfded05b8044 sysutils/smartmontools/patches/patch-ad
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/smartmontools/patches/patch-ad   Wed Sep 07 07:32:10 2005 +0000
@@ -0,0 +1,16 @@
+$NetBSD: patch-ad,v 1.1 2005/09/07 07:32:10 martin Exp $
+
+--- ataprint.c.orig    2004-06-04 22:59:16.000000000 +0200
++++ ataprint.c 2005-08-15 22:18:08.000000000 +0200
+@@ -90,7 +90,11 @@ void formatdriveidstring(char *out, cons
+   char tmp[65];
+ 
+   n = n > 64 ? 64 : n;
++#ifndef __NetBSD__
+   swapbytes(tmp, in, n);
++#else
++  strncpy(tmp, in, n);        /* NetBSD delivers host byte order strings */  
++#endif
+   tmp[n] = '\0';
+   trim(out, tmp);
+ }



Home | Main Index | Thread Index | Old Index