android_kernel_xiaomi_sm8350/drivers/block
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
..
aoe drivers/block: use get_unaligned_* helpers 2008-04-29 08:06:27 -07:00
paride block: use blk_rq_init() to initialize the request 2008-04-29 14:48:55 +02:00
amiflop.c
ataflop.c Atari floppy: Rename disk_type to atari_disk_type 2008-02-06 10:41:10 -08:00
brd.c brd: modify ramdisk device to be able to manage partitions 2008-04-30 08:29:53 -07:00
cciss_cmd.h
cciss_scsi.c cciss: fix warning oops on rmmod of driver 2008-04-21 09:50:09 +02:00
cciss_scsi.h
cciss.c proc: remove proc_root_driver 2008-04-29 08:06:18 -07:00
cciss.h
cpqarray.c proc: remove proc_root_driver 2008-04-29 08:06:18 -07:00
cpqarray.h
cryptoloop.c drivers: Remove unnecessary inclusions of asm/semaphore.h 2008-04-18 22:16:32 -04:00
DAC960.c blk_end_request: changing DAC960 (take 4) 2008-01-28 10:36:04 +01:00
DAC960.h
floppy.c drivers/block/floppy.c: replace init_module&cleanup_module with module_init&module_exit 2008-04-29 08:06:03 -07:00
ida_cmd.h
ida_ioctl.h
Kconfig The ps2esdi driver was marked as BROKEN more than two years ago due to being 2008-03-17 09:03:05 +01:00
loop.c block: make queue flags non-atomic 2008-04-29 14:48:33 +02:00
Makefile The ps2esdi driver was marked as BROKEN more than two years ago due to being 2008-03-17 09:03:05 +01:00
nbd.c Merge branch 'for-linus' of git://git.kernel.dk/linux-2.6-block 2008-04-29 08:18:03 -07:00
pktcdvd.c Merge branch 'for-linus' of git://git.kernel.dk/linux-2.6-block 2008-04-29 08:18:03 -07:00
ps3disk.c block: no need to initialize rq->cmd in prepare_flush_fn hook 2008-04-29 14:48:54 +02:00
smart1,2.h
sunvdc.c block/sunvdc.c:print_version() must be __devinit 2008-02-01 09:26:32 +01:00
swim3.c Fix compile of swim3 as module 2008-02-14 20:58:04 -08:00
sx8.c block: replace remaining __FUNCTION__ occurrences 2008-04-21 09:51:04 +02:00
ub.c block: make queue flags non-atomic 2008-04-29 14:48:33 +02:00
umem.c
umem.h
viodasd.c [POWERPC] Use FIELD_SIZEOF in drivers/block/viodasd.c 2008-04-01 20:43:10 +11:00
virtio_blk.c virtio: Fix sysfs bits to have proper block symlink 2008-03-17 22:58:15 +11:00
xd.c
xd.h
xen-blkfront.c xen: make blkif_getgeo static 2008-04-29 08:06:06 -07:00
xsysace.c [POWERPC] Xilinx: Update compatible to use values generated by BSP generator. 2008-02-06 10:23:21 -07:00
z2ram.c