Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5489377c authored by Konrad Rzeszutek Wilk's avatar Konrad Rzeszutek Wilk
Browse files

xen/blkback: blkif->struct blkif_st



checkpatch.pl suggested that we don't use the typdef in common.h
and this triggered this avalanche of patches.

Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
parent a1397fa3
Loading
Loading
Loading
Loading
+12 −12
Original line number Original line Diff line number Diff line
@@ -75,7 +75,7 @@ module_param(debug_lvl, int, 0644);
 * response queued for it, with the saved 'id' passed back.
 * response queued for it, with the saved 'id' passed back.
 */
 */
typedef struct {
typedef struct {
	blkif_t       *blkif;
	struct blkif_st       *blkif;
	u64            id;
	u64            id;
	int            nr_pages;
	int            nr_pages;
	atomic_t       pendcnt;
	atomic_t       pendcnt;
@@ -123,11 +123,11 @@ static inline unsigned long vaddr(pending_req_t *req, int seg)
	(blkbk->pending_grant_handles[vaddr_pagenr(_req, _seg)])
	(blkbk->pending_grant_handles[vaddr_pagenr(_req, _seg)])




static int do_block_io_op(blkif_t *blkif);
static int do_block_io_op(struct blkif_st *blkif);
static void dispatch_rw_block_io(blkif_t *blkif,
static void dispatch_rw_block_io(struct blkif_st *blkif,
				 struct blkif_request *req,
				 struct blkif_request *req,
				 pending_req_t *pending_req);
				 pending_req_t *pending_req);
static void make_response(blkif_t *blkif, u64 id,
static void make_response(struct blkif_st *blkif, u64 id,
			  unsigned short op, int st);
			  unsigned short op, int st);


/*
/*
@@ -169,7 +169,7 @@ static void free_req(pending_req_t *req)
 * It is OK to make multiple calls in this function as it
 * It is OK to make multiple calls in this function as it
 * resets the plug to NULL when it is done on the first call.
 * resets the plug to NULL when it is done on the first call.
 */
 */
static void unplug_queue(blkif_t *blkif)
static void unplug_queue(struct blkif_st *blkif)
{
{
	if (blkif->plug == NULL)
	if (blkif->plug == NULL)
		return;
		return;
@@ -185,7 +185,7 @@ static void unplug_queue(blkif_t *blkif)
 * not to double reference. We also give back a reference count
 * not to double reference. We also give back a reference count
 * if it corresponds to another queue.
 * if it corresponds to another queue.
 */
 */
static void plug_queue(blkif_t *blkif, struct block_device *bdev)
static void plug_queue(struct blkif_st *blkif, struct block_device *bdev)
{
{
	struct request_queue *q = bdev_get_queue(bdev);
	struct request_queue *q = bdev_get_queue(bdev);


@@ -237,7 +237,7 @@ static void fast_flush_area(pending_req_t *req)
 * SCHEDULER FUNCTIONS
 * SCHEDULER FUNCTIONS
 */
 */


static void print_stats(blkif_t *blkif)
static void print_stats(struct blkif_st *blkif)
{
{
	printk(KERN_DEBUG "%s: oo %3d  |  rd %4d  |  wr %4d  |  br %4d\n",
	printk(KERN_DEBUG "%s: oo %3d  |  rd %4d  |  wr %4d  |  br %4d\n",
	       current->comm, blkif->st_oo_req,
	       current->comm, blkif->st_oo_req,
@@ -250,7 +250,7 @@ static void print_stats(blkif_t *blkif)


int blkif_schedule(void *arg)
int blkif_schedule(void *arg)
{
{
	blkif_t *blkif = arg;
	struct blkif_st *blkif = arg;
	struct vbd *vbd = &blkif->vbd;
	struct vbd *vbd = &blkif->vbd;


	blkif_get(blkif);
	blkif_get(blkif);
@@ -337,7 +337,7 @@ static void end_block_io_op(struct bio *bio, int error)
 * Notification from the guest OS.
 * Notification from the guest OS.
 */
 */


static void blkif_notify_work(blkif_t *blkif)
static void blkif_notify_work(struct blkif_st *blkif)
{
{
	blkif->waiting_reqs = 1;
	blkif->waiting_reqs = 1;
	wake_up(&blkif->wq);
	wake_up(&blkif->wq);
@@ -356,7 +356,7 @@ irqreturn_t blkif_be_int(int irq, void *dev_id)
 * (which has the sectors we want, number of them, grant references, etc),
 * (which has the sectors we want, number of them, grant references, etc),
 * and transmute  it to the block API to hand it over to the proper block disk.
 * and transmute  it to the block API to hand it over to the proper block disk.
 */
 */
static int do_block_io_op(blkif_t *blkif)
static int do_block_io_op(struct blkif_st *blkif)
{
{
	union blkif_back_rings *blk_rings = &blkif->blk_rings;
	union blkif_back_rings *blk_rings = &blkif->blk_rings;
	struct blkif_request req;
	struct blkif_request req;
@@ -438,7 +438,7 @@ static int do_block_io_op(blkif_t *blkif)
 * Transumation of the 'struct blkif_request' to a proper 'struct bio'
 * Transumation of the 'struct blkif_request' to a proper 'struct bio'
 * and call the 'submit_bio' to pass it to the underlaying storage.
 * and call the 'submit_bio' to pass it to the underlaying storage.
 */
 */
static void dispatch_rw_block_io(blkif_t *blkif,
static void dispatch_rw_block_io(struct blkif_st *blkif,
				 struct blkif_request *req,
				 struct blkif_request *req,
				 pending_req_t *pending_req)
				 pending_req_t *pending_req)
{
{
@@ -633,7 +633,7 @@ static void dispatch_rw_block_io(blkif_t *blkif,
/*
/*
 * Put a response on the ring on how the operation fared.
 * Put a response on the ring on how the operation fared.
 */
 */
static void make_response(blkif_t *blkif, u64 id,
static void make_response(struct blkif_st *blkif, u64 id,
			  unsigned short op, int st)
			  unsigned short op, int st)
{
{
	struct blkif_response  resp;
	struct blkif_response  resp;
+12 −11
Original line number Original line Diff line number Diff line
@@ -34,7 +34,7 @@
#include <linux/blkdev.h>
#include <linux/blkdev.h>
#include <linux/vmalloc.h>
#include <linux/vmalloc.h>
#include <linux/wait.h>
#include <linux/wait.h>
#include <asm/io.h>
#include <linux/io.h>
#include <asm/setup.h>
#include <asm/setup.h>
#include <asm/pgalloc.h>
#include <asm/pgalloc.h>
#include <asm/hypervisor.h>
#include <asm/hypervisor.h>
@@ -57,7 +57,7 @@ struct vbd {


struct backend_info;
struct backend_info;


typedef struct blkif_st {
struct blkif_st {
	/* Unique identifier for this interface. */
	/* Unique identifier for this interface. */
	domid_t           domid;
	domid_t           domid;
	unsigned int      handle;
	unsigned int      handle;
@@ -94,13 +94,14 @@ typedef struct blkif_st {


	grant_handle_t shmem_handle;
	grant_handle_t shmem_handle;
	grant_ref_t    shmem_ref;
	grant_ref_t    shmem_ref;
} blkif_t;
};


blkif_t *blkif_alloc(domid_t domid);
struct blkif_st *blkif_alloc(domid_t domid);
void blkif_disconnect(blkif_t *blkif);
void blkif_disconnect(struct blkif_st *blkif);
void blkif_free(blkif_t *blkif);
void blkif_free(struct blkif_st *blkif);
int blkif_map(blkif_t *blkif, unsigned long shared_page, unsigned int evtchn);
int blkif_map(struct blkif_st *blkif, unsigned long shared_page,
void vbd_resize(blkif_t *blkif);
	      unsigned int evtchn);
void vbd_resize(struct blkif_st *blkif);


#define blkif_get(_b) (atomic_inc(&(_b)->refcnt))
#define blkif_get(_b) (atomic_inc(&(_b)->refcnt))
#define blkif_put(_b)					\
#define blkif_put(_b)					\
@@ -110,7 +111,7 @@ void vbd_resize(blkif_t *blkif);
	} while (0)
	} while (0)


/* Create a vbd. */
/* Create a vbd. */
int vbd_create(blkif_t *blkif, blkif_vdev_t vdevice, unsigned major,
int vbd_create(struct blkif_st *blkif, blkif_vdev_t vdevice, unsigned major,
	       unsigned minor, int readonly, int cdrom);
	       unsigned minor, int readonly, int cdrom);
void vbd_free(struct vbd *vbd);
void vbd_free(struct vbd *vbd);


@@ -125,7 +126,7 @@ struct phys_req {
	blkif_sector_t       sector_number;
	blkif_sector_t       sector_number;
};
};


int vbd_translate(struct phys_req *req, blkif_t *blkif, int operation);
int vbd_translate(struct phys_req *req, struct blkif_st *blkif, int operation);


int blkif_interface_init(void);
int blkif_interface_init(void);


+8 −8
Original line number Original line Diff line number Diff line
@@ -35,9 +35,9 @@


static struct kmem_cache *blkif_cachep;
static struct kmem_cache *blkif_cachep;


blkif_t *blkif_alloc(domid_t domid)
struct blkif_st *blkif_alloc(domid_t domid)
{
{
	blkif_t *blkif;
	struct blkif_st *blkif;


	blkif = kmem_cache_alloc(blkif_cachep, GFP_KERNEL);
	blkif = kmem_cache_alloc(blkif_cachep, GFP_KERNEL);
	if (!blkif)
	if (!blkif)
@@ -54,7 +54,7 @@ blkif_t *blkif_alloc(domid_t domid)
	return blkif;
	return blkif;
}
}


static int map_frontend_page(blkif_t *blkif, unsigned long shared_page)
static int map_frontend_page(struct blkif_st *blkif, unsigned long shared_page)
{
{
	struct gnttab_map_grant_ref op;
	struct gnttab_map_grant_ref op;


@@ -75,7 +75,7 @@ static int map_frontend_page(blkif_t *blkif, unsigned long shared_page)
	return 0;
	return 0;
}
}


static void unmap_frontend_page(blkif_t *blkif)
static void unmap_frontend_page(struct blkif_st *blkif)
{
{
	struct gnttab_unmap_grant_ref op;
	struct gnttab_unmap_grant_ref op;


@@ -86,7 +86,7 @@ static void unmap_frontend_page(blkif_t *blkif)
		BUG();
		BUG();
}
}


int blkif_map(blkif_t *blkif, unsigned long shared_page, unsigned int evtchn)
int blkif_map(struct blkif_st *blkif, unsigned long shared_page, unsigned int evtchn)
{
{
	int err;
	int err;


@@ -143,7 +143,7 @@ int blkif_map(blkif_t *blkif, unsigned long shared_page, unsigned int evtchn)
	return 0;
	return 0;
}
}


void blkif_disconnect(blkif_t *blkif)
void blkif_disconnect(struct blkif_st *blkif)
{
{
	if (blkif->xenblkd) {
	if (blkif->xenblkd) {
		kthread_stop(blkif->xenblkd);
		kthread_stop(blkif->xenblkd);
@@ -166,7 +166,7 @@ void blkif_disconnect(blkif_t *blkif)
	}
	}
}
}


void blkif_free(blkif_t *blkif)
void blkif_free(struct blkif_st *blkif)
{
{
	if (!atomic_dec_and_test(&blkif->refcnt))
	if (!atomic_dec_and_test(&blkif->refcnt))
		BUG();
		BUG();
@@ -175,7 +175,7 @@ void blkif_free(blkif_t *blkif)


int __init blkif_interface_init(void)
int __init blkif_interface_init(void)
{
{
	blkif_cachep = kmem_cache_create("blkif_cache", sizeof(blkif_t),
	blkif_cachep = kmem_cache_create("blkif_cache", sizeof(struct blkif_st),
					 0, 0, NULL);
					 0, 0, NULL);
	if (!blkif_cachep)
	if (!blkif_cachep)
		return -ENOMEM;
		return -ENOMEM;
+3 −3
Original line number Original line Diff line number Diff line
@@ -48,7 +48,7 @@ unsigned long vbd_secsize(struct vbd *vbd)
	return bdev_logical_block_size(vbd->bdev);
	return bdev_logical_block_size(vbd->bdev);
}
}


int vbd_create(blkif_t *blkif, blkif_vdev_t handle, unsigned major,
int vbd_create(struct blkif_st *blkif, blkif_vdev_t handle, unsigned major,
	       unsigned minor, int readonly, int cdrom)
	       unsigned minor, int readonly, int cdrom)
{
{
	struct vbd *vbd;
	struct vbd *vbd;
@@ -97,7 +97,7 @@ void vbd_free(struct vbd *vbd)
	vbd->bdev = NULL;
	vbd->bdev = NULL;
}
}


int vbd_translate(struct phys_req *req, blkif_t *blkif, int operation)
int vbd_translate(struct phys_req *req, struct blkif_st *blkif, int operation)
{
{
	struct vbd *vbd = &blkif->vbd;
	struct vbd *vbd = &blkif->vbd;
	int rc = -EACCES;
	int rc = -EACCES;
@@ -116,7 +116,7 @@ int vbd_translate(struct phys_req *req, blkif_t *blkif, int operation)
	return rc;
	return rc;
}
}


void vbd_resize(blkif_t *blkif)
void vbd_resize(struct blkif_st *blkif)
{
{
	struct vbd *vbd = &blkif->vbd;
	struct vbd *vbd = &blkif->vbd;
	struct xenbus_transaction xbt;
	struct xenbus_transaction xbt;
+3 −3
Original line number Original line Diff line number Diff line
@@ -30,7 +30,7 @@
struct backend_info
struct backend_info
{
{
	struct xenbus_device *dev;
	struct xenbus_device *dev;
	blkif_t *blkif;
	struct blkif_st *blkif;
	struct xenbus_watch backend_watch;
	struct xenbus_watch backend_watch;
	unsigned major;
	unsigned major;
	unsigned minor;
	unsigned minor;
@@ -47,7 +47,7 @@ struct xenbus_device *blkback_xenbus(struct backend_info *be)
	return be->dev;
	return be->dev;
}
}


static int blkback_name(blkif_t *blkif, char *buf)
static int blkback_name(struct blkif_st *blkif, char *buf)
{
{
	char *devpath, *devname;
	char *devpath, *devname;
	struct xenbus_device *dev = blkif->be->dev;
	struct xenbus_device *dev = blkif->be->dev;
@@ -67,7 +67,7 @@ static int blkback_name(blkif_t *blkif, char *buf)
	return 0;
	return 0;
}
}


static void update_blkif_status(blkif_t *blkif)
static void update_blkif_status(struct blkif_st *blkif)
{
{
	int err;
	int err;
	char name[TASK_COMM_LEN];
	char name[TASK_COMM_LEN];