]> git.proxmox.com Git - mirror_smartmontools-debian.git/blobdiff - os_qnxnto.cpp
import smartmontools 7.0
[mirror_smartmontools-debian.git] / os_qnxnto.cpp
index 7f4526df2dbe76b903c04f470160805451ce3d7e..677e559ca41c51bdebb3bee739745ec2ab78480b 100644 (file)
@@ -1,11 +1,18 @@
-
+/*
+ * os_qnxnto.cpp
+ *
+ * Home page of code is: http://www.smartmontools.org
+ *
+ * Copyright (C) 2007 Joerg Hering
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
 
 // This is needed for the various HAVE_* macros and PROJECT_* macros.
 #include "config.h"
 
 // These are needed to define prototypes and structures for the
 // functions defined below
-#include "int64.h"
 #include "atacmds.h"
 #include "scsicmds.h"
 #include "utility.h"
 // This is to include whatever structures and prototypes you define in
 // os_generic.h
 #include "os_qnxnto.h"
+#include <errno.h>
 
 // Needed by '-V' option (CVS versioning) of smartd/smartctl.  You
 // should have one *_H_CVSID macro appearing below for each file
 // appearing with #include "*.h" above.  Please list these (below) in
 // alphabetic/dictionary order.
-const char *os_XXXX_c_cvsid="$Id: os_qnxnto.cpp,v 1.3 2008/06/12 21:46:31 ballen4705 Exp $" \
-ATACMDS_H_CVSID CONFIG_H_CVSID INT64_H_CVSID OS_QNXNTO_H_CVSID SCSICMDS_H_CVSID UTILITY_H_CVSID;
+const char *os_XXXX_c_cvsid="$Id: os_qnxnto.cpp 4842 2018-12-02 16:07:26Z chrfranke $" \
+ATACMDS_H_CVSID CONFIG_H_CVSID OS_QNXNTO_H_CVSID SCSICMDS_H_CVSID UTILITY_H_CVSID;
 
 
 // This is here to prevent compiler warnings for unused arguments of
 // functions.
 #define ARGUSED(x) ((void)(x))
 
-// Please eliminate the following block: both the #include and
-// the 'unsupported()' function.  They are only here to warn
-// unsuspecting users that their Operating System is not supported! If
-// you wish, you can use a similar warning mechanism for any of the
-// functions in this file that you can not (or choose not to)
-// implement.
-
-
-#ifdef HAVE_UNAME
-#include <sys/utsname.h>
-#endif
 //----------------------------------------------------------------------------------------------
 // private Functions
 static int ata_sense_data(void *sdata,int *error,int *key,int *asc,int *ascq);
 static int ata_interpret_sense(struct cam_pass_thru *cpt,void *sense,int *status,int rcount);
 static int ata_pass_thru(int fd,struct cam_pass_thru *pcpt);
-//----------------------------------------------------------------------------------------------
-static void unsupported(){
-  static int warninggiven;
-
-  if (!warninggiven) {
-    char *osname;
-    extern unsigned char debugmode;
-    unsigned char savedebugmode=debugmode;
-
-#ifdef HAVE_UNAME
-    struct utsname ostype;
-    uname(&ostype);
-    osname=ostype.sysname;
-#else
-    osname="host's";
-#endif
-
-    debugmode=1;
-    pout("\n"
-         "############################################################################\n"
-         "WARNING: smartmontools has not been ported to the %s Operating System.\n"
-         "Please see the files os_generic.cpp and os_generic.h for porting instructions.\n"
-         "############################################################################\n\n",
-         osname);
-    debugmode=savedebugmode;
-    warninggiven=1;
-  }
-
-  return;
-}
-// End of the 'unsupported()' block that you should eliminate.
-
 
 // print examples for smartctl.  You should modify this function so
 // that the device paths are sensible for your OS, and to eliminate
 // unsupported commands (eg, 3ware controllers).
 void print_smartctl_examples(){
-  printf("=================================================== SMARTCTL EXAMPLES =====\n\n");
-#ifdef HAVE_GETOPT_LONG
-  printf(
+  printf("=================================================== SMARTCTL EXAMPLES =====\n\n"
          "  smartctl -a /dev/hd0                       (Prints all SMART information)\n\n"
          "  smartctl --smart=on --offlineauto=on --saveauto=on /dev/hd0\n"
          "                                              (Enables SMART on first disk)\n\n"
@@ -91,17 +54,6 @@ void print_smartctl_examples(){
          "  smartctl -a --device=3ware,2 /dev/sda\n"
          "          (Prints all SMART info for 3rd ATA disk on 3ware RAID controller)\n"
          );
-#else
-  printf(
-         "  smartctl -a /dev/hd0                       (Prints all SMART information)\n"
-         "  smartctl -s on -o on -S on /dev/hd0         (Enables SMART on first disk)\n"
-         "  smartctl -t long /dev/hd0              (Executes extended disk self-test)\n"
-         "  smartctl -A -l selftest -q errorsonly /dev/hd0\n"
-         "                                      (Prints Self-Test & Attribute errors)\n"
-         "  smartctl -a -d 3ware,2 /dev/sda\n"
-         "          (Prints all SMART info for 3rd ATA disk on 3ware RAID controller)\n"
-         );
-#endif
   return;
 }
 
@@ -137,7 +89,6 @@ int len,dev_prefix_len;
 int make_device_names (char*** devlist, const char* name) {
   ARGUSED(devlist);
   ARGUSED(name);
-  unsupported();
   return 0;
 }
 
@@ -162,7 +113,7 @@ int deviceclose(int fd)
   return(close(fd));
 }
 //----------------------------------------------------------------------------------------------
-// Interface to ATA devices.  See os_linux.cpp for the cannonical example.
+// Interface to ATA devices.  See os_linux.cpp for the canonical example.
 // DETAILED DESCRIPTION OF ARGUMENTS
 //   device: is the integer handle provided by deviceopen()
 //   command: defines the different operations, see atacmds.h
@@ -374,64 +325,12 @@ int                  status,rc;
   return(rc);
 }
 //----------------------------------------------------------------------------------------------
-int marvell_command_interface(int fd, smart_command_set command, int select, char *data)
-{
-  ARGUSED(fd);
-  ARGUSED(command);
-  ARGUSED(select);
-  ARGUSED(data);
-  unsupported();
-  return -1;
-}
-//----------------------------------------------------------------------------------------------
-int highpoint_command_interface(int fd, smart_command_set command, int select, char *data)
-{
-  ARGUSED(fd);
-  ARGUSED(command);
-  ARGUSED(select);
-  ARGUSED(data);
-  unsupported();
-  return -1;
-}
-//----------------------------------------------------------------------------------------------
-// Interface to ATA devices behind 3ware escalade/apache RAID
-// controller cards.  Same description as ata_command_interface()
-// above except that 0 <= disknum <= 15 specifies the ATA disk
-// attached to the controller, and controller_type specifies the
-// precise type of 3ware controller.  See os_linux.c
-int escalade_command_interface(int fd,int disknum,int controller_type,smart_command_set command,int select,char *data)
-{
-  ARGUSED(fd);
-  ARGUSED(disknum);
-  ARGUSED(controller_type);
-  ARGUSED(command);
-  ARGUSED(select);
-  ARGUSED(data);
-
-  unsupported();
-  return -1;
-}
-
-int areca_command_interface(int fd,int disknum,smart_command_set command,int select,char *data)
-{
-  ARGUSED(fd);
-  ARGUSED(disknum);
-  ARGUSED(command);
-  ARGUSED(select);
-  ARGUSED(data);
-
-  unsupported();
-  return -1;
-}
-//----------------------------------------------------------------------------------------------
-#include <errno.h>
 // Interface to SCSI devices.  See os_linux.c
 int do_scsi_cmnd_io(int fd,struct scsi_cmnd_io * iop,int report)
 {
   ARGUSED(fd);
   ARGUSED(iop);
   ARGUSED(report);
-  unsupported();
   return -ENOSYS;
 }
 //----------------------------------------------------------------------------------------------
@@ -624,7 +523,7 @@ struct cam_pass_thru        cpt;
   cpt.cam_timeout=cpt.cam_timeout?cpt.cam_timeout:CAM_TIME_DEFAULT;
   if(cpt.cam_sense_len)
    {
-    SETIOV(&iov[1],cpt.cam_sense_ptr,cpt.cam_sense_len);
+    SETIOV(&iov[1],(void *)cpt.cam_sense_ptr,cpt.cam_sense_len);
     cpt.cam_sense_ptr=sizeof(cpt);
     icnt++;
    }