#include <linux/init.h>
#include <linux/module.h>
#include <linux/device.h>
#include <linux/kernel.h>
#include <linux/blkdev.h>
#include <linux/vringh.h>
#include <linux/vdpa.h>
#include <uapi/linux/virtio_blk.h>
#include "vdpa_sim.h"
#define DRV_VERSION …
#define DRV_AUTHOR …
#define DRV_DESC …
#define DRV_LICENSE …
#define VDPASIM_BLK_FEATURES …
#define VDPASIM_BLK_CAPACITY …
#define VDPASIM_BLK_SIZE_MAX …
#define VDPASIM_BLK_SEG_MAX …
#define VDPASIM_BLK_DWZ_MAX_SECTORS …
#define VDPASIM_BLK_VQ_NUM …
#define VDPASIM_BLK_AS_NUM …
#define VDPASIM_BLK_GROUP_NUM …
struct vdpasim_blk { … };
static struct vdpasim_blk *sim_to_blk(struct vdpasim *vdpasim)
{ … }
static char vdpasim_blk_id[VIRTIO_BLK_ID_BYTES] = …;
static bool shared_backend;
module_param(shared_backend, bool, 0444);
MODULE_PARM_DESC(…) …;
static void *shared_buffer;
static DEFINE_MUTEX(shared_buffer_mutex);
static void vdpasim_blk_buffer_lock(struct vdpasim_blk *blk)
{ … }
static void vdpasim_blk_buffer_unlock(struct vdpasim_blk *blk)
{ … }
static bool vdpasim_blk_check_range(struct vdpasim *vdpasim, u64 start_sector,
u64 num_sectors, u64 max_sectors)
{ … }
static bool vdpasim_blk_handle_req(struct vdpasim *vdpasim,
struct vdpasim_virtqueue *vq)
{ … }
static void vdpasim_blk_work(struct vdpasim *vdpasim)
{ … }
static void vdpasim_blk_get_config(struct vdpasim *vdpasim, void *config)
{ … }
static void vdpasim_blk_free(struct vdpasim *vdpasim)
{ … }
static void vdpasim_blk_mgmtdev_release(struct device *dev)
{ … }
static struct device vdpasim_blk_mgmtdev = …;
static int vdpasim_blk_dev_add(struct vdpa_mgmt_dev *mdev, const char *name,
const struct vdpa_dev_set_config *config)
{ … }
static void vdpasim_blk_dev_del(struct vdpa_mgmt_dev *mdev,
struct vdpa_device *dev)
{ … }
static const struct vdpa_mgmtdev_ops vdpasim_blk_mgmtdev_ops = …;
static struct virtio_device_id id_table[] = …;
static struct vdpa_mgmt_dev mgmt_dev = …;
static int __init vdpasim_blk_init(void)
{ … }
static void __exit vdpasim_blk_exit(void)
{ … }
module_init(…) …
module_exit(…)
MODULE_VERSION(…);
MODULE_LICENSE(…);
MODULE_AUTHOR(…);
MODULE_DESCRIPTION(…);