diff options
author | jim-p <jimp@pfsense.org> | 2014-11-04 15:49:00 -0500 |
---|---|---|
committer | jim-p <jimp@pfsense.org> | 2014-11-04 15:49:54 -0500 |
commit | ea20169a38b555288416cdcbd86d4cd83b380b8b (patch) | |
tree | 19a440b4e91d919cda0f69dced4a6bbc0134f811 /etc/inc/util.inc | |
parent | 0810a719e903cef1d48fc94821ee6aa8ac8073fd (diff) | |
download | pfsense-ea20169a38b555288416cdcbd86d4cd83b380b8b.zip pfsense-ea20169a38b555288416cdcbd86d4cd83b380b8b.tar.gz |
Use a better method of finding disks for SMART.
Old code was inaccurate and also listed entries that were symlinks to other disks
Diffstat (limited to 'etc/inc/util.inc')
-rw-r--r-- | etc/inc/util.inc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/etc/inc/util.inc b/etc/inc/util.inc index 683061c..dd6a818 100644 --- a/etc/inc/util.inc +++ b/etc/inc/util.inc @@ -2075,4 +2075,17 @@ function post_redirect($page, $params) { print "</body></html>\n"; } +/* Locate disks that can be queried for S.M.A.R.T. data. */ +function get_smart_drive_list() { + $disk_list = explode(" ", get_single_sysctl("kern.disks")); + foreach ($disk_list as $id => $disk) { + // We only want certain kinds of disks for S.M.A.R.T. + if (preg_match("/^(ad|da|ada).*[0-9]{1,2}$/", $disk) === FALSE) { + unset($disk_list[$id]); + } + } + sort($disk_list); + return $disk_list; +} + ?> |