Keir Fraser wrote:
> You missed out the patch.
Oops, attached.
> I'm sure however that I'll argue you should make
> the enumeration local to the backend. It will always support his native
> architecture. Where it supports cross-architecture (i386-on-x64) he can
> *privately* have a numeric assignment for that situation which it uses on
> data paths. Then we don't have redundant info in xenstore and we don't get
> tied to particular magic numbers.
I don't want to put numbers into xenstore. But there are multiple
backends affected (pvfb, blktab, blkback, tpm, maybe more) and thus it
would be useful to share the infrastructure IMHO ...
cheers,
Gerd
--
Gerd Hoffmann <kraxel@xxxxxxx>
---
linux-2.6-xen-sparse/include/xen/protocols.h | 57 +++++++++++++++++++++++++++
1 file changed, 57 insertions(+)
Index: build-32-unstable-13495/linux-2.6-xen-sparse/include/xen/protocols.h
===================================================================
--- /dev/null
+++ build-32-unstable-13495/linux-2.6-xen-sparse/include/xen/protocols.h
@@ -0,0 +1,57 @@
+#ifndef __XEN_PROTOCOLS_H__
+#define __XEN_PROTOCOLS_H__
+
+enum xen_io_proto_id {
+ /* For all front/backends */
+ XEN_IO_PROTO_ABI_X86_32 = 1,
+ XEN_IO_PROTO_ABI_X86_64 = 2,
+ XEN_IO_PROTO_ABI_IA64 = 3,
+ XEN_IO_PROTO_ABI_POWERPC64 = 4,
+
+ /* framebuffer via grant tables on little endian machines */
+ XEN_IO_PROTO_FB_LE_GRANT = 5,
+};
+
+static const char *xen_io_proto_names[] = {
+ [ XEN_IO_PROTO_ABI_X86_32 ] = "x86_32-abi",
+ [ XEN_IO_PROTO_ABI_X86_64 ] = "x86_64-abi",
+ [ XEN_IO_PROTO_ABI_IA64 ] = "ia64-abi",
+ [ XEN_IO_PROTO_ABI_POWERPC64 ] = "powerpc64-abi",
+
+ [ XEN_IO_PROTO_FB_LE_GRANT ] = "fb-le-grant",
+};
+#define XEN_IO_PROTO_COUNT
(sizeof(xen_io_proto_names)/sizeof(xen_io_proto_names[0]))
+
+static enum xen_io_proto_id xen_io_proto_name2id(const char *name)
+{
+ int id;
+
+ for (id = 0; id < XEN_IO_PROTO_COUNT; id++) {
+ if (!xen_io_proto_names[id])
+ continue;
+ if (0 != strcmp(name, xen_io_proto_names[id]))
+ continue;
+ return i;
+ }
+}
+
+static const char *xen_io_proto_id2name(enum xen_io_proto_id id)
+{
+ if (id >= XEN_IO_PROTO_COUNT)
+ return NULL;
+ return xen_io_proto_names[id];
+}
+
+#if defined(__i386__)
+# define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_X86_32
+#elif defined(__x86_64__)
+# define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_X86_64
+#elif defined(__ia64__)
+# define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_IA64
+#elif defined(__powerpc64__)
+# define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_POWERPC64
+#else
+# error arch fixup needed here
+#endif
+
+#endif
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|