From 3ad8074073785a4359c7f5c56ff4154af7348ccc Mon Sep 17 00:00:00 2001 From: pav Date: Sun, 21 Oct 2007 16:18:51 +0000 Subject: - Allow smartctl to interact with SCSI /dev/pass devices, thus enabling it to work with RAID controllers that expose disks via these devices. Submitted by: scottl --- sysutils/smartmontools-devel/Makefile | 2 +- sysutils/smartmontools-devel/files/ciss-patch | 75 ++-------------------- .../files/patch-os__freebsd.cpp | 29 +++++++-- sysutils/smartmontools/Makefile | 2 +- sysutils/smartmontools/files/ciss-patch | 75 ++-------------------- sysutils/smartmontools/files/patch-os__freebsd.cpp | 29 +++++++-- 6 files changed, 60 insertions(+), 152 deletions(-) (limited to 'sysutils') diff --git a/sysutils/smartmontools-devel/Makefile b/sysutils/smartmontools-devel/Makefile index ff734bcf9df..d5a5ee4525a 100644 --- a/sysutils/smartmontools-devel/Makefile +++ b/sysutils/smartmontools-devel/Makefile @@ -7,7 +7,7 @@ PORTNAME= smartmontools PORTVERSION= 5.37 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= sysutils MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} MASTER_SITE_SUBDIR= ${PORTNAME} diff --git a/sysutils/smartmontools-devel/files/ciss-patch b/sysutils/smartmontools-devel/files/ciss-patch index 1c0e627d39f..e83a7583eed 100644 --- a/sysutils/smartmontools-devel/files/ciss-patch +++ b/sysutils/smartmontools-devel/files/ciss-patch @@ -57,84 +57,21 @@ + // Interface to ATA devices behind 3ware escalade RAID controller cards. See os_linux.c -@@ -871,16 +902,17 @@ - // specific) SCSI device name in FreeBSD can be sd, sr, scd, st, nst, - // osst, nosst and sg. --static const char * fbsd_dev_prefix = "/dev/"; --static const char * fbsd_dev_ata_disk_prefix = "ad"; --static const char * fbsd_dev_scsi_disk_plus = "da"; --static const char * fbsd_dev_scsi_tape1 = "sa"; --static const char * fbsd_dev_scsi_tape2 = "nsa"; --static const char * fbsd_dev_scsi_tape3 = "esa"; --static const char * fbsd_dev_twe_ctrl = "twe"; --static const char * fbsd_dev_twa_ctrl = "twa"; -+static const char fbsd_dev_prefix[] = "/dev/"; -+static const char fbsd_dev_ata_disk_prefix[] = "ad"; -+static const char fbsd_dev_scsi_disk_plus[] = "da"; -+static const char fbsd_dev_scsi_tape1[] = "sa"; -+static const char fbsd_dev_scsi_tape2[] = "nsa"; -+static const char fbsd_dev_scsi_tape3[] = "esa"; -+static const char fbsd_dev_twe_ctrl[] = "twe"; -+static const char fbsd_dev_twa_ctrl[] = "twa"; -+static const char fbsd_dev_ciss_ctrl[] = "ciss"; +@@ -871,6 +902,7 @@ + static const char * fbsd_dev_scsi_tape3 = "esa"; + static const char * fbsd_dev_twe_ctrl = "twe"; + static const char * fbsd_dev_twa_ctrl = "twa"; ++static const char * fbsd_dev_ciss_ctrl = "ciss"; static int parse_ata_chan_dev(const char * dev_name, struct freebsd_dev_channel *chan) { int len; -- int dev_prefix_len = strlen(fbsd_dev_prefix); -+ int dev_prefix_len = sizeof fbsd_dev_prefix - 1; - - // if dev_name null, or string length zero -@@ -898,5 +930,5 @@ - // form /dev/ad* or ad* - if (!strncmp(fbsd_dev_ata_disk_prefix, dev_name, -- strlen(fbsd_dev_ata_disk_prefix))) { -+ sizeof fbsd_dev_ata_disk_prefix - 1)) { - #ifndef IOCATAREQUEST - if (chan != NULL) { -@@ -911,24 +943,24 @@ - // form /dev/da* or da* - if (!strncmp(fbsd_dev_scsi_disk_plus, dev_name, -- strlen(fbsd_dev_scsi_disk_plus))) -+ sizeof fbsd_dev_scsi_disk_plus - 1)) - goto handlescsi; - - // form /dev/sa* or sa* - if (!strncmp(fbsd_dev_scsi_tape1, dev_name, -- strlen(fbsd_dev_scsi_tape1))) -+ sizeof fbsd_dev_scsi_tape1 - 1)) - goto handlescsi; - - // form /dev/nsa* or nsa* - if (!strncmp(fbsd_dev_scsi_tape2, dev_name, -- strlen(fbsd_dev_scsi_tape2))) -+ sizeof fbsd_dev_scsi_tape2 - 1)) - goto handlescsi; - - // form /dev/esa* or esa* - if (!strncmp(fbsd_dev_scsi_tape3, dev_name, -- strlen(fbsd_dev_scsi_tape3))) -+ sizeof fbsd_dev_scsi_tape3 - 1)) - goto handlescsi; - - if (!strncmp(fbsd_dev_twa_ctrl,dev_name, -- strlen(fbsd_dev_twa_ctrl))) { -+ sizeof fbsd_dev_twa_ctrl - 1)) { - if (chan != NULL) { - if (get_tw_channel_unit(dev_name,&(chan->channel),&(chan->device))<0) { -@@ -943,5 +975,5 @@ - - if (!strncmp(fbsd_dev_twe_ctrl,dev_name, -- strlen(fbsd_dev_twe_ctrl))) { -+ sizeof fbsd_dev_twe_ctrl - 1)) { - if (chan != NULL) { - if (get_tw_channel_unit(dev_name,&(chan->channel),&(chan->device))<0) { @@ -953,4 +985,13 @@ } return CONTROLLER_3WARE_678K_CHAR; + } + // form /dev/esa* or esa* + if (!strncmp(fbsd_dev_ciss_ctrl, dev_name, -+ sizeof fbsd_dev_ciss_ctrl - 1)) { ++ strlen(fbsd_dev_ciss_ctrl))) { + // This is of dubious value, as the desired disk's (unit's) number + // still must be specified explicitly with the `-d' option + warnx("Use the `-d' option to access drives behind %s. " diff --git a/sysutils/smartmontools-devel/files/patch-os__freebsd.cpp b/sysutils/smartmontools-devel/files/patch-os__freebsd.cpp index 7a20564c8cb..8521192345c 100644 --- a/sysutils/smartmontools-devel/files/patch-os__freebsd.cpp +++ b/sysutils/smartmontools-devel/files/patch-os__freebsd.cpp @@ -1,9 +1,26 @@ - -$FreeBSD$ - ---- os_freebsd.cpp.orig -+++ os_freebsd.cpp -@@ -1008,7 +1008,7 @@ +--- os_freebsd.cpp.orig 2006-09-17 05:17:53.000000000 +0200 ++++ os_freebsd.cpp 2007-10-21 18:09:02.000000000 +0200 +@@ -873,6 +873,7 @@ + static const char * fbsd_dev_prefix = "/dev/"; + static const char * fbsd_dev_ata_disk_prefix = "ad"; + static const char * fbsd_dev_scsi_disk_plus = "da"; ++static const char * fbsd_dev_scsi_pass = "pass"; + static const char * fbsd_dev_scsi_tape1 = "sa"; + static const char * fbsd_dev_scsi_tape2 = "nsa"; + static const char * fbsd_dev_scsi_tape3 = "esa"; +@@ -908,6 +909,11 @@ + return CONTROLLER_ATA; + } + ++ // form /dev/pass* or pass* ++ if (!strncmp(fbsd_dev_scsi_pass, dev_name, ++ strlen(fbsd_dev_scsi_pass))) ++ goto handlescsi; ++ + // form /dev/da* or da* + if (!strncmp(fbsd_dev_scsi_disk_plus, dev_name, + strlen(fbsd_dev_scsi_disk_plus))) +@@ -1008,7 +1014,7 @@ // to first list. Turn on NOCHECK for second call. This results in no // error if no more matches found, however it does append the actual // pattern to the list of paths.... diff --git a/sysutils/smartmontools/Makefile b/sysutils/smartmontools/Makefile index ff734bcf9df..d5a5ee4525a 100644 --- a/sysutils/smartmontools/Makefile +++ b/sysutils/smartmontools/Makefile @@ -7,7 +7,7 @@ PORTNAME= smartmontools PORTVERSION= 5.37 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= sysutils MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} MASTER_SITE_SUBDIR= ${PORTNAME} diff --git a/sysutils/smartmontools/files/ciss-patch b/sysutils/smartmontools/files/ciss-patch index 1c0e627d39f..e83a7583eed 100644 --- a/sysutils/smartmontools/files/ciss-patch +++ b/sysutils/smartmontools/files/ciss-patch @@ -57,84 +57,21 @@ + // Interface to ATA devices behind 3ware escalade RAID controller cards. See os_linux.c -@@ -871,16 +902,17 @@ - // specific) SCSI device name in FreeBSD can be sd, sr, scd, st, nst, - // osst, nosst and sg. --static const char * fbsd_dev_prefix = "/dev/"; --static const char * fbsd_dev_ata_disk_prefix = "ad"; --static const char * fbsd_dev_scsi_disk_plus = "da"; --static const char * fbsd_dev_scsi_tape1 = "sa"; --static const char * fbsd_dev_scsi_tape2 = "nsa"; --static const char * fbsd_dev_scsi_tape3 = "esa"; --static const char * fbsd_dev_twe_ctrl = "twe"; --static const char * fbsd_dev_twa_ctrl = "twa"; -+static const char fbsd_dev_prefix[] = "/dev/"; -+static const char fbsd_dev_ata_disk_prefix[] = "ad"; -+static const char fbsd_dev_scsi_disk_plus[] = "da"; -+static const char fbsd_dev_scsi_tape1[] = "sa"; -+static const char fbsd_dev_scsi_tape2[] = "nsa"; -+static const char fbsd_dev_scsi_tape3[] = "esa"; -+static const char fbsd_dev_twe_ctrl[] = "twe"; -+static const char fbsd_dev_twa_ctrl[] = "twa"; -+static const char fbsd_dev_ciss_ctrl[] = "ciss"; +@@ -871,6 +902,7 @@ + static const char * fbsd_dev_scsi_tape3 = "esa"; + static const char * fbsd_dev_twe_ctrl = "twe"; + static const char * fbsd_dev_twa_ctrl = "twa"; ++static const char * fbsd_dev_ciss_ctrl = "ciss"; static int parse_ata_chan_dev(const char * dev_name, struct freebsd_dev_channel *chan) { int len; -- int dev_prefix_len = strlen(fbsd_dev_prefix); -+ int dev_prefix_len = sizeof fbsd_dev_prefix - 1; - - // if dev_name null, or string length zero -@@ -898,5 +930,5 @@ - // form /dev/ad* or ad* - if (!strncmp(fbsd_dev_ata_disk_prefix, dev_name, -- strlen(fbsd_dev_ata_disk_prefix))) { -+ sizeof fbsd_dev_ata_disk_prefix - 1)) { - #ifndef IOCATAREQUEST - if (chan != NULL) { -@@ -911,24 +943,24 @@ - // form /dev/da* or da* - if (!strncmp(fbsd_dev_scsi_disk_plus, dev_name, -- strlen(fbsd_dev_scsi_disk_plus))) -+ sizeof fbsd_dev_scsi_disk_plus - 1)) - goto handlescsi; - - // form /dev/sa* or sa* - if (!strncmp(fbsd_dev_scsi_tape1, dev_name, -- strlen(fbsd_dev_scsi_tape1))) -+ sizeof fbsd_dev_scsi_tape1 - 1)) - goto handlescsi; - - // form /dev/nsa* or nsa* - if (!strncmp(fbsd_dev_scsi_tape2, dev_name, -- strlen(fbsd_dev_scsi_tape2))) -+ sizeof fbsd_dev_scsi_tape2 - 1)) - goto handlescsi; - - // form /dev/esa* or esa* - if (!strncmp(fbsd_dev_scsi_tape3, dev_name, -- strlen(fbsd_dev_scsi_tape3))) -+ sizeof fbsd_dev_scsi_tape3 - 1)) - goto handlescsi; - - if (!strncmp(fbsd_dev_twa_ctrl,dev_name, -- strlen(fbsd_dev_twa_ctrl))) { -+ sizeof fbsd_dev_twa_ctrl - 1)) { - if (chan != NULL) { - if (get_tw_channel_unit(dev_name,&(chan->channel),&(chan->device))<0) { -@@ -943,5 +975,5 @@ - - if (!strncmp(fbsd_dev_twe_ctrl,dev_name, -- strlen(fbsd_dev_twe_ctrl))) { -+ sizeof fbsd_dev_twe_ctrl - 1)) { - if (chan != NULL) { - if (get_tw_channel_unit(dev_name,&(chan->channel),&(chan->device))<0) { @@ -953,4 +985,13 @@ } return CONTROLLER_3WARE_678K_CHAR; + } + // form /dev/esa* or esa* + if (!strncmp(fbsd_dev_ciss_ctrl, dev_name, -+ sizeof fbsd_dev_ciss_ctrl - 1)) { ++ strlen(fbsd_dev_ciss_ctrl))) { + // This is of dubious value, as the desired disk's (unit's) number + // still must be specified explicitly with the `-d' option + warnx("Use the `-d' option to access drives behind %s. " diff --git a/sysutils/smartmontools/files/patch-os__freebsd.cpp b/sysutils/smartmontools/files/patch-os__freebsd.cpp index 7a20564c8cb..8521192345c 100644 --- a/sysutils/smartmontools/files/patch-os__freebsd.cpp +++ b/sysutils/smartmontools/files/patch-os__freebsd.cpp @@ -1,9 +1,26 @@ - -$FreeBSD$ - ---- os_freebsd.cpp.orig -+++ os_freebsd.cpp -@@ -1008,7 +1008,7 @@ +--- os_freebsd.cpp.orig 2006-09-17 05:17:53.000000000 +0200 ++++ os_freebsd.cpp 2007-10-21 18:09:02.000000000 +0200 +@@ -873,6 +873,7 @@ + static const char * fbsd_dev_prefix = "/dev/"; + static const char * fbsd_dev_ata_disk_prefix = "ad"; + static const char * fbsd_dev_scsi_disk_plus = "da"; ++static const char * fbsd_dev_scsi_pass = "pass"; + static const char * fbsd_dev_scsi_tape1 = "sa"; + static const char * fbsd_dev_scsi_tape2 = "nsa"; + static const char * fbsd_dev_scsi_tape3 = "esa"; +@@ -908,6 +909,11 @@ + return CONTROLLER_ATA; + } + ++ // form /dev/pass* or pass* ++ if (!strncmp(fbsd_dev_scsi_pass, dev_name, ++ strlen(fbsd_dev_scsi_pass))) ++ goto handlescsi; ++ + // form /dev/da* or da* + if (!strncmp(fbsd_dev_scsi_disk_plus, dev_name, + strlen(fbsd_dev_scsi_disk_plus))) +@@ -1008,7 +1014,7 @@ // to first list. Turn on NOCHECK for second call. This results in no // error if no more matches found, however it does append the actual // pattern to the list of paths.... -- cgit