interface: add 'discard-secure' and BLKIF_DISCARD_SECURE
authorKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Thu, 27 Oct 2011 15:04:48 +0000 (16:04 +0100)
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Thu, 27 Oct 2011 15:04:48 +0000 (16:04 +0100)
Alter the 'reserved' uint8_t to be used a 'flag'. We use only for one
flag: BLKIF_DISCARD_SECURE.

That flag can only be set if the backend has set 'discard-secure' to
one.  If backend has not set 'discard-secure' to one, that flag will
have no effect.

Acked-by: Jan Beulich <JBeulich@suse.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Committed-by: Keir Fraser <keir@xen.org>
xen/include/public/io/blkif.h

index a93d304a24cb37bf4c3de25c69cb214366dd2a8b..89b6f1d491d0156ef389252e7def9616ad36239e 100644 (file)
  * allocation unit in bytes if reported by the device. Otherwise the
  * discard-granularity will be set to match the device's physical block size.
  * It is the minimum size you can discard.
+ * 'discard-secure' - All copies of the discarded sectors (potentially created
+ * by garbage collection) must also be erased.  To use this feature, the flag
+ * BLKIF_DISCARD_SECURE must be set in the blkif_request_discard.
  */
 #define BLKIF_OP_DISCARD           5
 
@@ -160,7 +163,8 @@ typedef struct blkif_request blkif_request_t;
  */
 struct blkif_request_discard {
     uint8_t        operation;    /* BLKIF_OP_DISCARD                     */
-    uint8_t        reserved;     /*                                      */
+    uint8_t        flag;         /* BLKIF_DISCARD_SECURE or zero         */
+#define BLKIF_DISCARD_SECURE (1<<0)  /* ignored if discard-secure=0      */
     blkif_vdev_t   handle;       /* same as for read/write requests      */
     uint64_t       id;           /* private guest value, echoed in resp  */
     blkif_sector_t sector_number;/* start sector idx on disk             */