direct-io.hg

view xen/include/public/io/blkif.h @ 8121:58d46463413e

GNTTABOP_map_grant_ref returns error status and handle as
separate fields. Update callers for new interface. Also
use int16_t as standard error code type on all public
interfaces.

Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Wed Nov 30 17:24:27 2005 +0100 (2005-11-30)
parents ff95b53bd39a
children ca236a81729d
line source
1 /******************************************************************************
2 * blkif.h
3 *
4 * Unified block-device I/O interface for Xen guest OSes.
5 *
6 * Copyright (c) 2003-2004, Keir Fraser
7 */
9 #ifndef __XEN_PUBLIC_IO_BLKIF_H__
10 #define __XEN_PUBLIC_IO_BLKIF_H__
12 #include "ring.h"
14 #ifndef blkif_vdev_t
15 #define blkif_vdev_t uint16_t
16 #endif
17 #define blkif_sector_t uint64_t
19 #define BLKIF_OP_READ 0
20 #define BLKIF_OP_WRITE 1
22 /*
23 * Maximum scatter/gather segments per request.
24 * This is carefully chosen so that sizeof(blkif_ring_t) <= PAGE_SIZE.
25 * NB. This could be 12 if the ring indexes weren't stored in the same page.
26 */
27 #define BLKIF_MAX_SEGMENTS_PER_REQUEST 11
29 typedef struct blkif_request {
30 uint8_t operation; /* BLKIF_OP_??? */
31 uint8_t nr_segments; /* number of segments */
32 blkif_vdev_t handle; /* only for read/write requests */
33 uint64_t id; /* private guest value, echoed in resp */
34 blkif_sector_t sector_number;/* start sector idx on disk (r/w only) */
35 struct blkif_request_segment {
36 grant_ref_t gref; /* reference to I/O buffer frame */
37 /* @first_sect: first sector in frame to transfer (inclusive). */
38 /* @last_sect: last sector in frame to transfer (inclusive). */
39 uint8_t first_sect, last_sect;
40 } seg[BLKIF_MAX_SEGMENTS_PER_REQUEST];
41 } blkif_request_t;
43 typedef struct blkif_response {
44 uint64_t id; /* copied from request */
45 uint8_t operation; /* copied from request */
46 int16_t status; /* BLKIF_RSP_??? */
47 } blkif_response_t;
49 #define BLKIF_RSP_ERROR -1 /* non-specific 'error' */
50 #define BLKIF_RSP_OKAY 0 /* non-specific 'okay' */
52 /*
53 * Generate blkif ring structures and types.
54 */
56 DEFINE_RING_TYPES(blkif, blkif_request_t, blkif_response_t);
58 #define VDISK_CDROM 0x1
59 #define VDISK_REMOVABLE 0x2
60 #define VDISK_READONLY 0x4
62 #endif /* __XEN_PUBLIC_IO_BLKIF_H__ */
64 /*
65 * Local variables:
66 * mode: C
67 * c-set-style: "BSD"
68 * c-basic-offset: 4
69 * tab-width: 4
70 * indent-tabs-mode: nil
71 * End:
72 */