function get_all_hast() { $a = array(); $a[''] = gettext("Must choose one"); mwexec2("hastctl dump | grep resource", $rawdata); foreach ($rawdata as $line) { $hast = preg_split("/\\s/", $line); $name = $hast[1]; $file = "/dev/hast/{$name}"; if (file_exists($file)) { $diskinfo = disks_get_diskinfo($file); $size = $diskinfo[mediasize_mbytes]; if ($size > 1024) { $size = (int) ($size / 1024); $size .= "GB"; } else { $size .= "MB"; } } else { $size = "(secondary)"; } $a[$file] = htmlspecialchars("{$name}: {$size}"); } return $a; }
<?php if (!isset($diskv['smart'])) { continue; } ?> <option value="<?php echo $diskv['devicespecialfile']; ?> " <?php if ($diskv['devicespecialfile'] === $pconfig['devicespecialfile']) { echo "selected=\"selected\""; } ?> > <?php $diskinfo = disks_get_diskinfo($diskv['devicespecialfile']); echo htmlspecialchars("{$diskv['name']}: {$diskinfo['mediasize_mbytes']}MB ({$diskv['desc']})"); ?> </option> <?php } ?> </select><br /> <span class="vexpl"><?php echo gettext("Select a disk that is enabled for S.M.A.R.T. monitoring."); ?> </span> </td> </tr> <tr> <td width="22%" valign="top" class="vncellreq"><?php
function get_all_hast($a_extent, $uuid) { $a = array(); $a[''] = gettext("Must choose one"); mwexec2("hastctl dump | grep resource", $rawdata); foreach ($rawdata as $line) { $hast = preg_split("/\\s/", $line); $name = $hast[1]; $file = "/dev/hast/{$name}"; if (file_exists($file)) { $diskinfo = disks_get_diskinfo($file); $size = $diskinfo[mediasize_mbytes]; if ($size > 1024) { $size = (int) ($size / 1024); $size .= "GB"; } else { $size .= "MB"; } } else { $size = "(secondary)"; } $index = array_search_ex($file, $a_extent, "path"); if (FALSE !== $index) { if (!isset($uuid)) { continue; } if ($a_extent[$index]['uuid'] != $uuid) { continue; } } $a[$file] = htmlspecialchars("{$name}: {$size}"); } return $a; }
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. The views and conclusions contained in the software and documentation are those of the authors and should not be interpreted as representing official policies, either expressed or implied, of the NAS4Free Project. */ $d_isfwfile = 1; require "auth.inc"; require "guiconfig.inc"; $pgtitle = array(gettext("System"), gettext("Firmware")); // check boot partition $part1size = $g_install['part1size_embedded']; $part1min = $g_install['part1min_embedded']; $cfdevice = trim(file_get_contents("{$g['etc_path']}/cfdevice")); $diskinfo = disks_get_diskinfo($cfdevice); unset($errormsg); $part1ok = true; if ($g['arch'] == "rpi" || $g['arch'] == "rpi2" || $g['arch'] == "oc1") { $part1min = 320; } /* rpi use 320MB */ if ($diskinfo['mediasize_mbytes'] < $part1min) { if (in_array($g['platform'], $fwupplatforms)) { $part1ok = false; $errormsg = sprintf(gettext("Boot partition is too small. You need reinstall from LiveCD or LiveUSB, or resize boot partition of %s.\n"), $cfdevice); } } /* checks with /etc/firm.url to see if a newer firmware version online is available; returns any HTML message it gets from the server */ $locale = $config['system']['language'];