From b5c4eabc26812fd89608e7c02671c8c3fc7ab998 Mon Sep 17 00:00:00 2001 From: lars Date: Sat, 13 Jun 2009 02:23:35 +0000 Subject: [PATCH] * excluded ram block devices from the "valid" list of devices (Closes: #196) --- src/cryptobox/core/blockdevice.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/cryptobox/core/blockdevice.py b/src/cryptobox/core/blockdevice.py index ea0b2ad..0ebe35f 100644 --- a/src/cryptobox/core/blockdevice.py +++ b/src/cryptobox/core/blockdevice.py @@ -46,8 +46,10 @@ LOGGER = logging.getLogger("CryptoNAS") DEFAULT_SYSBLOCK_DIR = '/sys/block' DEFAULT_DEVNODE_DIR = '/dev' MINIMUM_STORAGE_SIZE = 10 +# defined device numbers: http://www.lanana.org/docs/device-list/devices.txt MAJOR_DEVNUM_LOOP = 7 MAJOR_DEVNUM_FLOPPY = 2 +MAJOR_DEVNUM_RAMDISK = 1 MAJOR_DEVNUM_MD_RAID = 9 ## cache settings @@ -233,6 +235,9 @@ class Blockdevice: ## otherwise we would have a long timeout, while reading the devices if (self.major == MAJOR_DEVNUM_FLOPPY): return False + # we don't want to store data in ramdisks (e.g. /dev/ram0) + if (self.major == MAJOR_DEVNUM_RAMDISK): + return False except TypeError: return False return True