b_info->max_vcpus = l;
if (!xlu_cfg_get_list (config, "cpus", &cpus, 0, 1)) {
- int i, n_cpus = 0;
+ int n_cpus = 0;
if (libxl_cpu_bitmap_alloc(ctx, &b_info->cpumap, 0)) {
fprintf(stderr, "Unable to allocate cpumap\n");
}
if (!xlu_cfg_get_list (config, "pci", &pcis, 0, 0)) {
- int i;
d_config->num_pcidevs = 0;
d_config->pcidevs = NULL;
for(i = 0; (buf = xlu_cfg_get_listitem (pcis, i)) != NULL; i++) {
switch (xlu_cfg_get_list(config, "cpuid", &cpuids, 0, 1)) {
case 0:
{
- int i;
const char *errstr;
for (i = 0; (buf = xlu_cfg_get_listitem(cpuids, i)) != NULL; i++) {
{
time_t now;
struct tm tm;
- char stime[24];
+ char strtime[24];
libxl_uuid new_uuid;
return 0;
}
- if (!strftime(&stime[0], sizeof(stime), "-%Y%m%dT%H%MZ", &tm)) {
+ if (!strftime(&strtime[0], sizeof(strtime), "-%Y%m%dT%H%MZ", &tm)) {
LOG("Failed to format time as a string");
return 0;
}
libxl_uuid_generate(&new_uuid);
LOG("Preserving domain %d %s with suffix%s",
- *r_domid, d_config->c_info.name, stime);
+ *r_domid, d_config->c_info.name, strtime);
rc = libxl_domain_preserve(ctx, *r_domid, &d_config->c_info,
- stime, new_uuid);
+ strtime, new_uuid);
/*
* Although the domain still exists it is no longer the one we are
if (rc) { fprintf(stderr,"destroy failed (rc=%d)\n",rc); exit(-1); }
}
-static void shutdown_domain(const char *p, int wait, int fallback_trigger)
+static void shutdown_domain(const char *p, int wait_for_it,
+ int fallback_trigger)
{
int rc;
libxl_event *event;
fprintf(stderr,"shutdown failed (rc=%d)\n",rc);exit(-1);
}
- if (wait) {
+ if (wait_for_it) {
libxl_evgen_domain_death *deathw;
rc = libxl_evenable_domain_death(ctx, domid, 0, &deathw);
int main_shutdown(int argc, char **argv)
{
int opt;
- int wait = 0;
+ int wait_for_it = 0;
int fallback_trigger = 0;
while ((opt = def_getopt(argc, argv, "wF", "shutdown", 1)) != -1) {
case 0: case 2:
return opt;
case 'w':
- wait = 1;
+ wait_for_it = 1;
break;
case 'F':
fallback_trigger = 1;
}
}
- shutdown_domain(argv[optind], wait, fallback_trigger);
+ shutdown_domain(argv[optind], wait_for_it, fallback_trigger);
return 0;
}
return;
}
-static void info(int numa)
+static void print_info(int numa)
{
output_nodeinfo();
}
}
- info(numa);
+ print_info(numa);
return 0;
}
return rc;
}
-static char *uptime_to_string(unsigned long time, int short_mode)
+static char *uptime_to_string(unsigned long uptime, int short_mode)
{
int sec, min, hour, day;
char *time_string;
int ret;
- day = (int)(time / 86400);
- time -= (day * 86400);
- hour = (int)(time / 3600);
- time -= (hour * 3600);
- min = (int)(time / 60);
- time -= (min * 60);
- sec = time;
+ day = (int)(uptime / 86400);
+ uptime -= (day * 86400);
+ hour = (int)(uptime / 3600);
+ uptime -= (hour * 3600);
+ min = (int)(uptime / 60);
+ uptime -= (min * 60);
+ sec = uptime;
if (short_mode)
if (day > 1)