X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=os_openbsd.cpp;h=1c947fee8933486d68bcb7ca07912f47ddee0501;hb=4beda62ad07a302ded72d60f701949dd9085a7ce;hp=7acf85aa81a27a498a46b28d8cc43a2ca0e1ec4a;hpb=4d561bdbb71727621a1890b24b1ec50e21da1fe9;p=mirror_smartmontools-debian.git diff --git a/os_openbsd.cpp b/os_openbsd.cpp index 7acf85a..1c947fe 100644 --- a/os_openbsd.cpp +++ b/os_openbsd.cpp @@ -1,11 +1,11 @@ /* * os_openbsd.c * - * Home page of code is: http://smartmontools.sourceforge.net + * Home page of code is: http://www.smartmontools.org * - * Copyright (C) 2004-10 David Snyder + * Copyright (C) 2004-10 David Snyder * - * Derived from os_netbsd.cpp by Sergey Svishchev , Copyright (C) 2003-8 + * 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. * */ @@ -27,14 +27,11 @@ #include -const char * os_openbsd_cpp_cvsid = "$Id: os_openbsd.cpp 3265 2011-02-21 16:21:14Z chrfranke $" +const char * os_openbsd_cpp_cvsid = "$Id: os_openbsd.cpp 4431 2017-08-08 19:38:15Z chrfranke $" OS_OPENBSD_H_CVSID; -/* global variable holding byte count of allocated memory */ -extern long long bytes; - enum warnings { - BAD_SMART, NO_3WARE, NO_ARECA, MAX_MSG + BAD_SMART, MAX_MSG }; /* Utility function for printing warnings */ @@ -132,12 +129,17 @@ get_dev_names(char ***names, const char *prefix) return -1; } sprintf(mp[n], "%s%s%c", net_dev_prefix, p, 'a' + getrawpartition()); - bytes += strlen(mp[n]) + 1; n++; } - mp = (char **)realloc(mp, n * (sizeof(char *))); - bytes += (n) * (sizeof(char *)); + char ** tmp = (char **)realloc(mp, n * (sizeof(char *))); + if (NULL == tmp) { + pout("Out of memory constructing scan device list\n"); + free(mp); + return -1; + } + else + mp = tmp; *names = mp; return n; } @@ -173,14 +175,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) { @@ -324,7 +318,8 @@ ata_command_interface(int fd, smart_command_set command, int select, char *data) unsigned const short normal = WDSMART_CYL, failed = 0x2cf4; - if ((retval = ioctl(fd, ATAIOCCOMMAND, &req))) { + retval = ioctl(fd, ATAIOCCOMMAND, &req); + if (retval < 0) { perror("Failed command"); return -1; } @@ -359,20 +354,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 -areca_command_interface(int fd, int disknum, smart_command_set command, int select, char *data) -{ - printwarning(NO_ARECA, NULL); - return -1; -} - int do_scsi_cmnd_io(int fd, struct scsi_cmnd_io * iop, int report) {