/*
        Data structure and prototypes for
        simple block driver
*/
#include <linux/blkdev.h>

/*
 * We can tweak our hardware sector size, but the kernel talks to us
 * in terms of small sectors, always.
 */
#define KERNEL_SECTOR_SIZE  512

#ifdef DEBUG
#   define PDEBUG(fmt, args...) printk( KERN_WARNING "simple_block: " fmt, ## args)
#else
#   define PDEBUG(fmt, args...) /* not debugging: nothing */
#endif
/*
 * The internal representation of our device.
 */
struct block_dev {
        int size;                       /* Device size in sectors */
        u8 *data;                       /* The data array */
        short users;                    /* How many users */
        short media_change;             /* Flag a media change? */
        spinlock_t lock;                /* For mutual exclusion */
        struct request_queue *queue;    /* The device request queue */
        struct gendisk *gd;             /* The gendisk structure */
        struct timer_list timer;        /* For simulated media changes */
};
/*
 * The different "request modes" we can use.
*/
enum {
    RM_SIMPLE  = 0, /* The extra-simple request function */
    RM_FULL    = 1, /* The full-blown version */
    RM_NOQUEUE = 2, /* Use make_request */
};

int block_transfer (struct block_dev *dev, unsigned long sector,
        unsigned long nsect, char *buffer, int write);
void block_request (struct request_queue *q);
int setup_request (int request_mode, struct block_dev *dev);


