當前位置: 首頁>>代碼示例>>PHP>>正文


PHP HWDevice::setCapacity方法代碼示例

本文整理匯總了PHP中HWDevice::setCapacity方法的典型用法代碼示例。如果您正苦於以下問題:PHP HWDevice::setCapacity方法的具體用法?PHP HWDevice::setCapacity怎麽用?PHP HWDevice::setCapacity使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在HWDevice的用法示例。


在下文中一共展示了HWDevice::setCapacity方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: ide

 /**
  * IDE information
  *
  * @return void
  */
 protected function ide()
 {
     foreach ($this->readdmesg() as $line) {
         if (preg_match('/^(.*) at (pciide|wdc|atabus|atapibus)[0-9] (.*): <(.*)>/', $line, $ar_buf)) {
             $dev = new HWDevice();
             $dev->setName($ar_buf[1]);
             // now loop again and find the capacity
             foreach ($this->readdmesg() as $line2) {
                 if (preg_match("/^(" . $ar_buf[1] . "): (.*), (.*), (.*)MB, .*\$/", $line2, $ar_buf_n)) {
                     $dev->setCapacity($ar_buf_n[4] * 2048 * 1.049);
                 } elseif (preg_match("/^(" . $ar_buf[1] . "): (.*) MB, (.*), (.*), .*\$/", $line2, $ar_buf_n)) {
                     $dev->setCapacity($ar_buf_n[2] * 2048);
                 }
             }
             $this->sys->setIdeDevices($dev);
         }
     }
 }
開發者ID:bbspike,項目名稱:sentora-core,代碼行數:23,代碼來源:class.NetBSD.inc.php

示例2: ide

 /**
  * IDE devices
  * get the ide device information out of dmesg
  *
  * @return void
  */
 protected function ide()
 {
     foreach ($this->readdmesg() as $line) {
         if (preg_match('/^(ad[0-9]+): (.*)MB <(.*)> (.*) (.*)/', $line, $ar_buf)) {
             $dev = new HWDevice();
             $dev->setName($ar_buf[1]);
             $dev->setCapacity($ar_buf[2] * 1024);
             $this->sys->setIdeDevices($dev);
         } elseif (preg_match('/^(acd[0-9]+): (.*) <(.*)> (.*)/', $line, $ar_buf)) {
             $dev = new HWDevice();
             $dev->setName($ar_buf[1]);
             $this->sys->setIdeDevices($dev);
         }
     }
 }
開發者ID:jhbsz,項目名稱:ossimTest,代碼行數:21,代碼來源:class.BSDCommon.inc.php

示例3: ide

 /**
  * IDE devices
  * get the ide device information out of dmesg
  *
  * @return void
  */
 protected function ide()
 {
     foreach ($this->readdmesg() as $line) {
         if (preg_match('/^(ad[0-9]+): (.*)MB <(.*)> (.*) (.*)/', $line, $ar_buf)) {
             $dev = new HWDevice();
             $dev->setName($ar_buf[1] . ": " . $ar_buf[3]);
             $dev->setCapacity($ar_buf[2] * 1024);
             $this->sys->setIdeDevices($dev);
         } elseif (preg_match('/^(acd[0-9]+): (.*) <(.*)> (.*)/', $line, $ar_buf)) {
             $dev = new HWDevice();
             $dev->setName($ar_buf[1] . ": " . $ar_buf[3]);
             $this->sys->setIdeDevices($dev);
         } elseif (preg_match('/^(ada[0-9]+): <(.*)> (.*)/', $line, $ar_buf)) {
             $dev = new HWDevice();
             $dev->setName($ar_buf[1] . ": " . $ar_buf[2]);
             $this->sys->setIdeDevices($dev);
         } elseif (preg_match('/^(ada[0-9]+): (.*)MB \\((.*)\\)/', $line, $ar_buf)) {
             /* duplication security */
             $notwas = true;
             foreach ($this->sys->getIdeDevices() as $finddev) {
                 if ($notwas && substr($finddev->getName(), 0, strpos($finddev->getName(), ': ')) == $ar_buf[1]) {
                     $finddev->setCapacity($ar_buf[2] * 1024);
                     $notwas = false;
                     break;
                 }
             }
             if ($notwas) {
                 $dev = new HWDevice();
                 $dev->setName($ar_buf[1]);
                 $dev->setCapacity($ar_buf[2] * 1024);
                 $this->sys->setIdeDevices($dev);
             }
         }
     }
     /* cleaning */
     foreach ($this->sys->getIdeDevices() as $finddev) {
         if (strpos($finddev->getName(), ': ') !== false) {
             $finddev->setName(substr(strstr($finddev->getName(), ': '), 2));
         }
     }
 }
開發者ID:rzs840707,項目名稱:webapps_repository,代碼行數:47,代碼來源:class.BSDCommon.inc.php

示例4: _ide

 /**
  * IDE devices
  *
  * @return void
  */
 private function _ide()
 {
     $bufd = CommonFunctions::gdc('/proc/ide', false);
     foreach ($bufd as $file) {
         if (preg_match('/^hd/', $file)) {
             $dev = new HWDevice();
             $dev->setName(trim($file));
             if (CommonFunctions::rfts("/proc/ide/" . $file . "/media", $buf, 1)) {
                 if (trim($buf) == 'disk') {
                     if (CommonFunctions::rfts("/proc/ide/" . $file . "/capacity", $buf, 1, 4096, false) || CommonFunctions::rfts("/sys/block/" . $file . "/size", $buf, 1, 4096, false)) {
                         $dev->setCapacity(trim($buf) * 512 / 1024);
                     }
                 }
             }
             if (CommonFunctions::rfts("/proc/ide/" . $file . "/model", $buf, 1)) {
                 $dev->setName($dev->getName() . ": " . trim($buf));
             }
             $this->sys->setIdeDevices($dev);
         }
     }
 }
開發者ID:sorrowchen,項目名稱:openfiler-cn,代碼行數:26,代碼來源:class.Linux.inc.php

示例5: ide

 /**
  * get the ide information
  *
  * @return array
  */
 protected function ide()
 {
     foreach ($this->readdmesg() as $line) {
         if (preg_match('/^(.*): (.*) <(.*)> at (ata[0-9]\\-(.*)) (.*)/', $line, $ar_buf)) {
             $dev = new HWDevice();
             $dev->setName($ar_buf[1]);
             if (!preg_match("/^acd[0-9](.*)/", $ar_buf[1])) {
                 $dev->setCapacity($ar_buf[2] * 1024);
             }
             $this->sys->setIdeDevices($dev);
         }
     }
 }
開發者ID:jhbsz,項目名稱:ossimTest,代碼行數:18,代碼來源:class.DragonFly.inc.php


注:本文中的HWDevice::setCapacity方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。