kernel-ark/drivers
Laurent Vivier d7853d1f89 brd: modify ramdisk device to be able to manage partitions
This patch adds partition management for Block RAM Device (BRD).

This patch is done to keep in sync BRD and loop device drivers.

This patch adds a parameter to the module, max_part, to specify
the maximum number of partitions per RAM device.

Example:

# modprobe brd max_part=63
# ls -l /dev/ram*
brw-rw---- 1 root disk 1,   0 2008-04-03 13:39 /dev/ram0
brw-rw---- 1 root disk 1,  64 2008-04-03 13:39 /dev/ram1
brw-rw---- 1 root disk 1, 640 2008-04-03 13:39 /dev/ram10
brw-rw---- 1 root disk 1, 704 2008-04-03 13:39 /dev/ram11
brw-rw---- 1 root disk 1, 768 2008-04-03 13:39 /dev/ram12
brw-rw---- 1 root disk 1, 832 2008-04-03 13:39 /dev/ram13
brw-rw---- 1 root disk 1, 896 2008-04-03 13:39 /dev/ram14
brw-rw---- 1 root disk 1, 960 2008-04-03 13:39 /dev/ram15
brw-rw---- 1 root disk 1, 128 2008-04-03 13:39 /dev/ram2
brw-rw---- 1 root disk 1, 192 2008-04-03 13:39 /dev/ram3
brw-rw---- 1 root disk 1, 256 2008-04-03 13:39 /dev/ram4
brw-rw---- 1 root disk 1, 320 2008-04-03 13:39 /dev/ram5
brw-rw---- 1 root disk 1, 384 2008-04-03 13:39 /dev/ram6
brw-rw---- 1 root disk 1, 448 2008-04-03 13:39 /dev/ram7
brw-rw---- 1 root disk 1, 512 2008-04-03 13:39 /dev/ram8
brw-rw---- 1 root disk 1, 576 2008-04-03 13:39 /dev/ram9
# fdisk /dev/ram0
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): o
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-2, default 1): 1
Last cylinder or +size or +sizeM or +sizeK (1-2, default 2): 2

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
# ls -l /dev/ram0*
brw-rw---- 1 root disk 1, 0 2008-04-03 13:40 /dev/ram0
brw-rw---- 1 root disk 1, 1 2008-04-03 13:40 /dev/ram0p1
# mkfs /dev/ram0p1
mke2fs 1.40-WIP (14-Nov-2006)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
4016 inodes, 16032 blocks
801 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=16515072
2 block groups
8192 blocks per group, 8192 fragments per group
2008 inodes per group
Superblock backups stored on blocks:
	8193

Writing inode tables: done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 26 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
# mount /dev/ram0p1 /mnt
df /mnt
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/ram0p1              15521       138     14582   1% /mnt
# ls -l /mnt
total 12
drwx------ 2 root root 12288 2008-04-03 13:41 lost+found
# umount /mnt
# rmmod brd

Signed-off-by: Laurent Vivier <Laurent.Vivier@bull.net>
Acked-by: Nick Piggin <nickpiggin@yahoo.com.au>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-04-30 08:29:53 -07:00
..
accessibility Basic braille screen reader support 2008-04-30 08:29:52 -07:00
acorn/char
acpi [IA64] Provide ACPI fixup for /proc/cpuinfo/physical_id 2008-04-29 15:05:29 -07:00
amba
ata ahci: SB600 ahci can't do MSI, blacklist that capability 2008-04-29 17:42:04 -04:00
atm drivers: atm, char fix integer as NULL pointer warnings 2008-04-28 17:29:18 -07:00
auxdisplay
base mm: Add NR_WRITEBACK_TEMP counter 2008-04-30 08:29:50 -07:00
block brd: modify ramdisk device to be able to manage partitions 2008-04-30 08:29:53 -07:00
bluetooth tty: add throttle/unthrottle helpers 2008-04-30 08:29:47 -07:00
cdrom Merge branch 'for-linus' of git://git.kernel.dk/linux-2.6-block 2008-04-29 08:18:03 -07:00
char Basic braille screen reader support 2008-04-30 08:29:52 -07:00
clocksource
connector
cpufreq [CPUFREQ] state info wrong after resume 2008-04-28 16:27:08 -04:00
cpuidle
crypto [CRYPTO] padlock-aes: Use generic setkey function 2008-04-21 10:19:34 +08:00
dca
dio
dma DMA engine: typo fixes 2008-04-21 22:38:45 +00:00
edac pasemi_edac needs to include linux/edac.h 2008-04-29 19:06:57 -07:00
eisa
firewire Convert asm/semaphore.h users to linux/semaphore.h 2008-04-18 22:22:54 -04:00
firmware edd: add default mode CONFIG_EDD_OFF=n, override with edd={on,off} 2008-04-29 08:06:23 -07:00
gpio drivers: replace remaining __FUNCTION__ occurrences 2008-04-30 08:29:53 -07:00
hid hid-core: use get_unaligned_* helpers 2008-04-29 08:06:27 -07:00
hwmon drivers: replace remaining __FUNCTION__ occurrences 2008-04-30 08:29:53 -07:00
i2c i2c: Convert most new-style drivers to use module aliasing 2008-04-29 23:11:40 +02:00
ide alim15x3: disable init_hwif_ali15x3 for PowerPC 2008-04-29 22:57:38 +02:00
ieee1394 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394-2.6 2008-04-25 12:24:06 -07:00
infiniband RDMA/nes: Formatting cleanup 2008-04-29 13:46:54 -07:00
input tty: The big operations rework 2008-04-30 08:29:47 -07:00
isdn tty: The big operations rework 2008-04-30 08:29:47 -07:00
leds Remove duplicated unlikely() in IS_ERR() 2008-04-29 08:06:25 -07:00
lguest drivers: Remove unnecessary inclusions of asm/semaphore.h 2008-04-18 22:16:32 -04:00
macintosh [POWERPC] windfarm: Add PowerMac 12,1 support 2008-04-29 15:57:35 +10:00
mca proc: remove proc_root from drivers 2008-04-29 08:06:18 -07:00
md md: support blocking writes to an array on device failure 2008-04-30 08:29:33 -07:00
media Add macros similar to min/max/min_t/max_t 2008-04-30 08:29:53 -07:00
memstick memstick: convert struct class_device to struct device 2008-04-19 19:10:29 -07:00
message Remove duplicated unlikely() in IS_ERR() 2008-04-29 08:06:25 -07:00
mfd drivers: replace remaining __FUNCTION__ occurrences 2008-04-30 08:29:53 -07:00
misc [IA64] allocate multiple contiguous pages via uncached allocator 2008-04-29 13:49:01 -07:00
mmc Merge master.kernel.org:/home/rmk/linux-2.6-arm 2008-04-29 15:18:06 -07:00
mtd drivers: fix integer as NULL pointer warnings 2008-04-28 17:31:13 -07:00
net tty: add throttle/unthrottle helpers 2008-04-30 08:29:47 -07:00
nubus proc: convert /proc/bus/nubus to seq_file interface 2008-04-29 08:06:19 -07:00
of [POWERPC] drivers/of/of_i2c.c: Add MODULE_LICENSE 2008-04-24 20:58:01 +10:00
oprofile oprofile: change cpu_buffer from array to per_cpu variable 2008-04-28 08:58:31 -07:00
parisc parisc: use non-racy method for proc entries creation 2008-04-29 08:06:22 -07:00
parport debugobjects: add timer specific object debugging code 2008-04-30 08:29:53 -07:00
pci Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6 2008-04-29 10:17:59 -07:00
pcmcia drivers/pcmcia/pcmcia_ioctl.c: fix build 2008-04-29 11:00:39 -07:00
pnp drivers: use non-racy method for proc entries creation (2) 2008-04-29 08:06:22 -07:00
power x86: olpc: add One Laptop Per Child architecture support 2008-04-29 08:06:07 -07:00
ps3
rapidio [RAPIDIO] Auto-probe the RapidIO system size 2008-04-29 19:40:28 +10:00
rtc i2c: Convert most new-style drivers to use module aliasing 2008-04-29 23:11:40 +02:00
s390 s390 tty: Prepare for put_char to return success/fail 2008-04-30 08:29:45 -07:00
sbus drivers: replace remaining __FUNCTION__ occurrences 2008-04-30 08:29:53 -07:00
scsi Merge branch 'for-linus' of git://git.kernel.dk/linux-2.6-block 2008-04-29 08:18:03 -07:00
serial tty: The big operations rework 2008-04-30 08:29:47 -07:00
sh
sn
spi atmel_spi: clean up baud rate divisor calculation 2008-04-30 08:29:31 -07:00
ssb ssb: Fix all-ones boardflags 2008-04-23 21:25:35 -04:00
tc
telephony
thermal acpi thermal trip points increased to 12 2008-04-15 19:35:41 -07:00
uio UIO: hold a reference to the device's owner while the device is open 2008-04-19 19:10:18 -07:00
usb tty: The big operations rework 2008-04-30 08:29:47 -07:00
video pxafb: preliminary smart panel interface support (update) 2008-04-30 08:29:32 -07:00
virtio virtio: remove overzealous BUG_ON. 2008-04-07 13:14:22 -07:00
w1 drivers: replace remaining __FUNCTION__ occurrences 2008-04-30 08:29:53 -07:00
watchdog Convert asm/semaphore.h users to linux/semaphore.h 2008-04-18 22:22:54 -04:00
xen xen: add balloon driver 2008-04-24 23:57:33 +02:00
zorro zorro: use non-racy method for proc entries creation 2008-04-29 08:06:21 -07:00
Kconfig Basic braille screen reader support 2008-04-30 08:29:52 -07:00
Makefile Basic braille screen reader support 2008-04-30 08:29:52 -07:00