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

[Xen-devel] dom builder logging from pvgrub.



I found the following hack quite handy here. Posting it for the
archives/posterity, I don't really plan to clean it up and submit it
properly (since I'm not really sure what a non-hack version would be).

In case anyone wants to pick it up:
Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>

(lightly edited in patch form to remove some of the worst bodging)


diff --git a/stubdom/grub/kexec.c b/stubdom/grub/kexec.c
index 8fd9ff9..761ca7f 100644
--- a/stubdom/grub/kexec.c
+++ b/stubdom/grub/kexec.c
@@ -209,6 +209,35 @@ static void tpm_hash2pcr(struct xc_dom_image *dom, char 
*cmdline)
       shutdown_tpmfront(tpm);
Â}
Â
+static void builder_vmessage(struct xentoollog_logger *logger,
+ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂxentoollog_level level,
+ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂint errnoval,
+ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂconst char *context,
+ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂconst char *format,
+ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂva_list ap)
+{
+ÂÂchar buf[1024];
+
+ÂÂvsnprintf(buf, sizeof(buf), format, ap);
+
+ÂÂprintk("%s%s%s\n",
+       ÂÂcontext ? : "",
+       ÂÂcontext ? ": " : "",
+       ÂÂbuf);
+}
+static void builder_progress(struct xentoollog_logger *logger,
+ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂconst char *context,
+ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂconst char *doing_what,
+ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂint percent, unsigned long done, unsigned long total)
+{
+  printk("%s\n", __func__);
+}
+
+static void builder_destroy(struct xentoollog_logger *logger)
+{
+  printk("%s\n", __func__);
+}
+
Âvoid kexec(void *kernel, long kernel_size, void *module, long module_size, 
char *cmdline, unsigned long flags)
Â{
ÂÂÂÂÂstruct xc_dom_image *dom;
@@ -223,8 +253,14 @@ void kexec(void *kernel, long kernel_size, void *module, 
long module_size, char
ÂÂÂÂÂstruct mmu_update *m2p_updates;
ÂÂÂÂÂunsigned long nr_m2p_updates;
Â
+ÂÂÂÂstruct xentoollog_logger lg = {
+       ÂÂÂÂ.vmessage = builder_vmessage,
+       ÂÂÂÂ.progress = builder_progress,
+       ÂÂÂÂ.destroy = builder_destroy,
+ÂÂÂÂ};
+
ÂÂÂÂÂDEBUG("booting with cmdline %s\n", cmdline);
-ÂÂÂÂxc_handle = xc_interface_open(0,0,0);
+ÂÂÂÂxc_handle = xc_interface_open(0,&lg,&lg);
Â
ÂÂÂÂÂdom = xc_dom_allocate(xc_handle, cmdline, features);
ÂÂÂÂÂdom->allocate = kexec_allocate;
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

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