linux/drivers/block/xen-blkback/xenbus.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*  Xenbus code for blkif backend
    Copyright (C) 2005 Rusty Russell <[email protected]>
    Copyright (C) 2005 XenSource Ltd


*/

#define pr_fmt(fmt)

#include <linux/module.h>
#include <linux/kthread.h>
#include <linux/pagemap.h>
#include <xen/events.h>
#include <xen/grant_table.h>
#include "common.h"

/* On the XenBus the max length of 'ring-ref%u'. */
#define RINGREF_NAME_LEN

struct backend_info {};

static struct kmem_cache *xen_blkif_cachep;
static void connect(struct backend_info *);
static int connect_ring(struct backend_info *);
static void backend_changed(struct xenbus_watch *, const char *,
			    const char *);
static void xen_blkif_free(struct xen_blkif *blkif);
static void xen_vbd_free(struct xen_vbd *vbd);

struct xenbus_device *xen_blkbk_xenbus(struct backend_info *be)
{}

/*
 * The last request could free the device from softirq context and
 * xen_blkif_free() can sleep.
 */
static void xen_blkif_deferred_free(struct work_struct *work)
{}

static int blkback_name(struct xen_blkif *blkif, char *buf)
{}

static void xen_update_blkif_status(struct xen_blkif *blkif)
{}

static int xen_blkif_alloc_rings(struct xen_blkif *blkif)
{}

/* Enable the persistent grants feature. */
static bool feature_persistent =;
module_param(feature_persistent, bool, 0644);
MODULE_PARM_DESC();

static struct xen_blkif *xen_blkif_alloc(domid_t domid)
{}

static int xen_blkif_map(struct xen_blkif_ring *ring, grant_ref_t *gref,
			 unsigned int nr_grefs, unsigned int evtchn)
{}

static int xen_blkif_disconnect(struct xen_blkif *blkif)
{}

static void xen_blkif_free(struct xen_blkif *blkif)
{}

int __init xen_blkif_interface_init(void)
{}

void xen_blkif_interface_fini(void)
{}

/*
 *  sysfs interface for VBD I/O requests
 */

#define VBD_SHOW_ALLRING(name, format)

VBD_SHOW_ALLRING();
VBD_SHOW_ALLRING();
VBD_SHOW_ALLRING();
VBD_SHOW_ALLRING();
VBD_SHOW_ALLRING();
VBD_SHOW_ALLRING();
VBD_SHOW_ALLRING();

static struct attribute *xen_vbdstat_attrs[] =;

static const struct attribute_group xen_vbdstat_group =;

#define VBD_SHOW(name, format, args...)

VBD_SHOW();
VBD_SHOW();

static int xenvbd_sysfs_addif(struct xenbus_device *dev)
{}

static void xenvbd_sysfs_delif(struct xenbus_device *dev)
{}

static void xen_vbd_free(struct xen_vbd *vbd)
{}

static int xen_vbd_create(struct xen_blkif *blkif, blkif_vdev_t handle,
			  unsigned major, unsigned minor, int readonly,
			  int cdrom)
{}

static void xen_blkbk_remove(struct xenbus_device *dev)
{}

int xen_blkbk_flush_diskcache(struct xenbus_transaction xbt,
			      struct backend_info *be, int state)
{}

static void xen_blkbk_discard(struct xenbus_transaction xbt, struct backend_info *be)
{}

int xen_blkbk_barrier(struct xenbus_transaction xbt,
		      struct backend_info *be, int state)
{}

/*
 * Entry point to this code when a new device is created.  Allocate the basic
 * structures, and watch the store waiting for the hotplug scripts to tell us
 * the device's physical major and minor numbers.  Switch to InitWait.
 */
static int xen_blkbk_probe(struct xenbus_device *dev,
			   const struct xenbus_device_id *id)
{}

/*
 * Callback received when the hotplug scripts have placed the physical-device
 * node.  Read it and the mode node, and create a vbd.  If the frontend is
 * ready, connect.
 */
static void backend_changed(struct xenbus_watch *watch,
			    const char *path, const char *token)
{}

/*
 * Callback received when the frontend's state changes.
 */
static void frontend_changed(struct xenbus_device *dev,
			     enum xenbus_state frontend_state)
{}

/* Once a memory pressure is detected, squeeze free page pools for a while. */
static unsigned int buffer_squeeze_duration_ms =;
module_param_named(buffer_squeeze_duration_ms,
		buffer_squeeze_duration_ms, int, 0644);
MODULE_PARM_DESC();

/*
 * Callback received when the memory pressure is detected.
 */
static void reclaim_memory(struct xenbus_device *dev)
{}

/* ** Connection ** */

/*
 * Write the physical details regarding the block device to the store, and
 * switch to Connected state.
 */
static void connect(struct backend_info *be)
{}

/*
 * Each ring may have multi pages, depends on "ring-page-order".
 */
static int read_per_ring_refs(struct xen_blkif_ring *ring, const char *dir)
{}

static int connect_ring(struct backend_info *be)
{}

static const struct xenbus_device_id xen_blkbk_ids[] =;

static struct xenbus_driver xen_blkbk_driver =;

int xen_blkif_xenbus_init(void)
{}

void xen_blkif_xenbus_fini(void)
{}