OpenMediaVault  3.0 (Erasmus)
The open network attached storage solution
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
OMV\System\BlockDevice Class Reference
Inheritance diagram for OMV\System\BlockDevice:
OMV\System\IBlockDevice OMV\System\Filesystem\Filesystem OMV\System\Storage\StorageDevice OMV\System\Filesystem\Btrfs OMV\System\Filesystem\Ext OMV\System\Filesystem\Jfs OMV\System\Filesystem\Xfs OMV\System\Storage\SmartStorageDeviceAbstract OMV\System\Storage\StorageDeviceBcache OMV\System\Storage\StorageDeviceCDROM OMV\System\Storage\StorageDeviceDM OMV\System\Storage\StorageDeviceI2O OMV\System\Storage\StorageDeviceLoop OMV\System\Storage\StorageDeviceMdadm OMV\System\Storage\StorageDeviceMMC OMV\System\Storage\StorageDeviceNVM OMV\System\Storage\StorageDeviceRDB

Public Member Functions

 __construct ($deviceFile)
 
 exists ()
 
 assertExists ()
 
 getDeviceFile ()
 
 getCanonicalDeviceFile ()
 
 getDeviceFileById ()
 
 hasDeviceFileById ()
 
 getPreferredDeviceFile ()
 
 getDeviceFileSymlinks ()
 
 getDeviceName ($canonical=FALSE)
 
 getSize ()
 
 getBlockSize ()
 
 getSectorSize ()
 
 getDeviceNumber ()
 
 getMajor ()
 
 getMinor ()
 
 getDescription ()
 
 hasUdevProperty ($id)
 
 assertUdevProperty ($id)
 
 getUdevProperty ($id)
 
 waitForDevice ($timeout)
 

Protected Member Functions

 getUdevData ($force=FALSE)
 

Protected Attributes

 $deviceFile = NULL
 
 $deviceFileById = NULL
 
 $size = FALSE
 
 $blockSize = FALSE
 
 $sectorSize = FALSE
 
 $udevData = NULL
 

Detailed Description

This class implements an interface to a generic Linux block device.

Constructor & Destructor Documentation

OMV\System\BlockDevice::__construct (   $deviceFile)

Constructor

Parameters
deviceFileThe device file, e.g.
/dev/sda2
  • /dev/sdb
  • /dev/md1
  • /dev/disk/by-id/scsi-SATA_ST3200XXXX2AS_5XWXXXR6
  • /dev/disk/by-id/wwn-0x5000cca211cc703c-part1

Member Function Documentation

OMV\System\BlockDevice::assertExists ( )

Assert that the device exists.

Returns
None.
Exceptions
OMV\System\BlockDevice::assertUdevProperty (   $id)

Assert that a udev property exists.

Parameters
idThe name of the property, e.g. ID_VENDOR, ID_MODEL or ID_SERIAL_SHORT.
Returns
None.
Exceptions
OMV\System\BlockDevice::exists ( )

See interface definition.

Implements OMV\System\IBlockDevice.

OMV\System\BlockDevice::getBlockSize ( )

Get the blocksize of the device in bytes.

Returns
The blocksize of the device in bytes.
Exceptions

Implements OMV\System\IBlockDevice.

OMV\System\BlockDevice::getCanonicalDeviceFile ( )

See interface definition.

Implements OMV\System\IBlockDevice.

OMV\System\BlockDevice::getDescription ( )

See interface definition.

Implements OMV\System\IBlockDevice.

OMV\System\BlockDevice::getDeviceFile ( )

See interface definition.

Implements OMV\System\IBlockDevice.

OMV\System\BlockDevice::getDeviceFileById ( )

See interface definition.

Implements OMV\System\IBlockDevice.

OMV\System\BlockDevice::getDeviceFileSymlinks ( )

See interface definition.

Implements OMV\System\IBlockDevice.

OMV\System\BlockDevice::getDeviceName (   $canonical = FALSE)

See interface definition.

Implements OMV\System\IBlockDevice.

OMV\System\BlockDevice::getDeviceNumber ( )

See interface definition.

Implements OMV\System\IBlockDevice.

OMV\System\BlockDevice::getMajor ( )

See interface definition.

Implements OMV\System\IBlockDevice.

OMV\System\BlockDevice::getMinor ( )

See interface definition.

Implements OMV\System\IBlockDevice.

OMV\System\BlockDevice::getPreferredDeviceFile ( )

Get the special device file to present in the UI. Defaults to the canonical representation of special device file.

Returns
Returns the special device file to present in the UI.

Implements OMV\System\IBlockDevice.

OMV\System\BlockDevice::getSectorSize ( )

Get the sectorsize of the device in bytes.

Returns
The sectorsize of the device in bytes.
Exceptions

Implements OMV\System\IBlockDevice.

OMV\System\BlockDevice::getSize ( )

Get the size of the device in bytes.

Returns
The size (64bit) of the device in bytes as string.
Exceptions

Implements OMV\System\IBlockDevice.

OMV\System\BlockDevice::getUdevData (   $force = FALSE)
protected

Queries the udev database for device information stored in the udev database.

Parameters
forceForce the collection of the information, even when the information is already cached. Defaults to FALSE.
OMV\System\BlockDevice::getUdevProperty (   $id)

Queries the udev database for device information stored in the udev database.

Parameters
idThe name of the property, e.g. ID_VENDOR, ID_MODEL or ID_SERIAL_SHORT.
Returns
The requested property, otherwise FALSE.
OMV\System\BlockDevice::hasDeviceFileById ( )

Check whether the device has a /dev/disk/by-id/xxx device path.

Returns
Returns TRUE if a disk/by-id device path exists, otherwise FALSE.

Implements OMV\System\IBlockDevice.

OMV\System\BlockDevice::hasUdevProperty (   $id)

Checks if a udev property exists.

Parameters
idThe name of the property, e.g. ID_VENDOR, ID_MODEL or ID_SERIAL_SHORT.
Returns
Returns TRUE if the property exists, otherwise FALSE.
OMV\System\BlockDevice::waitForDevice (   $timeout)

Wait for the specified device. If the device file is not available within the given time, then an exception is thrown.

Parameters
timeoutTimeout in seconds to wait for an available device.
Returns
None.
Exceptions

Implements OMV\System\IBlockDevice.


The documentation for this class was generated from the following file: