[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH RFC 2/2] vscsiif.h: don't require PAGE_SIZE to be present



If it is present, use it; otherwise use 4096. Also provide a new macro
to let user have control over the page size used to do calculation.

Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
---
Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
Cc: George Dunlap <George.Dunlap@xxxxxxxxxxxxx>
Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Cc: Jan Beulich <jbeulich@xxxxxxxx>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>
Cc: Tim Deegan <tim@xxxxxxx>
Cc: Wei Liu <wei.liu2@xxxxxxxxxx>
Cc: Juergen Gross <jgross@xxxxxxxx>
---
 xen/include/public/io/vscsiif.h | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/xen/include/public/io/vscsiif.h b/xen/include/public/io/vscsiif.h
index 0a4709f..00e8b74 100644
--- a/xen/include/public/io/vscsiif.h
+++ b/xen/include/public/io/vscsiif.h
@@ -256,7 +256,23 @@ struct scsiif_request_segment {
 };
 typedef struct scsiif_request_segment vscsiif_segment_t;
 
-#define VSCSIIF_SG_PER_PAGE (PAGE_SIZE / sizeof(struct scsiif_request_segment))
+/*
+ * Reference to PAGE_SIZE was overlooked when this header file was
+ * introduced. Respect PAGE_SIZE if defined, otherwise, use 4096.
+ */
+#ifdef PAGE_SIZE
+#define _VSCSIIF_PAGE_SIZE PAGE_SIZE
+#else
+#define _VSCSIIF_PAGE_SIZE 4096
+#endif
+/*
+ * Please use _PAGE2 variant in new code, _PAGE variant is kept for
+ * backward-compatibility.
+ */
+#define VSCSIIF_SG_PER_PAGE (_VSCSI_PAGE_SIZE / \
+                             sizeof(struct scsiif_request_segment))
+#define VSCSIIF_SG_PER_PAGE2(pgsize) ((pgsize) / \
+                                      sizeof(struct scsiif_request_segment))
 
 /* Size of one request is 252 bytes */
 struct vscsiif_request {
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.