X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=os_openbsd.cpp;h=896b88d11be42afde167dbe1c3f795ad113e415e;hb=1855d6340ce44908628a0f1e3d8b82ae169c600e;hp=c74b9aab6eab7a6c9a0ea732f489f2dc42eea4ba;hpb=097c50efa94fc656deb062c1fea7935fc5211e26;p=mirror_smartmontools-debian.git diff --git a/os_openbsd.cpp b/os_openbsd.cpp index c74b9aa..896b88d 100644 --- a/os_openbsd.cpp +++ b/os_openbsd.cpp @@ -3,9 +3,9 @@ * * Home page of code is: http://smartmontools.sourceforge.net * - * Copyright (C) 2004-6 David Snyder + * Copyright (C) 2004-10 David Snyder * - * Derived from os_netbsd.cpp by Sergey Svishchev , Copyright (C) 2003-6 + * Derived from os_netbsd.cpp by Sergey Svishchev , Copyright (C) 2003-8 * * 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 @@ -13,8 +13,8 @@ * 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. + * (for example COPYING); if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * */ @@ -25,14 +25,16 @@ #include "utility.h" #include "os_openbsd.h" -const char *os_XXXX_c_cvsid = "$Id: os_openbsd.cpp,v 1.13 2006/09/20 16:17:31 shattered Exp $" \ -ATACMDS_H_CVSID CONFIG_H_CVSID INT64_H_CVSID OS_OPENBSD_H_CVSID SCSICMDS_H_CVSID UTILITY_H_CVSID; +#include + +const char * os_openbsd_cpp_cvsid = "$Id: os_openbsd.cpp 3727 2012-12-13 17:23:06Z samm2 $" + OS_OPENBSD_H_CVSID; /* global variable holding byte count of allocated memory */ extern long long bytes; enum warnings { - BAD_SMART, NO_3WARE, MAX_MSG + BAD_SMART, NO_3WARE, NO_ARECA, MAX_MSG }; /* Utility function for printing warnings */ @@ -105,7 +107,7 @@ get_dev_names(char ***names, const char *prefix) pout("Failed to get value of sysctl `hw.disknames'\n"); return -1; } - if (!(disknames = (char*)malloc(sysctl_len))) { + if (!(disknames = (char *)malloc(sysctl_len))) { pout("Out of memory constructing scan device list\n"); return -1; } @@ -121,7 +123,10 @@ get_dev_names(char ***names, const char *prefix) if (strncmp(p, prefix, strlen(prefix))) { continue; } - mp[n] = (char*)malloc(strlen(net_dev_prefix) + strlen(p) + 2); + char * u = strchr(p, ':'); + if (u) + *u = 0; + mp[n] = (char *)malloc(strlen(net_dev_prefix) + strlen(p) + 2); if (!mp[n]) { pout("Out of memory constructing scan device list\n"); return -1; @@ -131,7 +136,7 @@ get_dev_names(char ***names, const char *prefix) n++; } - mp = (char**)realloc(mp, n * (sizeof(char *))); + mp = (char **)realloc(mp, n * (sizeof(char *))); bytes += (n) * (sizeof(char *)); *names = mp; return n; @@ -168,15 +173,6 @@ deviceclose(int fd) return close(fd); } -int -marvell_command_interface(int fd, smart_command_set command, int select, char *data) -{ return -1; } - -int highpoint_command_interface(int fd, smart_command_set command, int select, char *data) -{ - return -1; -} - int ata_command_interface(int fd, smart_command_set command, int select, char *data) { @@ -355,13 +351,6 @@ ata_command_interface(int fd, smart_command_set command, int select, char *data) return 0; } -int -escalade_command_interface(int fd, int disknum, int escalade_type, 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) { @@ -390,12 +379,12 @@ do_scsi_cmnd_io(int fd, struct scsi_cmnd_io * iop, int report) memset(&sc, 0, sizeof(sc)); memcpy(sc.cmd, iop->cmnd, iop->cmnd_len); sc.cmdlen = iop->cmnd_len; - sc.databuf = (char*)iop->dxferp; + sc.databuf = (char *)iop->dxferp; sc.datalen = iop->dxfer_len; sc.senselen = iop->max_sense_len; sc.timeout = iop->timeout == 0 ? 60000 : iop->timeout; /* XXX */ sc.flags = - (iop->dxfer_dir == DXFER_NONE ? SCCMD_READ : /* XXX */ + (iop->dxfer_dir == DXFER_NONE ? SCCMD_READ : (iop->dxfer_dir == DXFER_FROM_DEVICE ? SCCMD_READ : SCCMD_WRITE)); if (ioctl(fd, SCIOCCOMMAND, &sc) < 0) {