Revision 29321335 xen-all.c
b/xen-all.c | ||
---|---|---|
64 | 64 |
/* which vcpu we are serving */ |
65 | 65 |
int send_vcpu; |
66 | 66 |
|
67 |
struct xs_handle *xenstore; |
|
68 |
|
|
67 | 69 |
Notifier exit; |
68 | 70 |
} XenIOState; |
69 | 71 |
|
... | ... | |
450 | 452 |
} |
451 | 453 |
} |
452 | 454 |
|
455 |
static void xenstore_record_dm_state(XenIOState *s, const char *state) |
|
456 |
{ |
|
457 |
char path[50]; |
|
458 |
|
|
459 |
snprintf(path, sizeof (path), "/local/domain/0/device-model/%u/state", xen_domid); |
|
460 |
if (!xs_write(s->xenstore, XBT_NULL, path, state, strlen(state))) { |
|
461 |
fprintf(stderr, "error recording dm state\n"); |
|
462 |
exit(1); |
|
463 |
} |
|
464 |
} |
|
465 |
|
|
453 | 466 |
static void xen_main_loop_prepare(XenIOState *state) |
454 | 467 |
{ |
455 | 468 |
int evtchn_fd = -1; |
... | ... | |
465 | 478 |
if (evtchn_fd != -1) { |
466 | 479 |
qemu_set_fd_handler(evtchn_fd, cpu_handle_ioreq, NULL, state); |
467 | 480 |
} |
481 |
|
|
482 |
/* record state running */ |
|
483 |
xenstore_record_dm_state(state, "running"); |
|
468 | 484 |
} |
469 | 485 |
|
470 | 486 |
|
... | ... | |
483 | 499 |
XenIOState *state = container_of(n, XenIOState, exit); |
484 | 500 |
|
485 | 501 |
xc_evtchn_close(state->xce_handle); |
502 |
xs_daemon_close(state->xenstore); |
|
486 | 503 |
} |
487 | 504 |
|
488 | 505 |
int xen_init(void) |
... | ... | |
510 | 527 |
return -errno; |
511 | 528 |
} |
512 | 529 |
|
530 |
state->xenstore = xs_daemon_open(); |
|
531 |
if (state->xenstore == NULL) { |
|
532 |
perror("xen: xenstore open"); |
|
533 |
return -errno; |
|
534 |
} |
|
535 |
|
|
513 | 536 |
state->exit.notify = xen_exit_notifier; |
514 | 537 |
qemu_add_exit_notifier(&state->exit); |
515 | 538 |
|
Also available in: Unified diff