diff options
Diffstat (limited to 'include/xen')
-rw-r--r-- | include/xen/interface/io/blkif.h | 40 | ||||
-rw-r--r-- | include/xen/xenbus.h | 4 |
2 files changed, 35 insertions, 9 deletions
diff --git a/include/xen/interface/io/blkif.h b/include/xen/interface/io/blkif.h index 9324488f23f0..ee338bfde18b 100644 --- a/include/xen/interface/io/blkif.h +++ b/include/xen/interface/io/blkif.h | |||
@@ -84,6 +84,21 @@ typedef uint64_t blkif_sector_t; | |||
84 | * e07154r6-Data_Set_Management_Proposal_for_ATA-ACS2.doc | 84 | * e07154r6-Data_Set_Management_Proposal_for_ATA-ACS2.doc |
85 | * http://www.seagate.com/staticfiles/support/disc/manuals/ | 85 | * http://www.seagate.com/staticfiles/support/disc/manuals/ |
86 | * Interface%20manuals/100293068c.pdf | 86 | * Interface%20manuals/100293068c.pdf |
87 | * The backend can optionally provide three extra XenBus attributes to | ||
88 | * further optimize the discard functionality: | ||
89 | * 'discard-aligment' - Devices that support discard functionality may | ||
90 | * internally allocate space in units that are bigger than the exported | ||
91 | * logical block size. The discard-alignment parameter indicates how many bytes | ||
92 | * the beginning of the partition is offset from the internal allocation unit's | ||
93 | * natural alignment. | ||
94 | * 'discard-granularity' - Devices that support discard functionality may | ||
95 | * internally allocate space using units that are bigger than the logical block | ||
96 | * size. The discard-granularity parameter indicates the size of the internal | ||
97 | * allocation unit in bytes if reported by the device. Otherwise the | ||
98 | * discard-granularity will be set to match the device's physical block size. | ||
99 | * 'discard-secure' - All copies of the discarded sectors (potentially created | ||
100 | * by garbage collection) must also be erased. To use this feature, the flag | ||
101 | * BLKIF_DISCARD_SECURE must be set in the blkif_request_trim. | ||
87 | */ | 102 | */ |
88 | #define BLKIF_OP_DISCARD 5 | 103 | #define BLKIF_OP_DISCARD 5 |
89 | 104 | ||
@@ -95,6 +110,12 @@ typedef uint64_t blkif_sector_t; | |||
95 | #define BLKIF_MAX_SEGMENTS_PER_REQUEST 11 | 110 | #define BLKIF_MAX_SEGMENTS_PER_REQUEST 11 |
96 | 111 | ||
97 | struct blkif_request_rw { | 112 | struct blkif_request_rw { |
113 | uint8_t nr_segments; /* number of segments */ | ||
114 | blkif_vdev_t handle; /* only for read/write requests */ | ||
115 | #ifdef CONFIG_X86_64 | ||
116 | uint32_t _pad1; /* offsetof(blkif_request,u.rw.id) == 8 */ | ||
117 | #endif | ||
118 | uint64_t id; /* private guest value, echoed in resp */ | ||
98 | blkif_sector_t sector_number;/* start sector idx on disk (r/w only) */ | 119 | blkif_sector_t sector_number;/* start sector idx on disk (r/w only) */ |
99 | struct blkif_request_segment { | 120 | struct blkif_request_segment { |
100 | grant_ref_t gref; /* reference to I/O buffer frame */ | 121 | grant_ref_t gref; /* reference to I/O buffer frame */ |
@@ -102,23 +123,28 @@ struct blkif_request_rw { | |||
102 | /* @last_sect: last sector in frame to transfer (inclusive). */ | 123 | /* @last_sect: last sector in frame to transfer (inclusive). */ |
103 | uint8_t first_sect, last_sect; | 124 | uint8_t first_sect, last_sect; |
104 | } seg[BLKIF_MAX_SEGMENTS_PER_REQUEST]; | 125 | } seg[BLKIF_MAX_SEGMENTS_PER_REQUEST]; |
105 | }; | 126 | } __attribute__((__packed__)); |
106 | 127 | ||
107 | struct blkif_request_discard { | 128 | struct blkif_request_discard { |
129 | uint8_t flag; /* BLKIF_DISCARD_SECURE or zero. */ | ||
130 | #define BLKIF_DISCARD_SECURE (1<<0) /* ignored if discard-secure=0 */ | ||
131 | blkif_vdev_t _pad1; /* only for read/write requests */ | ||
132 | #ifdef CONFIG_X86_64 | ||
133 | uint32_t _pad2; /* offsetof(blkif_req..,u.discard.id)==8*/ | ||
134 | #endif | ||
135 | uint64_t id; /* private guest value, echoed in resp */ | ||
108 | blkif_sector_t sector_number; | 136 | blkif_sector_t sector_number; |
109 | uint64_t nr_sectors; | 137 | uint64_t nr_sectors; |
110 | }; | 138 | uint8_t _pad3; |
139 | } __attribute__((__packed__)); | ||
111 | 140 | ||
112 | struct blkif_request { | 141 | struct blkif_request { |
113 | uint8_t operation; /* BLKIF_OP_??? */ | 142 | uint8_t operation; /* BLKIF_OP_??? */ |
114 | uint8_t nr_segments; /* number of segments */ | ||
115 | blkif_vdev_t handle; /* only for read/write requests */ | ||
116 | uint64_t id; /* private guest value, echoed in resp */ | ||
117 | union { | 143 | union { |
118 | struct blkif_request_rw rw; | 144 | struct blkif_request_rw rw; |
119 | struct blkif_request_discard discard; | 145 | struct blkif_request_discard discard; |
120 | } u; | 146 | } u; |
121 | }; | 147 | } __attribute__((__packed__)); |
122 | 148 | ||
123 | struct blkif_response { | 149 | struct blkif_response { |
124 | uint64_t id; /* copied from request */ | 150 | uint64_t id; /* copied from request */ |
diff --git a/include/xen/xenbus.h b/include/xen/xenbus.h index e8c599b237c2..0a7515c1e3a4 100644 --- a/include/xen/xenbus.h +++ b/include/xen/xenbus.h | |||
@@ -139,9 +139,9 @@ int xenbus_transaction_start(struct xenbus_transaction *t); | |||
139 | int xenbus_transaction_end(struct xenbus_transaction t, int abort); | 139 | int xenbus_transaction_end(struct xenbus_transaction t, int abort); |
140 | 140 | ||
141 | /* Single read and scanf: returns -errno or num scanned if > 0. */ | 141 | /* Single read and scanf: returns -errno or num scanned if > 0. */ |
142 | __scanf(4, 5) | ||
142 | int xenbus_scanf(struct xenbus_transaction t, | 143 | int xenbus_scanf(struct xenbus_transaction t, |
143 | const char *dir, const char *node, const char *fmt, ...) | 144 | const char *dir, const char *node, const char *fmt, ...); |
144 | __attribute__((format(scanf, 4, 5))); | ||
145 | 145 | ||
146 | /* Single printf and write: returns -errno or 0. */ | 146 | /* Single printf and write: returns -errno or 0. */ |
147 | __printf(4, 5) | 147 | __printf(4, 5) |