FreeBSD kernel /amd64 XEN device code
blkback.c File Reference

Device driver supporting the vending of block storage from a FreeBSD domain to other domains. More...

#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/malloc.h>
#include <sys/bio.h>
#include <sys/bus.h>
#include <sys/conf.h>
#include <sys/devicestat.h>
#include <sys/disk.h>
#include <sys/fcntl.h>
#include <sys/filedesc.h>
#include <sys/kdb.h>
#include <sys/module.h>
#include <sys/namei.h>
#include <sys/proc.h>
#include <sys/rman.h>
#include <sys/taskqueue.h>
#include <sys/types.h>
#include <sys/vnode.h>
#include <sys/mount.h>
#include <sys/sysctl.h>
#include <sys/bitstring.h>
#include <sys/sdt.h>
#include <geom/geom.h>
#include <machine/_inttypes.h>
#include <vm/vm.h>
#include <vm/vm_extern.h>
#include <vm/vm_kern.h>
#include <xen/xen-os.h>
#include <xen/blkif.h>
#include <xen/gnttab.h>
#include <xen/xen_intr.h>
#include <contrib/xen/event_channel.h>
#include <contrib/xen/grant_table.h>
#include <xen/xenbus/xenbusvar.h>
Include dependency graph for blkback.c:

Go to the source code of this file.

Data Structures

struct  xbb_xen_reqlist
 
struct  xbb_xen_req
 Object tracking an in-flight I/O from a Xen VBD consumer. More...
 
struct  xbb_ring_config
 Configuration data for the shared memory request ring used to communicate with the front-end client of this this driver. More...
 
struct  xbb_sg
 Structure used to memoize information about a per-request scatter-gather list. More...
 
struct  xbb_dev_data
 
struct  xbb_file_data
 
union  xbb_backend_data
 
struct  xbb_softc
 

Macros

#define XBB_MAX_RING_PAGES   32
 
#define XBB_MAX_REQUESTS    __CONST_RING_SIZE(blkif, PAGE_SIZE * XBB_MAX_RING_PAGES)
 
#define XBB_USE_BOUNCE_BUFFERS
 Define to force all I/O to be performed on memory owned by the backend device, with a copy-in/out to the remote domain's memory. More...
 
#define DPRINTF(fmt, args...)   do {} while(0)
 
#define XBB_MAX_REQUEST_SIZE    MIN(128 * 1024, BLKIF_MAX_SEGMENTS_PER_REQUEST * PAGE_SIZE)
 
#define XBB_MAX_SEGMENTS_PER_REQUEST
 
#define XBB_MAX_SEGMENTS_PER_REQLIST   XBB_MAX_SEGMENTS_PER_REQUEST
 

Typedefs

typedef int(* xbb_dispatch_t) (struct xbb_softc *xbb, struct xbb_xen_reqlist *reqlist, int operation, int flags)
 

Enumerations

enum  xbb_reqlist_flags { XBB_REQLIST_NONE = 0x00 , XBB_REQLIST_MAPPED = 0x01 }
 
enum  xbb_flag_t {
  XBBF_READ_ONLY = 0x01 , XBBF_RING_CONNECTED = 0x02 , XBBF_RESOURCE_SHORTAGE = 0x04 , XBBF_SHUTDOWN = 0x08 ,
  XBBF_IN_SHUTDOWN = 0x10
}
 
enum  xbb_type { XBB_TYPE_NONE = 0x00 , XBB_TYPE_DISK = 0x01 , XBB_TYPE_FILE = 0x02 }
 

Functions

 __FBSDID ("$FreeBSD$")
 
static MALLOC_DEFINE (M_XENBLOCKBACK, "xbbd", "Xen Block Back Driver Data")
 Define to enable rudimentary request logging to the console. More...
 
static void xbb_attach_failed (struct xbb_softc *xbb, int err, const char *fmt,...) __attribute__((format(printf
 
static void static int xbb_shutdown (struct xbb_softc *xbb)
 
 STAILQ_HEAD (xbb_xen_req_list, xbb_xen_req)
 
 STAILQ_HEAD (xbb_xen_reqlist_list, xbb_xen_reqlist)
 
 SLIST_HEAD (xbb_xen_req_slist, xbb_xen_req)
 
static struct xbb_xen_reqxbb_get_req (struct xbb_softc *xbb)
 
static void xbb_release_req (struct xbb_softc *xbb, struct xbb_xen_req *req)
 
static void xbb_release_reqs (struct xbb_softc *xbb, struct xbb_xen_req_list *req_list, int nreqs)
 
static uint8_t * xbb_reqlist_vaddr (struct xbb_xen_reqlist *reqlist, int pagenr, int sector)
 
static uint8_t * xbb_reqlist_bounce_addr (struct xbb_xen_reqlist *reqlist, int pagenr, int sector)
 
static uint8_t * xbb_reqlist_ioaddr (struct xbb_xen_reqlist *reqlist, int pagenr, int sector)
 
static uintptr_t xbb_get_gntaddr (struct xbb_xen_reqlist *reqlist, int pagenr, int sector)
 
static uint8_t * xbb_get_kva (struct xbb_softc *xbb, int nr_pages)
 
static void xbb_free_kva (struct xbb_softc *xbb, uint8_t *kva_ptr, int nr_pages)
 
static void xbb_unmap_reqlist (struct xbb_xen_reqlist *reqlist)
 
static struct xbb_xen_reqlistxbb_get_reqlist (struct xbb_softc *xbb)
 
static void xbb_release_reqlist (struct xbb_softc *xbb, struct xbb_xen_reqlist *reqlist, int wakeup)
 
static int xbb_get_resources (struct xbb_softc *xbb, struct xbb_xen_reqlist **reqlist, blkif_request_t *ring_req, RING_IDX ring_idx)
 
static void xbb_queue_response (struct xbb_softc *xbb, struct xbb_xen_req *req, int status)
 
static void xbb_push_responses (struct xbb_softc *xbb, int *run_taskqueue, int *notify)
 
static void xbb_complete_reqlist (struct xbb_softc *xbb, struct xbb_xen_reqlist *reqlist)
 
static void xbb_bio_done (struct bio *bio)
 
static int xbb_dispatch_io (struct xbb_softc *xbb, struct xbb_xen_reqlist *reqlist)
 
static __inline int xbb_count_sects (blkif_request_t *ring_req)
 
static void xbb_run_queue (void *context, int pending)
 
static int xbb_filter (void *arg)
 
 SDT_PROVIDER_DEFINE (xbb)
 
 SDT_PROBE_DEFINE1 (xbb, kernel, xbb_dispatch_dev, flush, "int")
 
 SDT_PROBE_DEFINE3 (xbb, kernel, xbb_dispatch_dev, read, "int", "uint64_t", "uint64_t")
 
 SDT_PROBE_DEFINE3 (xbb, kernel, xbb_dispatch_dev, write, "int", "uint64_t", "uint64_t")
 
static int xbb_dispatch_dev (struct xbb_softc *xbb, struct xbb_xen_reqlist *reqlist, int operation, int bio_flags)
 
 SDT_PROBE_DEFINE1 (xbb, kernel, xbb_dispatch_file, flush, "int")
 
 SDT_PROBE_DEFINE3 (xbb, kernel, xbb_dispatch_file, read, "int", "uint64_t", "uint64_t")
 
 SDT_PROBE_DEFINE3 (xbb, kernel, xbb_dispatch_file, write, "int", "uint64_t", "uint64_t")
 
static int xbb_dispatch_file (struct xbb_softc *xbb, struct xbb_xen_reqlist *reqlist, int operation, int flags)
 
static void xbb_close_backend (struct xbb_softc *xbb)
 
static int xbb_open_dev (struct xbb_softc *xbb)
 
static int xbb_open_file (struct xbb_softc *xbb)
 
static int xbb_open_backend (struct xbb_softc *xbb)
 
static void xbb_free_communication_mem (struct xbb_softc *xbb)
 
static int xbb_disconnect (struct xbb_softc *xbb)
 
static int xbb_connect_ring (struct xbb_softc *xbb)
 
static int xbb_alloc_communication_mem (struct xbb_softc *xbb)
 
static int xbb_collect_frontend_info (struct xbb_softc *xbb)
 
static int xbb_alloc_requests (struct xbb_softc *xbb)
 
static int xbb_alloc_request_lists (struct xbb_softc *xbb)
 
static int xbb_publish_backend_info (struct xbb_softc *xbb)
 
static void xbb_connect (struct xbb_softc *xbb)
 
static int xbb_probe (device_t dev)
 
static void xbb_setup_sysctl (struct xbb_softc *xbb)
 
static void xbb_attach_disk (device_t dev)
 
static void xbb_attach_cb (struct xs_watch *watch, const char **vec, unsigned int len)
 
static int xbb_attach (device_t dev)
 
static int xbb_detach (device_t dev)
 
static int xbb_suspend (device_t dev)
 
static int xbb_resume (device_t dev)
 
static void xbb_frontend_changed (device_t dev, XenbusState frontend_state)
 
 DRIVER_MODULE (xbbd, xenbusb_back, xbb_driver, xbb_devclass, 0, 0)
 

Variables

static device_method_t xbb_methods []
 
static driver_t xbb_driver
 
devclass_t xbb_devclass
 

Detailed Description

Device driver supporting the vending of block storage from a FreeBSD domain to other domains.

Definition in file blkback.c.

Macro Definition Documentation

◆ DPRINTF

#define DPRINTF (   fmt,
  args... 
)    do {} while(0)

Definition at line 140 of file blkback.c.

◆ XBB_MAX_REQUEST_SIZE

#define XBB_MAX_REQUEST_SIZE    MIN(128 * 1024, BLKIF_MAX_SEGMENTS_PER_REQUEST * PAGE_SIZE)

The maximum mapped region size per request we will allow in a negotiated block-front/back communication channel. Use old default of MAXPHYS == 128K.

Definition at line 148 of file blkback.c.

◆ XBB_MAX_REQUESTS

#define XBB_MAX_REQUESTS    __CONST_RING_SIZE(blkif, PAGE_SIZE * XBB_MAX_RING_PAGES)

The maximum number of outstanding request blocks (request headers plus additional segment blocks) we will allow in a negotiated block-front/back communication channel.

Definition at line 101 of file blkback.c.

◆ XBB_MAX_RING_PAGES

#define XBB_MAX_RING_PAGES   32

The maximum number of shared memory ring pages we will allow in a negotiated block-front/back communication channel. Allow enough ring space for all requests to be XBB_MAX_REQUEST_SIZE'd.

Definition at line 94 of file blkback.c.

◆ XBB_MAX_SEGMENTS_PER_REQLIST

#define XBB_MAX_SEGMENTS_PER_REQLIST   XBB_MAX_SEGMENTS_PER_REQUEST

The maximum number of ring pages that we can allow per request list. We limit this to the maximum number of segments per request, because that is already a reasonable number of segments to aggregate. This number should never be smaller than XBB_MAX_SEGMENTS_PER_REQUEST, because that would leave situations where we can't dispatch even one large request.

Definition at line 169 of file blkback.c.

◆ XBB_MAX_SEGMENTS_PER_REQUEST

#define XBB_MAX_SEGMENTS_PER_REQUEST
Value:
(MIN(UIO_MAXIOV, \
MIN(BLKIF_MAX_SEGMENTS_PER_REQUEST, \
(XBB_MAX_REQUEST_SIZE / PAGE_SIZE) + 1)))
#define XBB_MAX_REQUEST_SIZE
Definition: blkback.c:148

The maximum number of segments (within a request header and accompanying segment blocks) per request we will allow in a negotiated block-front/back communication channel.

Definition at line 156 of file blkback.c.

◆ XBB_USE_BOUNCE_BUFFERS

#define XBB_USE_BOUNCE_BUFFERS

Define to force all I/O to be performed on memory owned by the backend device, with a copy-in/out to the remote domain's memory.

Note
This option is currently required when this driver's domain is operating in HVM mode on a system using an IOMMU.

This driver uses Xen's grant table API to gain access to the memory of the remote domains it serves. When our domain is operating in PV mode, the grant table mechanism directly updates our domain's page table entries to point to the physical pages of the remote domain. This scheme guarantees that blkback and the backing devices it uses can safely perform DMA operations to satisfy requests. In HVM mode, Xen may use a HW IOMMU to insure that our domain cannot DMA to pages owned by another domain. As of Xen 4.0, IOMMU mappings for HVM guests are not updated via the grant table API. For this reason, in HVM mode, we must bounce all requests into memory that is mapped into our domain at domain startup and thus has valid IOMMU mappings.

Definition at line 123 of file blkback.c.

Typedef Documentation

◆ xbb_dispatch_t

typedef int(* xbb_dispatch_t) (struct xbb_softc *xbb, struct xbb_xen_reqlist *reqlist, int operation, int flags)

Function signature of backend specific I/O handlers.

Definition at line 540 of file blkback.c.

Enumeration Type Documentation

◆ xbb_flag_t

enum xbb_flag_t

Per-instance connection state flags.

Enumerator
XBBF_READ_ONLY 

The front-end requested a read-only mount of the back-end device/file.

XBBF_RING_CONNECTED 

Communication with the front-end has been established.

XBBF_RESOURCE_SHORTAGE 

Front-end requests exist in the ring and are waiting for xbb_xen_req objects to free up.

XBBF_SHUTDOWN 

Connection teardown in progress.

XBBF_IN_SHUTDOWN 

A thread is already performing shutdown processing.

Definition at line 403 of file blkback.c.

◆ xbb_reqlist_flags

Enumerator
XBB_REQLIST_NONE 
XBB_REQLIST_MAPPED 

Definition at line 183 of file blkback.c.

◆ xbb_type

enum xbb_type

Backend device type.

Enumerator
XBB_TYPE_NONE 

Backend type unknown.

XBB_TYPE_DISK 

Backend type disk (access via cdev switch strategy routine).

XBB_TYPE_FILE 

Backend type file (access vnode operations.).

Definition at line 428 of file blkback.c.

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ DRIVER_MODULE()

DRIVER_MODULE ( xbbd  ,
xenbusb_back  ,
xbb_driver  ,
xbb_devclass  ,
,
 
)

◆ MALLOC_DEFINE()

static MALLOC_DEFINE ( M_XENBLOCKBACK  ,
"xbbd"  ,
"Xen Block Back Driver Data"   
)
static

Define to enable rudimentary request logging to the console.

Custom malloc type for all driver allocations.

◆ SDT_PROBE_DEFINE1() [1/2]

SDT_PROBE_DEFINE1 ( xbb  ,
kernel  ,
xbb_dispatch_dev  ,
flush  ,
"int"   
)

◆ SDT_PROBE_DEFINE1() [2/2]

SDT_PROBE_DEFINE1 ( xbb  ,
kernel  ,
xbb_dispatch_file  ,
flush  ,
"int"   
)

◆ SDT_PROBE_DEFINE3() [1/4]

SDT_PROBE_DEFINE3 ( xbb  ,
kernel  ,
xbb_dispatch_dev  ,
read  ,
"int"  ,
"uint64_t"  ,
"uint64_t"   
)

◆ SDT_PROBE_DEFINE3() [2/4]

SDT_PROBE_DEFINE3 ( xbb  ,
kernel  ,
xbb_dispatch_dev  ,
write  ,
"int"  ,
"uint64_t"  ,
"uint64_t"   
)

◆ SDT_PROBE_DEFINE3() [3/4]

SDT_PROBE_DEFINE3 ( xbb  ,
kernel  ,
xbb_dispatch_file  ,
read  ,
"int"  ,
"uint64_t"  ,
"uint64_t"   
)

◆ SDT_PROBE_DEFINE3() [4/4]

SDT_PROBE_DEFINE3 ( xbb  ,
kernel  ,
xbb_dispatch_file  ,
write  ,
"int"  ,
"uint64_t"  ,
"uint64_t"   
)

◆ SDT_PROVIDER_DEFINE()

SDT_PROVIDER_DEFINE ( xbb  )

◆ SLIST_HEAD()

SLIST_HEAD ( xbb_xen_req_slist  ,
xbb_xen_req   
)

◆ STAILQ_HEAD() [1/2]

STAILQ_HEAD ( xbb_xen_req_list  ,
xbb_xen_req   
)

◆ STAILQ_HEAD() [2/2]

STAILQ_HEAD ( xbb_xen_reqlist_list  ,
xbb_xen_reqlist   
)

◆ xbb_alloc_communication_mem()

static int xbb_alloc_communication_mem ( struct xbb_softc xbb)
static

Size KVA and pseudo-physical address allocations based on negotiated values for the size and number of I/O requests, and the size of our communication ring.

Parameters
xbbPer-instance xbb configuration structure.

These address spaces are used to dynamically map pages in the front-end's domain into our own.

Definition at line 2987 of file blkback.c.

References xbb_softc::dev, DPRINTF, xbb_softc::gnt_base_addr, xbb_softc::kva, xbb_softc::kva_free, xbb_softc::kva_size, xbb_softc::max_request_segments, xbb_softc::max_requests, xbb_softc::pseudo_phys_res, xbb_softc::pseudo_phys_res_id, xbb_softc::reqlist_kva_pages, xbb_softc::reqlist_kva_size, xbb_softc::ring_config, xbb_ring_config::ring_pages, and xenmem_alloc().

Referenced by xbb_connect().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xbb_alloc_request_lists()

◆ xbb_alloc_requests()

static int xbb_alloc_requests ( struct xbb_softc xbb)
static

Allocate per-request data structures given request size and number information negotiated with the front-end.

Parameters
xbbPer-instance xbb configuration structure.

Definition at line 3160 of file blkback.c.

References xbb_softc::dev, xbb_softc::max_requests, xbb_softc::request_free_stailq, and xbb_softc::requests.

Referenced by xbb_connect().

Here is the caller graph for this function:

◆ xbb_attach()

static int xbb_attach ( device_t  dev)
static

Attach to a XenBus device that has been claimed by our probe routine.

Parameters
devNewBus device object representing this Xen Block Back instance.
Returns
0 for success, errno codes for failure.

Definition at line 3718 of file blkback.c.

References xbb_softc::dev, DPRINTF, xbb_softc::hotplug_done, xbb_softc::hotplug_watch, xbb_softc::io_task, xbb_softc::lock, xbb_softc::otherend_id, xbb_attach_cb(), xbb_attach_disk(), xbb_attach_failed(), XBB_MAX_RING_PAGES, xbb_run_queue(), xs_join(), xs_printf(), and xs_register_watch().

Here is the call graph for this function:

◆ xbb_attach_cb()

static void xbb_attach_cb ( struct xs_watch watch,
const char **  vec,
unsigned int  len 
)
static

Definition at line 3674 of file blkback.c.

References xbb_softc::dev, xbb_softc::dev_mode, xbb_softc::dev_name, xbb_softc::dev_type, xbb_softc::hotplug_done, xbb_attach_disk(), xbb_attach_failed(), xs_gather(), and xs_unregister_watch().

Referenced by xbb_attach().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xbb_attach_disk()

static void xbb_attach_disk ( device_t  dev)
static

◆ xbb_attach_failed()

static void xbb_attach_failed ( struct xbb_softc xbb,
int  err,
const char *  fmt,
  ... 
)
static

Report an attach time error to the console and Xen, and cleanup this instance by forcing immediate detach processing.

Parameters
xbbPer-instance xbb configuration structure.
errErrno describing the error.
fmtPrintf style format and arguments

Definition at line 3461 of file blkback.c.

References xbb_softc::dev, xbb_softc::lock, xbb_shutdown(), xs_printf(), and xs_vprintf().

Referenced by xbb_attach(), xbb_attach_cb(), and xbb_attach_disk().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xbb_bio_done()

static void xbb_bio_done ( struct bio *  bio)
static

Completion handler for buffer I/O requests issued by the device backend driver.

Parameters
bioThe buffer I/O request on which to perform completion processing.

Definition at line 1469 of file blkback.c.

References xbb_xen_reqlist::bounce, xbb_softc::dev, xbb_softc::dev_name, DPRINTF, xbb_xen_reqlist::kva, xbb_xen_reqlist::pendcnt, xbb_xen_reqlist::residual_512b_sectors, xbb_xen_reqlist::status, xbb_xen_reqlist::xbb, and xbb_complete_reqlist().

Referenced by xbb_dispatch_dev().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xbb_close_backend()

static void xbb_close_backend ( struct xbb_softc xbb)
static

Close and cleanup any backend device/file specific state for this block back instance.

Parameters
xbbPer-instance xbb configuration structure.

Definition at line 2469 of file blkback.c.

References xbb_softc::backend, xbb_dev_data::cdev, xbb_file_data::cred, xbb_dev_data::csw, xbb_backend_data::dev, xbb_softc::dev_name, xbb_dev_data::dev_ref, xbb_softc::device_type, DPRINTF, xbb_backend_data::file, xbb_softc::flags, xbb_softc::vn, XBB_TYPE_DISK, XBB_TYPE_FILE, XBB_TYPE_NONE, and XBBF_READ_ONLY.

Referenced by xbb_detach(), and xbb_open_backend().

Here is the caller graph for this function:

◆ xbb_collect_frontend_info()

static int xbb_collect_frontend_info ( struct xbb_softc xbb)
static

Collect front-end information from the XenStore.

Parameters
xbbPer-instance xbb configuration structure.

Definition at line 3029 of file blkback.c.

References xbb_softc::abi, xbb_softc::dev, xbb_ring_config::evtchn, xbb_softc::max_request_segments, xbb_softc::max_request_size, xbb_softc::max_requests, xbb_softc::ring_config, xbb_ring_config::ring_pages, xbb_ring_config::ring_ref, XBB_MAX_RING_PAGES, xs_gather(), and xs_scanf().

Referenced by xbb_connect().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xbb_complete_reqlist()

static void xbb_complete_reqlist ( struct xbb_softc xbb,
struct xbb_xen_reqlist reqlist 
)
static

◆ xbb_connect()

static void xbb_connect ( struct xbb_softc xbb)
static

Connect to our blkfront peer now that it has completed publishing its configuration into the XenStore.

Parameters
xbbPer-instance xbb configuration structure.

Definition at line 3308 of file blkback.c.

References xbb_softc::dev, xbb_softc::flags, xbb_softc::hotplug_done, xbb_softc::max_reqlist_segments, xbb_softc::max_reqlist_size, xbb_softc::max_request_segments, xbb_softc::max_requests, xbb_alloc_communication_mem(), xbb_alloc_request_lists(), xbb_alloc_requests(), xbb_collect_frontend_info(), xbb_connect_ring(), xbb_disconnect(), XBB_MAX_SEGMENTS_PER_REQLIST, and xbb_publish_backend_info().

Referenced by xbb_attach_disk(), and xbb_frontend_changed().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xbb_connect_ring()

static int xbb_connect_ring ( struct xbb_softc xbb)
static

Map shared memory ring into domain local address space, initialize ring control structures, and bind an interrupt to the event channel used to notify us of ring changes.

Parameters
xbbPer-instance xbb configuration structure.

Definition at line 2854 of file blkback.c.

References xbb_softc::abi, xbb_ring_config::bus_addr, xbb_softc::dev, DPRINTF, xbb_ring_config::evtchn, xbb_softc::flags, xbb_ring_config::gnt_addr, xbb_softc::gnt_base_addr, xbb_ring_config::handle, xbb_softc::kva, xbb_softc::kva_size, xbb_softc::otherend_id, xbb_softc::ring_config, xbb_ring_config::ring_pages, xbb_ring_config::ring_ref, xbb_softc::rings, xbb_ring_config::va, xbb_disconnect(), xbb_filter(), XBB_MAX_RING_PAGES, XBBF_RING_CONNECTED, and xbb_softc::xen_intr_handle.

Referenced by xbb_connect().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xbb_count_sects()

static __inline int xbb_count_sects ( blkif_request_t *  ring_req)
static

Definition at line 1785 of file blkback.c.

Referenced by xbb_run_queue().

Here is the caller graph for this function:

◆ xbb_detach()

static int xbb_detach ( device_t  dev)
static

Detach from a block back device instance.

Parameters
devNewBus device object representing this Xen Block Back instance.
Returns
0 for success, errno codes for failure.
Note
A block back device may be detached at any time in its life-cycle, including part way through the attach process. For this reason, initialization order and the initialization state checks in this routine must be carefully coupled so that attach time failures are gracefully handled.

Definition at line 3816 of file blkback.c.

References xbb_softc::dev, xbb_softc::dev_mode, xbb_softc::dev_name, xbb_softc::dev_type, DPRINTF, xbb_softc::io_taskqueue, xbb_softc::lock, xbb_close_backend(), xbb_shutdown(), xbb_softc::xbb_stats, and xbb_softc::xbb_stats_in.

Here is the call graph for this function:

◆ xbb_disconnect()

static int xbb_disconnect ( struct xbb_softc xbb)
static

◆ xbb_dispatch_dev()

static int xbb_dispatch_dev ( struct xbb_softc xbb,
struct xbb_xen_reqlist reqlist,
int  operation,
int  bio_flags 
)
static

Backend handler for character device access.

Parameters
xbbPer-instance xbb configuration structure.
reqlistAllocated internal request list structure.
operationBIO_* I/O operation code.
bio_flagsAdditional bio_flag data to pass to any generated bios (e.g. BIO_ORDERED)..
Returns
0 for success, errno codes for failure.

Definition at line 2059 of file blkback.c.

References xbb_softc::backend, xbb_xen_reqlist::bounce, xbb_dev_data::cdev, xbb_dev_data::csw, xbb_backend_data::dev, xbb_softc::dev, DPRINTF, xbb_sg::first_sect, xbb_xen_reqlist::kva, xbb_sg::last_sect, xbb_xen_reqlist::nr_segments, xbb_sg::nsect, xbb_softc::otherend_id, xbb_xen_reqlist::pendcnt, xbb_softc::sector_size, xbb_softc::sector_size_shift, xbb_xen_reqlist::starting_sector_number, xbb_bio_done(), xbb_dispatch_dev(), XBB_MAX_SEGMENTS_PER_REQLIST, xbb_reqlist_ioaddr(), and xbb_softc::xbb_sgs.

Referenced by xbb_dispatch_dev(), and xbb_open_dev().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xbb_dispatch_file()

static int xbb_dispatch_file ( struct xbb_softc xbb,
struct xbb_xen_reqlist reqlist,
int  operation,
int  flags 
)
static

Backend handler for file access.

Parameters
xbbPer-instance xbb configuration structure.
reqlistAllocated internal request list.
operationBIO_* I/O operation code.
flagsAdditional bio_flag data to pass to any generated bios (e.g. BIO_ORDERED)..
Returns
0 for success, errno codes for failure.

Definition at line 2235 of file blkback.c.

References xbb_softc::backend, xbb_file_data::cred, xbb_softc::dev, xbb_backend_data::file, xbb_sg::first_sect, xbb_sg::last_sect, xbb_xen_reqlist::nr_segments, xbb_sg::nsect, xbb_file_data::saved_xiovecs, xbb_softc::sector_size_shift, xbb_xen_reqlist::starting_sector_number, xbb_xen_reqlist::status, xbb_softc::vn, xbb_complete_reqlist(), xbb_dispatch_file(), xbb_reqlist_ioaddr(), xbb_reqlist_vaddr(), xbb_softc::xbb_sgs, xbb_file_data::xiovecs, and xbb_file_data::xiovecs_vaddr.

Referenced by xbb_dispatch_file(), and xbb_open_file().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xbb_dispatch_io()

static int xbb_dispatch_io ( struct xbb_softc xbb,
struct xbb_xen_reqlist reqlist 
)
static

Parse a blkif request into an internal request structure and send it to the backend for processing.

Parameters
xbbPer-instance xbb configuration structure.
reqlistAllocated internal request list structure.
Returns
On success, 0. For resource shortages, non-zero.

This routine performs the backend common aspects of request parsing including compiling an internal request structure, parsing the S/G list and any secondary ring requests in which they may reside, and the mapping of front-end I/O pages into our domain.

Definition at line 1547 of file blkback.c.

References xbb_xen_reqlist::contig_req_list, xbb_softc::dev, xbb_softc::dev_name, xbb_softc::disable_flush, xbb_softc::dispatch_io, DPRINTF, xbb_xen_reqlist::ds_t0, xbb_xen_reqlist::ds_tag_type, xbb_xen_reqlist::ds_trans_type, xbb_sg::first_sect, xbb_xen_reqlist::flags, xbb_softc::flags, xbb_softc::flush_count, xbb_softc::flush_interval, xbb_ring_config::gnt_addr, xbb_xen_reqlist::gnt_handles, xbb_xen_reqlist::kva, xbb_sg::last_sect, xbb_softc::maps, xbb_softc::max_request_segments, xbb_softc::media_num_sectors, xbb_xen_reqlist::nr_segments, xbb_sg::nsect, xbb_xen_reqlist::operation, xbb_softc::otherend_id, xbb_softc::ring_config, xbb_softc::sector_size, xbb_softc::sector_size_shift, xbb_xen_reqlist::starting_sector_number, xbb_xen_reqlist::status, xbb_xen_reqlist::xbb, xbb_complete_reqlist(), xbb_get_gntaddr(), xbb_get_kva(), XBB_MAX_SEGMENTS_PER_REQLIST, XBB_REQLIST_MAPPED, xbb_softc::xbb_sgs, xbb_softc::xbb_stats, and XBBF_READ_ONLY.

Referenced by xbb_run_queue().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xbb_filter()

static int xbb_filter ( void *  arg)
static

Interrupt handler bound to the shared ring's event channel.

Parameters
argCallback argument registerd during event channel binding - the xbb_softc for this instance.

Definition at line 2028 of file blkback.c.

References xbb_softc::io_task, and xbb_softc::io_taskqueue.

Referenced by xbb_connect_ring().

Here is the caller graph for this function:

◆ xbb_free_communication_mem()

static void xbb_free_communication_mem ( struct xbb_softc xbb)
static

Free dynamically allocated KVA or pseudo-physical address allocations.

Parameters
xbbPer-instance xbb configuration structure.

Definition at line 2752 of file blkback.c.

References xbb_softc::dev, xbb_softc::gnt_base_addr, xbb_softc::kva, xbb_softc::kva_free, xbb_softc::pseudo_phys_res, xbb_softc::pseudo_phys_res_id, and xenmem_free().

Referenced by xbb_disconnect().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xbb_free_kva()

static void xbb_free_kva ( struct xbb_softc xbb,
uint8_t *  kva_ptr,
int  nr_pages 
)
static

Free allocated KVA.

Parameters
xbbPer-instance xbb configuration structure.
kva_ptrPointer to allocated KVA region.
nr_pagesNumber of pages in the KVA region.

Definition at line 1068 of file blkback.c.

References xbb_softc::kva, xbb_softc::kva_free, and xbb_softc::lock.

Referenced by xbb_release_reqlist().

Here is the caller graph for this function:

◆ xbb_frontend_changed()

static void xbb_frontend_changed ( device_t  dev,
XenbusState  frontend_state 
)
static

Handle state changes expressed via the XenStore by our front-end peer.

Parameters
devNewBus device object representing this Xen Block Back instance.
frontend_stateThe new state of the front-end.
Returns
0 for success, errno codes for failure.

Definition at line 3907 of file blkback.c.

References xbb_softc::dev, DPRINTF, xbb_softc::lock, xbb_connect(), and xbb_shutdown().

Here is the call graph for this function:

◆ xbb_get_gntaddr()

static uintptr_t xbb_get_gntaddr ( struct xbb_xen_reqlist reqlist,
int  pagenr,
int  sector 
)
inlinestatic

Given a page index and 512b sector offset within that page, calculate an offset into the local pseudo-physical address space used to map a front-end's request data into a request.

Parameters
reqlistThe request list structure whose pseudo-physical region will be accessed.
pagenrThe page index used to compute the pseudo-physical offset.
sectorThe 512b sector index used to compute the page relative pseudo-physical offset.
Returns
The computed global pseudo-phsyical address.

Depending on configuration, this will either be a local bounce buffer or a pointer to the memory mapped in from the front-end domain for this request.

Definition at line 957 of file blkback.c.

References xbb_softc::gnt_base_addr, xbb_xen_reqlist::kva, xbb_softc::kva, and xbb_xen_reqlist::xbb.

Referenced by xbb_dispatch_io(), and xbb_unmap_reqlist().

Here is the caller graph for this function:

◆ xbb_get_kva()

static uint8_t * xbb_get_kva ( struct xbb_softc xbb,
int  nr_pages 
)
static

Get Kernel Virtual Address space for mapping requests.

Parameters
xbbPer-instance xbb configuration structure.
nr_pagesNumber of pages needed.
check_onlyIf set, check for free KVA but don't allocate it.
have_lockIf set, xbb lock is already held.
Returns
On success, a pointer to the allocated KVA region. Otherwise NULL.

Note: This should be unnecessary once we have either chaining or scatter/gather support for struct bio. At that point we'll be able to put multiple addresses and lengths in one bio/bio chain and won't need to map everything into one virtual segment.

Definition at line 984 of file blkback.c.

References xbb_softc::flags, xbb_softc::kva, xbb_softc::kva_free, xbb_softc::kva_shortages, xbb_softc::lock, xbb_softc::reqlist_kva_pages, xbb_softc::ring_config, xbb_ring_config::va, and XBBF_RESOURCE_SHORTAGE.

Referenced by xbb_dispatch_io().

Here is the caller graph for this function:

◆ xbb_get_req()

static struct xbb_xen_req * xbb_get_req ( struct xbb_softc xbb)
inlinestatic

Allocate an internal transaction tracking structure from the free pool.

Parameters
xbbPer-instance xbb configuration structure.
Returns
On success, a pointer to the allocated xbb_xen_req structure. Otherwise NULL.

Definition at line 823 of file blkback.c.

References xbb_softc::active_request_count, xbb_softc::lock, and xbb_softc::request_free_stailq.

Referenced by xbb_get_resources().

Here is the caller graph for this function:

◆ xbb_get_reqlist()

static struct xbb_xen_reqlist * xbb_get_reqlist ( struct xbb_softc xbb)
inlinestatic

Allocate an internal transaction tracking structure from the free pool.

Parameters
xbbPer-instance xbb configuration structure.
Returns
On success, a pointer to the allocated xbb_xen_reqlist structure. Otherwise NULL.

Definition at line 1118 of file blkback.c.

References xbb_xen_reqlist::contig_req_list, xbb_xen_reqlist::flags, xbb_xen_reqlist::kva, xbb_softc::lock, xbb_xen_reqlist::nr_segments, xbb_xen_reqlist::num_children, xbb_softc::reqlist_free_stailq, xbb_xen_reqlist::residual_512b_sectors, xbb_xen_reqlist::status, xbb_xen_reqlist::xbb, and XBB_REQLIST_NONE.

Referenced by xbb_get_resources().

Here is the caller graph for this function:

◆ xbb_get_resources()

static int xbb_get_resources ( struct xbb_softc xbb,
struct xbb_xen_reqlist **  reqlist,
blkif_request_t *  ring_req,
RING_IDX  ring_idx 
)
static

Request resources and do basic request setup.

Parameters
xbbPer-instance xbb configuration structure.
reqlistPointer to reqlist pointer.
ring_reqPointer to a block ring request.
ring_indexThe ring index of this request.
Returns
0 for success, non-zero for failure.

Definition at line 1192 of file blkback.c.

References xbb_softc::abi, xbb_softc::flags, xbb_softc::lock, xbb_xen_reqlist::operation, xbb_softc::reqlist_pending_stailq, xbb_softc::request_shortages, xbb_xen_reqlist::starting_sector_number, xbb_get_req(), xbb_get_reqlist(), xbb_release_req(), xbb_release_reqlist(), xbb_softc::xbb_stats_in, XBBF_RESOURCE_SHORTAGE, and XBBF_SHUTDOWN.

Referenced by xbb_run_queue().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xbb_open_backend()

static int xbb_open_backend ( struct xbb_softc xbb)
static

Open the backend provider for this connection.

Parameters
xbbPer-instance xbb configuration structure.
Returns
0 for success, errno codes for failure.

Definition at line 2661 of file blkback.c.

References xbb_softc::dev, xbb_softc::dev_name, xbb_softc::device_type, DPRINTF, xbb_softc::flags, xbb_softc::media_num_sectors, xbb_softc::media_size, xbb_softc::sector_size, xbb_softc::sector_size_shift, xbb_softc::vn, xbb_close_backend(), xbb_open_dev(), xbb_open_file(), XBB_TYPE_DISK, and XBBF_READ_ONLY.

Referenced by xbb_attach_disk().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xbb_open_dev()

static int xbb_open_dev ( struct xbb_softc xbb)
static

Open a character device to be used for backend I/O.

Parameters
xbbPer-instance xbb configuration structure.
Returns
0 for success, errno codes for failure.

Definition at line 2525 of file blkback.c.

References xbb_softc::backend, xbb_dev_data::cdev, xbb_dev_data::csw, xbb_backend_data::dev, xbb_softc::dev, xbb_softc::dev_name, xbb_dev_data::dev_ref, xbb_softc::device_type, xbb_softc::dispatch_io, xbb_softc::media_size, xbb_softc::sector_size, xbb_softc::vn, xbb_dispatch_dev(), and XBB_TYPE_DISK.

Referenced by xbb_open_backend().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xbb_open_file()

static int xbb_open_file ( struct xbb_softc xbb)
static

Open a file to be used for backend I/O.

Parameters
xbbPer-instance xbb configuration structure.
Returns
0 for success, errno codes for failure.

Definition at line 2587 of file blkback.c.

References xbb_softc::backend, xbb_file_data::cred, xbb_softc::dev, xbb_softc::dev_name, xbb_softc::device_type, xbb_softc::dispatch_io, xbb_backend_data::file, xbb_softc::media_size, xbb_softc::sector_size, xbb_softc::vn, xbb_dispatch_file(), and XBB_TYPE_FILE.

Referenced by xbb_open_backend().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xbb_probe()

static int xbb_probe ( device_t  dev)
static

Inspect a XenBus device and claim it if is of the appropriate type.

Parameters
devNewBus device object representing a candidate XenBus device.
Returns
0 for success, errno codes for failure.

Definition at line 3493 of file blkback.c.

◆ xbb_publish_backend_info()

static int xbb_publish_backend_info ( struct xbb_softc xbb)
static

Supply information about the physical device to the frontend via XenBus.

Parameters
xbbPer-instance xbb configuration structure.

Definition at line 3249 of file blkback.c.

References xbb_softc::dev, xbb_softc::flags, xbb_softc::media_num_sectors, xbb_softc::sector_size, XBBF_READ_ONLY, xs_printf(), xs_transaction_end(), and xs_transaction_start().

Referenced by xbb_connect().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xbb_push_responses()

static void xbb_push_responses ( struct xbb_softc xbb,
int *  run_taskqueue,
int *  notify 
)
static

Send queued responses to blkif requests.

Parameters
xbbPer-instance xbb configuration structure.
run_taskqueueFlag that is set to 1 if the taskqueue should be run, 0 if it does not need to be run.
notifyFlag that is set to 1 if the other end should be notified via irq, 0 if the other end should not be notified.

Definition at line 1351 of file blkback.c.

References xbb_softc::lock, notify(), xbb_softc::reqs_completed, xbb_softc::reqs_queued_for_completion, and xbb_softc::rings.

Referenced by xbb_complete_reqlist().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xbb_queue_response()

static void xbb_queue_response ( struct xbb_softc xbb,
struct xbb_xen_req req,
int  status 
)
static

Create and queue a response to a blkif request.

Parameters
xbbPer-instance xbb configuration structure.
reqThe request structure to which to respond.
statusThe status code to report. See BLKIF_RSP_* in sys/contrib/xen/io/blkif.h.

Definition at line 1286 of file blkback.c.

References xbb_softc::abi, xbb_softc::lock, xbb_softc::reqs_completed_with_error, xbb_softc::reqs_queued_for_completion, and xbb_softc::rings.

Referenced by xbb_complete_reqlist().

Here is the caller graph for this function:

◆ xbb_release_req()

static void xbb_release_req ( struct xbb_softc xbb,
struct xbb_xen_req req 
)
inlinestatic

Return an allocated transaction tracking structure to the free pool.

Parameters
xbbPer-instance xbb configuration structure.
reqThe request structure to free.

Definition at line 846 of file blkback.c.

References xbb_softc::active_request_count, xbb_softc::lock, and xbb_softc::request_free_stailq.

Referenced by xbb_get_resources().

Here is the caller graph for this function:

◆ xbb_release_reqlist()

static void xbb_release_reqlist ( struct xbb_softc xbb,
struct xbb_xen_reqlist reqlist,
int  wakeup 
)
inlinestatic

Return an allocated transaction tracking structure to the free pool.

Parameters
xbbPer-instance xbb configuration structure.
reqThe request list structure to free.
wakeupIf set, wakeup the work thread if freeing this reqlist during a resource shortage condition.

Definition at line 1149 of file blkback.c.

References xbb_xen_reqlist::contig_req_list, xbb_softc::flags, xbb_softc::io_task, xbb_softc::io_taskqueue, xbb_xen_reqlist::kva, xbb_softc::lock, xbb_xen_reqlist::nr_segments, xbb_xen_reqlist::num_children, xbb_softc::reqlist_free_stailq, xbb_xen_reqlist::xbb, xbb_free_kva(), xbb_release_reqs(), xbb_shutdown(), XBBF_RESOURCE_SHORTAGE, and XBBF_SHUTDOWN.

Referenced by xbb_complete_reqlist(), and xbb_get_resources().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xbb_release_reqs()

static void xbb_release_reqs ( struct xbb_softc xbb,
struct xbb_xen_req_list *  req_list,
int  nreqs 
)
inlinestatic

Return an xbb_xen_req_list of allocated xbb_xen_reqs to the free pool.

Parameters
xbbPer-instance xbb configuration structure.
req_listThe list of requests to free.
nreqsThe number of items in the list.

Definition at line 865 of file blkback.c.

References xbb_softc::active_request_count, xbb_softc::lock, and xbb_softc::request_free_stailq.

Referenced by xbb_release_reqlist().

Here is the caller graph for this function:

◆ xbb_reqlist_bounce_addr()

static uint8_t * xbb_reqlist_bounce_addr ( struct xbb_xen_reqlist reqlist,
int  pagenr,
int  sector 
)
inlinestatic

Given a page index and 512b sector offset within that page, calculate an offset into a request's local bounce memory region.

Parameters
reqlistThe request structure whose bounce region will be accessed.
pagenrThe page index used to compute the bounce offset.
sectorThe 512b sector index used to compute the page relative bounce offset.
Returns
The computed global bounce buffer address.

Definition at line 907 of file blkback.c.

References xbb_xen_reqlist::bounce.

Referenced by xbb_reqlist_ioaddr().

Here is the caller graph for this function:

◆ xbb_reqlist_ioaddr()

static uint8_t * xbb_reqlist_ioaddr ( struct xbb_xen_reqlist reqlist,
int  pagenr,
int  sector 
)
inlinestatic

Given a page number and 512b sector offset within that page, calculate an offset into the request's memory region that the underlying backend device/file should use for I/O.

Parameters
reqlistThe request structure whose I/O region will be accessed.
pagenrThe page index used to compute the I/O offset.
sectorThe 512b sector index used to compute the page relative I/O offset.
Returns
The computed global I/O address.

Depending on configuration, this will either be a local bounce buffer or a pointer to the memory mapped in from the front-end domain for this request.

Definition at line 930 of file blkback.c.

References xbb_reqlist_bounce_addr(), and xbb_reqlist_vaddr().

Referenced by xbb_dispatch_dev(), and xbb_dispatch_file().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xbb_reqlist_vaddr()

static uint8_t * xbb_reqlist_vaddr ( struct xbb_xen_reqlist reqlist,
int  pagenr,
int  sector 
)
inlinestatic

Given a page index and 512b sector offset within that page, calculate an offset into a request's kva region.

Parameters
reqlistThe request structure whose kva region will be accessed.
pagenrThe page index used to compute the kva offset.
sectorThe 512b sector index used to compute the page relative kva offset.
Returns
The computed global KVA offset.

Definition at line 889 of file blkback.c.

References xbb_xen_reqlist::kva.

Referenced by xbb_dispatch_file(), and xbb_reqlist_ioaddr().

Here is the caller graph for this function:

◆ xbb_resume()

static int xbb_resume ( device_t  dev)
static

Perform any processing required to recover from a suspended state.

Parameters
devNewBus device object representing this Xen Block Back instance.
Returns
0 for success, errno codes for failure.

Definition at line 3892 of file blkback.c.

◆ xbb_run_queue()

static void xbb_run_queue ( void *  context,
int  pending 
)
static

Process incoming requests from the shared communication ring in response to a signal on the ring's event channel.

Parameters
contextCallback argument registerd during task initialization - the xbb_softc for this instance.
pendingThe number of taskqueue_enqueue events that have occurred since this handler was last run.

Run so long as there is work to consume and the generation of a response will not overflow the ring.

Note
There's a 1 to 1 relationship between requests and responses, so an overflow should never occur. This test is to protect our domain from digesting bogus data. Shouldn't we log this?

Definition at line 1814 of file blkback.c.

References xbb_softc::abi, xbb_softc::forced_dispatch, xbb_softc::max_reqlist_segments, xbb_xen_reqlist::next_contig_sector, xbb_softc::no_coalesce_reqs, xbb_softc::normal_dispatch, xbb_xen_reqlist::nr_segments, xbb_xen_reqlist::operation, xbb_softc::reqlist_pending_stailq, xbb_softc::reqs_received, xbb_softc::rings, xbb_softc::total_dispatch, xbb_xen_reqlist::xbb, xbb_count_sects(), xbb_dispatch_io(), and xbb_get_resources().

Referenced by xbb_attach().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xbb_setup_sysctl()

◆ xbb_shutdown()

static int xbb_shutdown ( struct xbb_softc xbb)
static

Perform device shutdown functions.

Parameters
xbbPer-instance xbb configuration structure.

Mark this instance as shutting down, wait for any active I/O on the backend device/file to drain, disconnect from the front-end, and notify any waiters (e.g. a thread invoking our detach method) that detach can now proceed.

Definition at line 3388 of file blkback.c.

References xbb_softc::dev, DPRINTF, xbb_softc::flags, xbb_softc::hotplug_watch, xbb_softc::lock, xbb_disconnect(), XBBF_IN_SHUTDOWN, XBBF_SHUTDOWN, and xs_unregister_watch().

Referenced by xbb_attach_failed(), xbb_detach(), xbb_frontend_changed(), and xbb_release_reqlist().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xbb_suspend()

static int xbb_suspend ( device_t  dev)
static

Prepare this block back device for suspension of this VM.

Parameters
devNewBus device object representing this Xen Block Back instance.
Returns
0 for success, errno codes for failure.

Definition at line 3870 of file blkback.c.

References xbb_softc::dev.

◆ xbb_unmap_reqlist()

static void xbb_unmap_reqlist ( struct xbb_xen_reqlist reqlist)
static

Unmap the front-end pages associated with this I/O request.

Parameters
reqThe request structure to unmap.

Definition at line 1085 of file blkback.c.

References xbb_xen_reqlist::gnt_handles, xbb_xen_reqlist::nr_segments, xbb_get_gntaddr(), and XBB_MAX_SEGMENTS_PER_REQLIST.

Referenced by xbb_complete_reqlist().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ xbb_devclass

devclass_t xbb_devclass

Definition at line 3957 of file blkback.c.

◆ xbb_driver

driver_t xbb_driver
static
Initial value:
= {
"xbbd",
sizeof(struct xbb_softc),
}
static device_method_t xbb_methods[]
Definition: blkback.c:3938

Definition at line 3952 of file blkback.c.

◆ xbb_methods

device_method_t xbb_methods[]
static
Initial value:
= {
DEVMETHOD(device_probe, xbb_probe),
DEVMETHOD(device_attach, xbb_attach),
DEVMETHOD(device_detach, xbb_detach),
DEVMETHOD(device_shutdown, bus_generic_shutdown),
DEVMETHOD(device_suspend, xbb_suspend),
DEVMETHOD(device_resume, xbb_resume),
DEVMETHOD(xenbus_otherend_changed, xbb_frontend_changed),
{ 0, 0 }
}
static int xbb_suspend(device_t dev)
Definition: blkback.c:3870
static int xbb_attach(device_t dev)
Definition: blkback.c:3718
static void xbb_frontend_changed(device_t dev, XenbusState frontend_state)
Definition: blkback.c:3907
static int xbb_detach(device_t dev)
Definition: blkback.c:3816
static int xbb_resume(device_t dev)
Definition: blkback.c:3892
static int xbb_probe(device_t dev)
Definition: blkback.c:3493

Definition at line 3938 of file blkback.c.