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

RE: [Xen-devel] [PATCH] get xenstore buffer in vmx guest



Rusty Russell <mailto:rusty@xxxxxxxxxxxxxxx> wrote:
> On Mon, 2005-09-05 at 16:38 +0800, Xiaofeng Ling wrote:
>>   static inline struct ringbuf_head *outbuf(void)
>>   {
>> -    return mfn_to_virt(xen_start_info.store_mfn);
>> +    return XENSTORE_BUF;
>>   }
> 
> Just a minor thing: I'd really prefer an inline function called
> xenstore_page_virt() or something, rather than a macro which looks
> like a constant. 
ok, so the new patch will be:

diff -r 287d36b46fa3 linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c    Tue Aug 30 
20:36:49 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c    Mon Sep  5 
22:15:45 2005
@@ -48,12 +48,12 @@

 static inline struct ringbuf_head *outbuf(void)
 {
-   return mfn_to_virt(xen_start_info.store_mfn);
+   return xenstore_page_virt();
 }

 static inline struct ringbuf_head *inbuf(void)
 {
-   return mfn_to_virt(xen_start_info.store_mfn) + PAGE_SIZE/2;
+   return xenstore_page_virt() + PAGE_SIZE/2;
 }

 static irqreturn_t wake_waiting(int irq, void *unused, struct pt_regs *regs)
@@ -218,7 +218,7 @@
    }

    /* FIXME zero out page -- domain builder should probably do this*/
-   memset(mfn_to_virt(xen_start_info.store_mfn), 0, PAGE_SIZE);
+   memset(xenstore_page_virt(), 0, PAGE_SIZE);

    return 0;
 }
diff -r 287d36b46fa3 linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.h
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.h    Tue Aug 30 
20:36:49 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.h    Mon Sep  5 
22:15:45 2005
@@ -38,4 +38,17 @@
 int xs_input_avail(void);
 extern wait_queue_head_t xb_waitq;

+#ifdef CONFIG_XEN
+static inline void *xenstore_page_virt(void)
+{
+    return (void*)mfn_to_virt(xen_start_info.store_mfn);
+}
+#else
+extern void *shared_xenstore_buf;
+static inline void *xenstore_page_virt(void)
+{
+    return shared_xenstore_buf;
+}
+#endif
+
 #endif /* _XENBUS_COMMS_H */
diff -r 287d36b46fa3 linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c    Tue Aug 30 
20:36:49 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c    Mon Sep  5 
22:18:22 2005
@@ -648,4 +648,5 @@
    return 0;
 }

-postcore_initcall(xenbus_probe_init);
+module_init(xenbus_probe_init);
+MODULE_LICENSE("GPL");

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

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