|
|
|
@ -45,8 +45,8 @@ LOGGER = logging.getLogger("CryptoBox")
|
|
|
|
|
DEFAULT_SYSBLOCK_DIR = '/sys/block'
|
|
|
|
|
DEFAULT_DEVNODE_DIR = '/dev'
|
|
|
|
|
MINIMUM_STORAGE_SIZE = 10
|
|
|
|
|
MAJOR_DEVNUM_RAM = 1
|
|
|
|
|
MAJOR_DEVNUM_LOOP = 7
|
|
|
|
|
MAJOR_DEVNUM_FLOPPY = 2
|
|
|
|
|
MAJOR_DEVNUM_MD_RAID = 9
|
|
|
|
|
|
|
|
|
|
## cache settings
|
|
|
|
@ -157,7 +157,7 @@ class Blockdevice:
|
|
|
|
|
def is_valid(self):
|
|
|
|
|
"""check if the device is usable and valid
|
|
|
|
|
|
|
|
|
|
causes of invalidity: ram device, loop device, removable device
|
|
|
|
|
causes of invalidity: unused loop device, floppy device
|
|
|
|
|
|
|
|
|
|
@rtype: boolean
|
|
|
|
|
@return: 'True' for a valid blockdevice
|
|
|
|
@ -169,14 +169,12 @@ class Blockdevice:
|
|
|
|
|
major, minor = self.devnum
|
|
|
|
|
if (major == 0) and (minor == 0):
|
|
|
|
|
return False
|
|
|
|
|
## ram devices are ignored
|
|
|
|
|
if major == MAJOR_DEVNUM_RAM:
|
|
|
|
|
return False
|
|
|
|
|
## loop devices are ignored
|
|
|
|
|
## loop devices are ignored, if they are unused
|
|
|
|
|
if (major == MAJOR_DEVNUM_LOOP) and (self.size == 0):
|
|
|
|
|
return False
|
|
|
|
|
## removable devices are ignored (due to long timeouts)
|
|
|
|
|
if self.is_removable():
|
|
|
|
|
## floppy disks are totally ignored
|
|
|
|
|
## otherwise we would have a long timeout, while reading the devices
|
|
|
|
|
if (major == MAJOR_DEVNUM_FLOPPY):
|
|
|
|
|
return False
|
|
|
|
|
except TypeError:
|
|
|
|
|
return False
|
|
|
|
@ -203,10 +201,6 @@ class Blockdevice:
|
|
|
|
|
## extended partition, unused loop device
|
|
|
|
|
CACHE.set(cache_link, False)
|
|
|
|
|
return False
|
|
|
|
|
if self.devnum[0] == MAJOR_DEVNUM_RAM:
|
|
|
|
|
## ram device
|
|
|
|
|
CACHE.set(cache_link, False)
|
|
|
|
|
return False
|
|
|
|
|
## are we the device mapper of a luks device?
|
|
|
|
|
for slave in self.slaves:
|
|
|
|
|
if get_blockdevice(slave, self.sysblock_dir,
|
|
|
|
|