#include <linux/init.h>
#include <linux/initrd.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/major.h>
#include <linux/blkdev.h>
#include <linux/bio.h>
#include <linux/highmem.h>
#include <linux/mutex.h>
#include <linux/pagemap.h>
#include <linux/xarray.h>
#include <linux/fs.h>
#include <linux/slab.h>
#include <linux/backing-dev.h>
#include <linux/debugfs.h>
#include <linux/uaccess.h>
struct brd_device { … };
static struct page *brd_lookup_page(struct brd_device *brd, sector_t sector)
{ … }
static int brd_insert_page(struct brd_device *brd, sector_t sector, gfp_t gfp)
{ … }
static void brd_free_pages(struct brd_device *brd)
{ … }
static int copy_to_brd_setup(struct brd_device *brd, sector_t sector, size_t n,
gfp_t gfp)
{ … }
static void copy_to_brd(struct brd_device *brd, const void *src,
sector_t sector, size_t n)
{ … }
static void copy_from_brd(void *dst, struct brd_device *brd,
sector_t sector, size_t n)
{ … }
static int brd_do_bvec(struct brd_device *brd, struct page *page,
unsigned int len, unsigned int off, blk_opf_t opf,
sector_t sector)
{ … }
static void brd_do_discard(struct brd_device *brd, sector_t sector, u32 size)
{ … }
static void brd_submit_bio(struct bio *bio)
{ … }
static const struct block_device_operations brd_fops = …;
static int rd_nr = …;
module_param(rd_nr, int, 0444);
MODULE_PARM_DESC(…) …;
unsigned long rd_size = …;
module_param(rd_size, ulong, 0444);
MODULE_PARM_DESC(…) …;
static int max_part = …;
module_param(max_part, int, 0444);
MODULE_PARM_DESC(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
MODULE_ALIAS_BLOCKDEV_MAJOR(…);
MODULE_ALIAS(…) …;
#ifndef MODULE
static int __init ramdisk_size(char *str)
{ … }
__setup(…);
#endif
static LIST_HEAD(brd_devices);
static struct dentry *brd_debugfs_dir;
static int brd_alloc(int i)
{ … }
static void brd_probe(dev_t dev)
{ … }
static void brd_cleanup(void)
{ … }
static inline void brd_check_and_reset_par(void)
{ … }
static int __init brd_init(void)
{ … }
static void __exit brd_exit(void)
{ … }
module_init(…) …;
module_exit(brd_exit);