[PATCH 2.6.27-rc2] block: loop device partition support

From: Christian Franke
Date: Fri Aug 08 2008 - 20:55:11 EST


From: Christian Franke <cfchris6@xxxxxxxx>

By default, partition support of loop devices is disabled and there seems to be no way to turn it on without changing code, if loop is not compiled as module.
This patch introduces CONFIG_BLK_DEV_LOOP_MAXPART to make partition support configurable via Kconfig. It keeps that feature disabled by default for not breaking backward compatibility.

Signed-off-by: Christian Franke <cfchris6@xxxxxxxx>
---
--- linux-2.6/drivers/block/Kconfig
+++ linux-2.6-loop/drivers/block/Kconfig
@@ -248,6 +248,23 @@ config BLK_DEV_LOOP

Most users will answer N here.

+config BLK_DEV_LOOP_MAXPART
+ int "Maximum number of partitions per loop device"
+ default "0"
+ depends on BLK_DEV_LOOP
+ ---help---
+ Loop device partition support is disabled by default. If max_part
+ is non-zero, partition support for loop devices is enabled for up to
+ max_part partitions.
+
+ Note: If you compile loop as module, you can also pass max_part as
+ parameter when loading it.
+
+ Warning: non-zero values break compatibility with applications which
+ access the loop devices via major and minor number.
+
+ Most users will answer 0 here.
+
config BLK_DEV_CRYPTOLOOP
tristate "Cryptoloop Support"
select CRYPTO
--- linux-2.6/drivers/block/loop.c
+++ linux-2.6-loop/drivers/block/loop.c
@@ -82,7 +82,7 @@
static LIST_HEAD(loop_devices);
static DEFINE_MUTEX(loop_devices_mutex);

-static int max_part;
+static int max_part = CONFIG_BLK_DEV_LOOP_MAXPART;
static int part_shift;

/*

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/