Create log-dirty shared memory between stubdom-dm and xc_save. Process logdirty events when working as a stubdom-dm. Signed-off-by: Yosuke Iwamatsu diff --git a/xenstore.c b/xenstore.c index d064df1..3a3a0bd 100644 --- a/xenstore.c +++ b/xenstore.c @@ -596,10 +596,6 @@ extern int vga_ram_size, bios_size; void xenstore_process_logdirty_event(void) { -#ifdef CONFIG_STUBDOM - /* XXX we just can't use shm. */ - return; -#else char *act; static char *active_path = NULL; static char *next_active_path = NULL; @@ -638,6 +634,25 @@ void xenstore_process_logdirty_event(void) / HOST_LONG_BITS); /* longs */ logdirty_bitmap_size *= sizeof (unsigned long); /* bytes */ +#ifdef CONFIG_STUBDOM + /* Initialize logdirty bitmap */ + if (pasprintf(&path, + "/local/domain/0/device-model/%u/logdirty", + domid) == -1) { + fprintf(logfile, "Log-dirty: out of memory\n"); + exit(1); + } + + seg = init_logdirty_bitmap(path, logdirty_bitmap_size, 0); + if (seg == NULL) { + fprintf(logfile, "Log-dirty: failed to allocate bitmap\n"); + exit(1); + } + free(path); + + /* Write the size of bitmap into the first 32 bits */ + *(uint32_t *)seg = logdirty_bitmap_size; +#else /* Map the shared-memory segment */ fprintf(logfile, "%s: key=%16.16llx size=%lu\n", __FUNCTION__, (unsigned long long)key, logdirty_bitmap_size); @@ -666,6 +681,7 @@ void xenstore_process_logdirty_event(void) seg = NULL; return; } +#endif /* Remember the paths for the next-active and active entries */ if (pasprintf(&active_path, @@ -702,7 +718,6 @@ void xenstore_process_logdirty_event(void) /* Ack that we've switched */ xs_write(xsh, XBT_NULL, active_path, act, len); free(act); -#endif }