/******************************************************************************1* blkif.h2*3* Unified block-device I/O interface for Xen guest OSes.4*5* Permission is hereby granted, free of charge, to any person obtaining a copy6* of this software and associated documentation files (the "Software"), to7* deal in the Software without restriction, including without limitation the8* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or9* sell copies of the Software, and to permit persons to whom the Software is10* furnished to do so, subject to the following conditions:11*12* The above copyright notice and this permission notice shall be included in13* all copies or substantial portions of the Software.14*15* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR16* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,17* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE18* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER19* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING20* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER21* DEALINGS IN THE SOFTWARE.22*23* Copyright (c) 2003-2004, Keir Fraser24* Copyright (c) 2012, Spectra Logic Corporation25*/2627#ifndef __XEN_PUBLIC_IO_BLKIF_H__28#define __XEN_PUBLIC_IO_BLKIF_H__2930#include "ring.h"31#include "../grant_table.h"3233/*34* Front->back notifications: When enqueuing a new request, sending a35* notification can be made conditional on req_event (i.e., the generic36* hold-off mechanism provided by the ring macros). Backends must set37* req_event appropriately (e.g., using RING_FINAL_CHECK_FOR_REQUESTS()).38*39* Back->front notifications: When enqueuing a new response, sending a40* notification can be made conditional on rsp_event (i.e., the generic41* hold-off mechanism provided by the ring macros). Frontends must set42* rsp_event appropriately (e.g., using RING_FINAL_CHECK_FOR_RESPONSES()).43*/4445#ifndef blkif_vdev_t46#define blkif_vdev_t uint16_t47#endif48#define blkif_sector_t uint64_t4950/*51* Feature and Parameter Negotiation52* =================================53* The two halves of a Xen block driver utilize nodes within the XenStore to54* communicate capabilities and to negotiate operating parameters. This55* section enumerates these nodes which reside in the respective front and56* backend portions of the XenStore, following the XenBus convention.57*58* All data in the XenStore is stored as strings. Nodes specifying numeric59* values are encoded in decimal. Integer value ranges listed below are60* expressed as fixed sized integer types capable of storing the conversion61* of a properly formated node string, without loss of information.62*63* Any specified default value is in effect if the corresponding XenBus node64* is not present in the XenStore.65*66* XenStore nodes in sections marked "PRIVATE" are solely for use by the67* driver side whose XenBus tree contains them.68*69* XenStore nodes marked "DEPRECATED" in their notes section should only be70* used to provide interoperability with legacy implementations.71*72* See the XenBus state transition diagram below for details on when XenBus73* nodes must be published and when they can be queried.74*75*****************************************************************************76* Backend XenBus Nodes77*****************************************************************************78*79*------------------ Backend Device Identification (PRIVATE) ------------------80*81* mode82* Values: "r" (read only), "w" (writable)83*84* The read or write access permissions to the backing store to be85* granted to the frontend.86*87* params88* Values: string89*90* A free formatted string providing sufficient information for the91* hotplug script to attach the device and provide a suitable92* handler (ie: a block device) for blkback to use.93*94* physical-device95* Values: "MAJOR:MINOR"96* Notes: 1197*98* MAJOR and MINOR are the major number and minor number of the99* backing device respectively.100*101* physical-device-path102* Values: path string103*104* A string that contains the absolute path to the disk image. On105* NetBSD and Linux this is always a block device, while on FreeBSD106* it can be either a block device or a regular file.107*108* type109* Values: "file", "phy", "tap"110*111* The type of the backing device/object.112*113*114* direct-io-safe115* Values: 0/1 (boolean)116* Default Value: 0117*118* The underlying storage is not affected by the direct IO memory119* lifetime bug. See:120* https://lists.xen.org/archives/html/xen-devel/2012-12/msg01154.html121*122* Therefore this option gives the backend permission to use123* O_DIRECT, notwithstanding that bug.124*125* That is, if this option is enabled, use of O_DIRECT is safe,126* in circumstances where we would normally have avoided it as a127* workaround for that bug. This option is not relevant for all128* backends, and even not necessarily supported for those for129* which it is relevant. A backend which knows that it is not130* affected by the bug can ignore this option.131*132* This option doesn't require a backend to use O_DIRECT, so it133* should not be used to try to control the caching behaviour.134*135*--------------------------------- Features ---------------------------------136*137* feature-barrier138* Values: 0/1 (boolean)139* Default Value: 0140*141* A value of "1" indicates that the backend can process requests142* containing the BLKIF_OP_WRITE_BARRIER request opcode. Requests143* of this type may still be returned at any time with the144* BLKIF_RSP_EOPNOTSUPP result code.145*146* feature-flush-cache147* Values: 0/1 (boolean)148* Default Value: 0149*150* A value of "1" indicates that the backend can process requests151* containing the BLKIF_OP_FLUSH_DISKCACHE request opcode. Requests152* of this type may still be returned at any time with the153* BLKIF_RSP_EOPNOTSUPP result code.154*155* feature-discard156* Values: 0/1 (boolean)157* Default Value: 0158*159* A value of "1" indicates that the backend can process requests160* containing the BLKIF_OP_DISCARD request opcode. Requests161* of this type may still be returned at any time with the162* BLKIF_RSP_EOPNOTSUPP result code.163*164* feature-persistent165* Values: 0/1 (boolean)166* Default Value: 0167* Notes: 7168*169* A value of "1" indicates that the backend can keep the grants used170* by the frontend driver mapped, so the same set of grants should be171* used in all transactions. The maximum number of grants the backend172* can map persistently depends on the implementation, but ideally it173* should be RING_SIZE * BLKIF_MAX_SEGMENTS_PER_REQUEST. Using this174* feature the backend doesn't need to unmap each grant, preventing175* costly TLB flushes. The backend driver should only map grants176* persistently if the frontend supports it. If a backend driver chooses177* to use the persistent protocol when the frontend doesn't support it,178* it will probably hit the maximum number of persistently mapped grants179* (due to the fact that the frontend won't be reusing the same grants),180* and fall back to non-persistent mode. Backend implementations may181* shrink or expand the number of persistently mapped grants without182* notifying the frontend depending on memory constraints (this might183* cause a performance degradation).184*185* If a backend driver wants to limit the maximum number of persistently186* mapped grants to a value less than RING_SIZE *187* BLKIF_MAX_SEGMENTS_PER_REQUEST a LRU strategy should be used to188* discard the grants that are less commonly used. Using a LRU in the189* backend driver paired with a LIFO queue in the frontend will190* allow us to have better performance in this scenario.191*192*----------------------- Request Transport Parameters ------------------------193*194* max-ring-page-order195* Values: <uint32_t>196* Default Value: 0197* Notes: 1, 3198*199* The maximum supported size of the request ring buffer in units of200* lb(machine pages). (e.g. 0 == 1 page, 1 = 2 pages, 2 == 4 pages,201* etc.).202*203* max-ring-pages204* Values: <uint32_t>205* Default Value: 1206* Notes: DEPRECATED, 2, 3207*208* The maximum supported size of the request ring buffer in units of209* machine pages. The value must be a power of 2.210*211*------------------------- Backend Device Properties -------------------------212*213* discard-enable214* Values: 0/1 (boolean)215* Default Value: 1216*217* This optional property, set by the toolstack, instructs the backend218* to offer (or not to offer) discard to the frontend. If the property219* is missing the backend should offer discard if the backing storage220* actually supports it.221*222* discard-alignment223* Values: <uint32_t>224* Default Value: 0225* Notes: 4, 5226*227* The offset, in bytes from the beginning of the virtual block device,228* to the first, addressable, discard extent on the underlying device.229*230* discard-granularity231* Values: <uint32_t>232* Default Value: <"sector-size">233* Notes: 4234*235* The size, in bytes, of the individually addressable discard extents236* of the underlying device.237*238* discard-secure239* Values: 0/1 (boolean)240* Default Value: 0241* Notes: 10242*243* A value of "1" indicates that the backend can process BLKIF_OP_DISCARD244* requests with the BLKIF_DISCARD_SECURE flag set.245*246* info247* Values: <uint32_t> (bitmap)248*249* A collection of bit flags describing attributes of the backing250* device. The VDISK_* macros define the meaning of each bit251* location.252*253* sector-size254* Values: <uint32_t>255*256* The logical block size, in bytes, of the underlying storage. This257* must be a power of two with a minimum value of 512.258*259* NOTE: Because of implementation bugs in some frontends this must be260* set to 512, unless the frontend advertizes a non-zero value261* in its "feature-large-sector-size" xenbus node. (See below).262*263* physical-sector-size264* Values: <uint32_t>265* Default Value: <"sector-size">266*267* The physical block size, in bytes, of the backend storage. This268* must be an integer multiple of "sector-size".269*270* sectors271* Values: <uint64_t>272*273* The size of the backend device, expressed in units of "sector-size".274* The product of "sector-size" and "sectors" must also be an integer275* multiple of "physical-sector-size", if that node is present.276*277*****************************************************************************278* Frontend XenBus Nodes279*****************************************************************************280*281*----------------------- Request Transport Parameters -----------------------282*283* event-channel284* Values: <uint32_t>285*286* The identifier of the Xen event channel used to signal activity287* in the ring buffer.288*289* ring-ref290* Values: <uint32_t>291* Notes: 6292*293* The Xen grant reference granting permission for the backend to map294* the sole page in a single page sized ring buffer.295*296* ring-ref%u297* Values: <uint32_t>298* Notes: 6299*300* For a frontend providing a multi-page ring, a "number of ring pages"301* sized list of nodes, each containing a Xen grant reference granting302* permission for the backend to map the page of the ring located303* at page index "%u". Page indexes are zero based.304*305* protocol306* Values: string (XEN_IO_PROTO_ABI_*)307* Default Value: XEN_IO_PROTO_ABI_NATIVE308*309* The machine ABI rules governing the format of all ring request and310* response structures.311*312* ring-page-order313* Values: <uint32_t>314* Default Value: 0315* Maximum Value: MAX(ffs(max-ring-pages) - 1, max-ring-page-order)316* Notes: 1, 3317*318* The size of the frontend allocated request ring buffer in units319* of lb(machine pages). (e.g. 0 == 1 page, 1 = 2 pages, 2 == 4 pages,320* etc.).321*322* num-ring-pages323* Values: <uint32_t>324* Default Value: 1325* Maximum Value: MAX(max-ring-pages,(0x1 << max-ring-page-order))326* Notes: DEPRECATED, 2, 3327*328* The size of the frontend allocated request ring buffer in units of329* machine pages. The value must be a power of 2.330*331*--------------------------------- Features ---------------------------------332*333* feature-persistent334* Values: 0/1 (boolean)335* Default Value: 0336* Notes: 7, 8, 9337*338* A value of "1" indicates that the frontend will reuse the same grants339* for all transactions, allowing the backend to map them with write340* access (even when it should be read-only). If the frontend hits the341* maximum number of allowed persistently mapped grants, it can fallback342* to non persistent mode. This will cause a performance degradation,343* since the the backend driver will still try to map those grants344* persistently. Since the persistent grants protocol is compatible with345* the previous protocol, a frontend driver can choose to work in346* persistent mode even when the backend doesn't support it.347*348* It is recommended that the frontend driver stores the persistently349* mapped grants in a LIFO queue, so a subset of all persistently mapped350* grants gets used commonly. This is done in case the backend driver351* decides to limit the maximum number of persistently mapped grants352* to a value less than RING_SIZE * BLKIF_MAX_SEGMENTS_PER_REQUEST.353*354* feature-large-sector-size355* Values: 0/1 (boolean)356* Default Value: 0357*358* A value of "1" indicates that the frontend will correctly supply and359* interpret all sector-based quantities in terms of the "sector-size"360* value supplied in the backend info, whatever that may be set to.361* If this node is not present or its value is "0" then it is assumed362* that the frontend requires that the logical block size is 512 as it363* is hardcoded (which is the case in some frontend implementations).364*365*------------------------- Virtual Device Properties -------------------------366*367* device-type368* Values: "disk", "cdrom", "floppy", etc.369*370* virtual-device371* Values: <uint32_t>372*373* A value indicating the physical device to virtualize within the374* frontend's domain. (e.g. "The first ATA disk", "The third SCSI375* disk", etc.)376*377* See docs/misc/vbd-interface.txt for details on the format of this378* value.379*380* Notes381* -----382* (1) Multi-page ring buffer scheme first developed in the Citrix XenServer383* PV drivers.384* (2) Multi-page ring buffer scheme first used in some RedHat distributions385* including a distribution deployed on certain nodes of the Amazon386* EC2 cluster.387* (3) Support for multi-page ring buffers was implemented independently,388* in slightly different forms, by both Citrix and RedHat/Amazon.389* For full interoperability, block front and backends should publish390* identical ring parameters, adjusted for unit differences, to the391* XenStore nodes used in both schemes.392* (4) Devices that support discard functionality may internally allocate space393* (discardable extents) in units that are larger than the exported logical394* block size. If the backing device has such discardable extents the395* backend should provide both discard-granularity and discard-alignment.396* Providing just one of the two may be considered an error by the frontend.397* Backends supporting discard should include discard-granularity and398* discard-alignment even if it supports discarding individual sectors.399* Frontends should assume discard-alignment == 0 and discard-granularity400* == sector size if these keys are missing.401* (5) The discard-alignment parameter allows a physical device to be402* partitioned into virtual devices that do not necessarily begin or403* end on a discardable extent boundary.404* (6) When there is only a single page allocated to the request ring,405* 'ring-ref' is used to communicate the grant reference for this406* page to the backend. When using a multi-page ring, the 'ring-ref'407* node is not created. Instead 'ring-ref0' - 'ring-refN' are used.408* (7) When using persistent grants data has to be copied from/to the page409* where the grant is currently mapped. The overhead of doing this copy410* however doesn't suppress the speed improvement of not having to unmap411* the grants.412* (8) The frontend driver has to allow the backend driver to map all grants413* with write access, even when they should be mapped read-only, since414* further requests may reuse these grants and require write permissions.415* (9) Linux implementation doesn't have a limit on the maximum number of416* grants that can be persistently mapped in the frontend driver, but417* due to the frontent driver implementation it should never be bigger418* than RING_SIZE * BLKIF_MAX_SEGMENTS_PER_REQUEST.419*(10) The discard-secure property may be present and will be set to 1 if the420* backing device supports secure discard.421*(11) Only used by Linux and NetBSD.422*/423424/*425* Multiple hardware queues/rings:426* If supported, the backend will write the key "multi-queue-max-queues" to427* the directory for that vbd, and set its value to the maximum supported428* number of queues.429* Frontends that are aware of this feature and wish to use it can write the430* key "multi-queue-num-queues" with the number they wish to use, which must be431* greater than zero, and no more than the value reported by the backend in432* "multi-queue-max-queues".433*434* For frontends requesting just one queue, the usual event-channel and435* ring-ref keys are written as before, simplifying the backend processing436* to avoid distinguishing between a frontend that doesn't understand the437* multi-queue feature, and one that does, but requested only one queue.438*439* Frontends requesting two or more queues must not write the toplevel440* event-channel and ring-ref keys, instead writing those keys under sub-keys441* having the name "queue-N" where N is the integer ID of the queue/ring for442* which those keys belong. Queues are indexed from zero.443* For example, a frontend with two queues must write the following set of444* queue-related keys:445*446* /local/domain/1/device/vbd/0/multi-queue-num-queues = "2"447* /local/domain/1/device/vbd/0/queue-0 = ""448* /local/domain/1/device/vbd/0/queue-0/ring-ref = "<ring-ref#0>"449* /local/domain/1/device/vbd/0/queue-0/event-channel = "<evtchn#0>"450* /local/domain/1/device/vbd/0/queue-1 = ""451* /local/domain/1/device/vbd/0/queue-1/ring-ref = "<ring-ref#1>"452* /local/domain/1/device/vbd/0/queue-1/event-channel = "<evtchn#1>"453*454* It is also possible to use multiple queues/rings together with455* feature multi-page ring buffer.456* For example, a frontend requests two queues/rings and the size of each ring457* buffer is two pages must write the following set of related keys:458*459* /local/domain/1/device/vbd/0/multi-queue-num-queues = "2"460* /local/domain/1/device/vbd/0/ring-page-order = "1"461* /local/domain/1/device/vbd/0/queue-0 = ""462* /local/domain/1/device/vbd/0/queue-0/ring-ref0 = "<ring-ref#0>"463* /local/domain/1/device/vbd/0/queue-0/ring-ref1 = "<ring-ref#1>"464* /local/domain/1/device/vbd/0/queue-0/event-channel = "<evtchn#0>"465* /local/domain/1/device/vbd/0/queue-1 = ""466* /local/domain/1/device/vbd/0/queue-1/ring-ref0 = "<ring-ref#2>"467* /local/domain/1/device/vbd/0/queue-1/ring-ref1 = "<ring-ref#3>"468* /local/domain/1/device/vbd/0/queue-1/event-channel = "<evtchn#1>"469*470*/471472/*473* STATE DIAGRAMS474*475*****************************************************************************476* Startup *477*****************************************************************************478*479* Tool stack creates front and back nodes with state XenbusStateInitialising.480*481* Front Back482* ================================= =====================================483* XenbusStateInitialising XenbusStateInitialising484* o Query virtual device o Query backend device identification485* properties. data.486* o Setup OS device instance. o Open and validate backend device.487* o Publish backend features and488* transport parameters.489* |490* |491* V492* XenbusStateInitWait493*494* o Query backend features and495* transport parameters.496* o Allocate and initialize the497* request ring.498* o Publish transport parameters499* that will be in effect during500* this connection.501* |502* |503* V504* XenbusStateInitialised505*506* o Query frontend transport parameters.507* o Connect to the request ring and508* event channel.509* o Publish backend device properties.510* |511* |512* V513* XenbusStateConnected514*515* o Query backend device properties.516* o Finalize OS virtual device517* instance.518* |519* |520* V521* XenbusStateConnected522*523* Note: Drivers that do not support any optional features, or the negotiation524* of transport parameters, can skip certain states in the state machine:525*526* o A frontend may transition to XenbusStateInitialised without527* waiting for the backend to enter XenbusStateInitWait. In this528* case, default transport parameters are in effect and any529* transport parameters published by the frontend must contain530* their default values.531*532* o A backend may transition to XenbusStateInitialised, bypassing533* XenbusStateInitWait, without waiting for the frontend to first534* enter the XenbusStateInitialised state. In this case, default535* transport parameters are in effect and any transport parameters536* published by the backend must contain their default values.537*538* Drivers that support optional features and/or transport parameter539* negotiation must tolerate these additional state transition paths.540* In general this means performing the work of any skipped state541* transition, if it has not already been performed, in addition to the542* work associated with entry into the current state.543*/544545/*546* REQUEST CODES.547*/548#define BLKIF_OP_READ 0549#define BLKIF_OP_WRITE 1550/*551* All writes issued prior to a request with the BLKIF_OP_WRITE_BARRIER552* operation code ("barrier request") must be completed prior to the553* execution of the barrier request. All writes issued after the barrier554* request must not execute until after the completion of the barrier request.555*556* Optional. See "feature-barrier" XenBus node documentation above.557*/558#define BLKIF_OP_WRITE_BARRIER 2559/*560* Commit any uncommitted contents of the backing device's volatile cache561* to stable storage.562*563* Optional. See "feature-flush-cache" XenBus node documentation above.564*/565#define BLKIF_OP_FLUSH_DISKCACHE 3566/*567* Used in SLES sources for device specific command packet568* contained within the request. Reserved for that purpose.569*/570#define BLKIF_OP_RESERVED_1 4571/*572* Indicate to the backend device that a region of storage is no longer in573* use, and may be discarded at any time without impact to the client. If574* the BLKIF_DISCARD_SECURE flag is set on the request, all copies of the575* discarded region on the device must be rendered unrecoverable before the576* command returns.577*578* This operation is analogous to performing a trim (ATA) or unamp (SCSI),579* command on a native device.580*581* More information about trim/unmap operations can be found at:582* http://t13.org/Documents/UploadedDocuments/docs2008/583* e07154r6-Data_Set_Management_Proposal_for_ATA-ACS2.doc584* http://www.seagate.com/staticfiles/support/disc/manuals/585* Interface%20manuals/100293068c.pdf586*587* Optional. See "feature-discard", "discard-alignment",588* "discard-granularity", and "discard-secure" in the XenBus node589* documentation above.590*/591#define BLKIF_OP_DISCARD 5592593/*594* Recognized if "feature-max-indirect-segments" in present in the backend595* xenbus info. The "feature-max-indirect-segments" node contains the maximum596* number of segments allowed by the backend per request. If the node is597* present, the frontend might use blkif_request_indirect structs in order to598* issue requests with more than BLKIF_MAX_SEGMENTS_PER_REQUEST (11). The599* maximum number of indirect segments is fixed by the backend, but the600* frontend can issue requests with any number of indirect segments as long as601* it's less than the number provided by the backend. The indirect_grefs field602* in blkif_request_indirect should be filled by the frontend with the603* grant references of the pages that are holding the indirect segments.604* These pages are filled with an array of blkif_request_segment that hold the605* information about the segments. The number of indirect pages to use is606* determined by the number of segments an indirect request contains. Every607* indirect page can contain a maximum of608* (PAGE_SIZE / sizeof(struct blkif_request_segment)) segments, so to609* calculate the number of indirect pages to use we have to do610* ceil(indirect_segments / (PAGE_SIZE / sizeof(struct blkif_request_segment))).611*612* If a backend does not recognize BLKIF_OP_INDIRECT, it should *not*613* create the "feature-max-indirect-segments" node!614*/615#define BLKIF_OP_INDIRECT 6616617/*618* Maximum scatter/gather segments per request.619* This is carefully chosen so that sizeof(blkif_ring_t) <= PAGE_SIZE.620* NB. This could be 12 if the ring indexes weren't stored in the same page.621*/622#define BLKIF_MAX_SEGMENTS_PER_REQUEST 11623624/*625* Maximum number of indirect pages to use per request.626*/627#define BLKIF_MAX_INDIRECT_PAGES_PER_REQUEST 8628629/*630* NB. 'first_sect' and 'last_sect' in blkif_request_segment, as well as631* 'sector_number' in blkif_request, blkif_request_discard and632* blkif_request_indirect are sector-based quantities. See the description633* of the "feature-large-sector-size" frontend xenbus node above for634* more information.635*/636struct blkif_request_segment {637grant_ref_t gref; /* reference to I/O buffer frame */638/* @first_sect: first sector in frame to transfer (inclusive). */639/* @last_sect: last sector in frame to transfer (inclusive). */640uint8_t first_sect, last_sect;641};642643/*644* Starting ring element for any I/O request.645*/646struct blkif_request {647uint8_t operation; /* BLKIF_OP_??? */648uint8_t nr_segments; /* number of segments */649blkif_vdev_t handle; /* only for read/write requests */650uint64_t id; /* private guest value, echoed in resp */651blkif_sector_t sector_number;/* start sector idx on disk (r/w only) */652struct blkif_request_segment seg[BLKIF_MAX_SEGMENTS_PER_REQUEST];653};654typedef struct blkif_request blkif_request_t;655656/*657* Cast to this structure when blkif_request.operation == BLKIF_OP_DISCARD658* sizeof(struct blkif_request_discard) <= sizeof(struct blkif_request)659*/660struct blkif_request_discard {661uint8_t operation; /* BLKIF_OP_DISCARD */662uint8_t flag; /* BLKIF_DISCARD_SECURE or zero */663#define BLKIF_DISCARD_SECURE (1<<0) /* ignored if discard-secure=0 */664blkif_vdev_t handle; /* same as for read/write requests */665uint64_t id; /* private guest value, echoed in resp */666blkif_sector_t sector_number;/* start sector idx on disk */667uint64_t nr_sectors; /* number of contiguous sectors to discard*/668};669typedef struct blkif_request_discard blkif_request_discard_t;670671struct blkif_request_indirect {672uint8_t operation; /* BLKIF_OP_INDIRECT */673uint8_t indirect_op; /* BLKIF_OP_{READ/WRITE} */674uint16_t nr_segments; /* number of segments */675uint64_t id; /* private guest value, echoed in resp */676blkif_sector_t sector_number;/* start sector idx on disk (r/w only) */677blkif_vdev_t handle; /* same as for read/write requests */678grant_ref_t indirect_grefs[BLKIF_MAX_INDIRECT_PAGES_PER_REQUEST];679#ifdef __i386__680uint64_t pad; /* Make it 64 byte aligned on i386 */681#endif682};683typedef struct blkif_request_indirect blkif_request_indirect_t;684685struct blkif_response {686uint64_t id; /* copied from request */687uint8_t operation; /* copied from request */688int16_t status; /* BLKIF_RSP_??? */689};690typedef struct blkif_response blkif_response_t;691692/*693* STATUS RETURN CODES.694*/695/* Operation not supported (only happens on barrier writes). */696#define BLKIF_RSP_EOPNOTSUPP -2697/* Operation failed for some unspecified reason (-EIO). */698#define BLKIF_RSP_ERROR -1699/* Operation completed successfully. */700#define BLKIF_RSP_OKAY 0701702/*703* Generate blkif ring structures and types.704*/705DEFINE_RING_TYPES(blkif, struct blkif_request, struct blkif_response);706707#define VDISK_CDROM 0x1708#define VDISK_REMOVABLE 0x2709#define VDISK_READONLY 0x4710711#endif /* __XEN_PUBLIC_IO_BLKIF_H__ */712713/*714* Local variables:715* mode: C716* c-file-style: "BSD"717* c-basic-offset: 4718* tab-width: 4719* indent-tabs-mode: nil720* End:721*/722723724