diff options
-rw-r--r-- | usr.sbin/vmd/config.c | 11 | ||||
-rw-r--r-- | usr.sbin/vmd/i8253.c | 4 | ||||
-rw-r--r-- | usr.sbin/vmd/i8259.c | 4 | ||||
-rw-r--r-- | usr.sbin/vmd/ns8250.c | 5 | ||||
-rw-r--r-- | usr.sbin/vmd/parse.y | 14 | ||||
-rw-r--r-- | usr.sbin/vmd/pci.c | 17 | ||||
-rw-r--r-- | usr.sbin/vmd/task.c | 4 | ||||
-rw-r--r-- | usr.sbin/vmd/vioscsi.c | 45 | ||||
-rw-r--r-- | usr.sbin/vmd/virtio.c | 31 | ||||
-rw-r--r-- | usr.sbin/vmd/vm.c | 19 | ||||
-rw-r--r-- | usr.sbin/vmd/vmd.c | 33 |
11 files changed, 107 insertions, 80 deletions
diff --git a/usr.sbin/vmd/config.c b/usr.sbin/vmd/config.c index b316bb7dcfe..9073c746ef6 100644 --- a/usr.sbin/vmd/config.c +++ b/usr.sbin/vmd/config.c @@ -1,4 +1,4 @@ -/* $OpenBSD: config.c,v 1.42 2018/03/14 07:29:34 mlarkin Exp $ */ +/* $OpenBSD: config.c,v 1.43 2018/06/19 17:12:34 reyk Exp $ */ /* * Copyright (c) 2015 Reyk Floeter <reyk@openbsd.org> @@ -252,8 +252,8 @@ config_setvm(struct privsep *ps, struct vmd_vm *vm, uint32_t peerid, uid_t uid) goto fail; } if (S_ISREG(stat_buf.st_mode) == 0) { - log_warnx("%s: cdrom %s is not a regular file", __func__, - vcp->vcp_cdrom); + log_warnx("%s: cdrom %s is not a regular file", + __func__, vcp->vcp_cdrom); errno = VMD_CDROM_INVALID; goto fail; } @@ -262,9 +262,8 @@ config_setvm(struct privsep *ps, struct vmd_vm *vm, uint32_t peerid, uid_t uid) /* Open disk images for child */ for (i = 0 ; i < vcp->vcp_ndisks; i++) { /* Stat disk[i] to ensure it is a regular file */ - if ((diskfds[i] = - open(vcp->vcp_disks[i], O_RDWR | O_EXLOCK | O_NONBLOCK)) == - -1) { + if ((diskfds[i] = open(vcp->vcp_disks[i], + O_RDWR|O_EXLOCK|O_NONBLOCK)) == -1) { log_warn("%s: can't open disk %s", __func__, vcp->vcp_disks[i]); errno = VMD_DISK_MISSING; diff --git a/usr.sbin/vmd/i8253.c b/usr.sbin/vmd/i8253.c index c669fb16867..4d4943ab27c 100644 --- a/usr.sbin/vmd/i8253.c +++ b/usr.sbin/vmd/i8253.c @@ -1,4 +1,4 @@ -/* $OpenBSD: i8253.c,v 1.25 2018/05/23 02:19:34 mlarkin Exp $ */ +/* $OpenBSD: i8253.c,v 1.26 2018/06/19 17:12:34 reyk Exp $ */ /* * Copyright (c) 2016 Mike Larkin <mlarkin@openbsd.org> * @@ -394,6 +394,6 @@ i8253_start() { int i; for (i = 0; i < 3; i++) - if(i8253_channel[i].in_use) + if (i8253_channel[i].in_use) i8253_reset(i); } diff --git a/usr.sbin/vmd/i8259.c b/usr.sbin/vmd/i8259.c index 0859bf69d76..1922e9bf827 100644 --- a/usr.sbin/vmd/i8259.c +++ b/usr.sbin/vmd/i8259.c @@ -1,4 +1,4 @@ -/* $OpenBSD: i8259.c,v 1.17 2018/04/27 12:15:10 mlarkin Exp $ */ +/* $OpenBSD: i8259.c,v 1.18 2018/06/19 17:12:34 reyk Exp $ */ /* * Copyright (c) 2016 Mike Larkin <mlarkin@openbsd.org> * @@ -739,7 +739,7 @@ vcpu_exit_elcr(struct vm_run_params *vrp) if (vei->vei.vei_dir == VEI_DIR_OUT) { log_debug("%s: ELCR[%d] set to 0x%x", __func__, elcr_reg, (uint8_t)vei->vei.vei_data); - elcr[elcr_reg] = (uint8_t)vei->vei.vei_data; + elcr[elcr_reg] = (uint8_t)vei->vei.vei_data; } else { set_return_data(vei, elcr[elcr_reg]); } diff --git a/usr.sbin/vmd/ns8250.c b/usr.sbin/vmd/ns8250.c index 198b11cef94..a893a43bb6b 100644 --- a/usr.sbin/vmd/ns8250.c +++ b/usr.sbin/vmd/ns8250.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ns8250.c,v 1.14 2018/01/08 18:21:22 anton Exp $ */ +/* $OpenBSD: ns8250.c,v 1.15 2018/06/19 17:12:34 reyk Exp $ */ /* * Copyright (c) 2016 Mike Larkin <mlarkin@openbsd.org> * @@ -262,7 +262,8 @@ vcpu_process_com_data(union vm_exit *vei, uint32_t vm_id, uint32_t vcpu_id) com1_dev.regs.lsr &= ~LSR_RXRDY; } else { set_return_data(vei, com1_dev.regs.data); - log_warnx("%s: guest reading com1 when not ready", __func__); + log_warnx("%s: guest reading com1 when not ready", + __func__); } /* Reading the data register always clears RXRDY from IIR */ diff --git a/usr.sbin/vmd/parse.y b/usr.sbin/vmd/parse.y index b402a92fa85..61763d6693f 100644 --- a/usr.sbin/vmd/parse.y +++ b/usr.sbin/vmd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.34 2018/06/11 09:32:55 denis Exp $ */ +/* $OpenBSD: parse.y,v 1.35 2018/06/19 17:12:34 reyk Exp $ */ /* * Copyright (c) 2007-2016 Reyk Floeter <reyk@openbsd.org> @@ -204,7 +204,8 @@ switch : SWITCH string { } '{' optnl switch_opts_l '}' { if (strnlen(vsw->sw_ifname, sizeof(vsw->sw_ifname)) == 0) { - yyerror("switch \"%s\" is missing interface name", + yyerror("switch \"%s\" " + "is missing interface name", vsw->sw_name); YYERROR; } @@ -214,7 +215,8 @@ switch : SWITCH string { " skipped (disabled)", file->name, yylval.lineno, vsw->sw_name); } else if (!env->vmd_noaction) { - TAILQ_INSERT_TAIL(env->vmd_switches, vsw, sw_entry); + TAILQ_INSERT_TAIL(env->vmd_switches, + vsw, sw_entry); env->vmd_nswitches++; log_debug("%s:%d: switch \"%s\" registered", file->name, yylval.lineno, vsw->sw_name); @@ -318,10 +320,12 @@ vm : VM string { } else { if (vcp_disable) vm->vm_disabled = 1; - log_debug("%s:%d: vm \"%s\" registered (%s)", + log_debug("%s:%d: vm \"%s\" " + "registered (%s)", file->name, yylval.lineno, vcp->vcp_name, - vcp_disable ? "disabled" : "enabled"); + vcp_disable ? + "disabled" : "enabled"); } vm->vm_from_config = 1; } diff --git a/usr.sbin/vmd/pci.c b/usr.sbin/vmd/pci.c index 12f0afcbc81..3372e9e2a37 100644 --- a/usr.sbin/vmd/pci.c +++ b/usr.sbin/vmd/pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pci.c,v 1.24 2018/04/27 12:15:10 mlarkin Exp $ */ +/* $OpenBSD: pci.c,v 1.25 2018/06/19 17:12:34 reyk Exp $ */ /* * Copyright (c) 2015 Mike Larkin <mlarkin@openbsd.org> @@ -394,19 +394,20 @@ pci_handle_data_reg(struct vm_run_params *vrp) else { switch (sz) { case 4: - set_return_data(vei, pci.pci_devices[d].pd_cfg_space[o / 4]); + set_return_data(vei, + pci.pci_devices[d].pd_cfg_space[o / 4]); break; case 2: if (ofs == 0) - set_return_data(vei, - pci.pci_devices[d].pd_cfg_space[o / 4]); + set_return_data(vei, pci.pci_devices[d]. + pd_cfg_space[o / 4]); else - set_return_data(vei, - pci.pci_devices[d].pd_cfg_space[o / 4] >> 16); + set_return_data(vei, pci.pci_devices[d]. + pd_cfg_space[o / 4] >> 16); break; case 1: - set_return_data(vei, - pci.pci_devices[d].pd_cfg_space[o / 4] >> (ofs * 8)); + set_return_data(vei, pci.pci_devices[d]. + pd_cfg_space[o / 4] >> (ofs * 8)); break; } } diff --git a/usr.sbin/vmd/task.c b/usr.sbin/vmd/task.c index e76914db590..66b99510b80 100644 --- a/usr.sbin/vmd/task.c +++ b/usr.sbin/vmd/task.c @@ -1,4 +1,4 @@ -/* $OpenBSD: task.c,v 1.1 2017/09/15 02:39:33 dlg Exp $ */ +/* $OpenBSD: task.c,v 1.2 2018/06/19 17:12:34 reyk Exp $ */ /* * Copyright (c) 2017 David Gwynne <dlg@openbsd.org> @@ -153,4 +153,4 @@ task_del(struct taskq *tq, struct task *t) pthread_mutex_unlock(&tq->mtx); return (rv); -} +} diff --git a/usr.sbin/vmd/vioscsi.c b/usr.sbin/vmd/vioscsi.c index dee4e7ea054..3e060628e19 100644 --- a/usr.sbin/vmd/vioscsi.c +++ b/usr.sbin/vmd/vioscsi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vioscsi.c,v 1.5 2018/04/26 01:10:10 ccardenas Exp $ */ +/* $OpenBSD: vioscsi.c,v 1.6 2018/06/19 17:12:34 reyk Exp $ */ /* * Copyright (c) 2017 Carlos Cardenas <ccardenas@openbsd.org> @@ -88,7 +88,7 @@ vioscsi_next_ring_item(struct vioscsi_dev *dev, struct vring_avail *avail, static const char * vioscsi_op_names(uint8_t type) { - switch(type) { + switch (type) { /* defined in scsi_all.h */ case TEST_UNIT_READY: return "TEST_UNIT_READY"; case REQUEST_SENSE: return "REQUEST_SENSE"; @@ -354,7 +354,7 @@ vioscsi_handle_mode_sense(struct vioscsi_dev *dev, * ERR_RECOVERY_PAGE is 12 bytes * CDVD_CAPABILITIES_PAGE is 27 bytes */ - switch(mode_page_code) { + switch (mode_page_code) { case ERR_RECOVERY_PAGE: mode_reply_len = 16; mode_reply = @@ -454,7 +454,7 @@ mode_sense_error: __func__, acct->resp_desc->addr); goto mode_sense_out; } - + ret = 1; dev->cfg.isr_status = 1; /* Move ring indexes */ @@ -497,7 +497,7 @@ vioscsi_handle_mode_sense_big(struct vioscsi_dev *dev, * ERR_RECOVERY_PAGE is 12 bytes * CDVD_CAPABILITIES_PAGE is 27 bytes */ - switch(mode_page_code) { + switch (mode_page_code) { case ERR_RECOVERY_PAGE: mode_reply_len = 20; mode_reply = @@ -596,14 +596,14 @@ mode_sense_big_error: __func__, acct->resp_desc->addr); goto mode_sense_big_out; } - + ret = 1; dev->cfg.isr_status = 1; /* Move ring indexes */ vioscsi_next_ring_item(dev, acct->avail, acct->used, acct->req_desc, acct->req_idx); } -mode_sense_big_out: +mode_sense_big_out: return (ret); } @@ -661,7 +661,7 @@ vioscsi_handle_read_capacity(struct vioscsi_dev *dev, "idx %d req_idx %d global_idx %d", __func__, acct->resp_desc->addr, acct->resp_desc->len, acct->resp_idx, acct->req_idx, acct->idx); - + if (write_mem(acct->resp_desc->addr, &resp, acct->resp_desc->len)) { log_warnx("%s: unable to write OK resp status data @ 0x%llx", __func__, acct->resp_desc->addr); @@ -815,7 +815,7 @@ vioscsi_handle_report_luns(struct vioscsi_dev *dev, goto rpl_out; } - + reply_rpl = calloc(1, sizeof(*reply_rpl)); if (reply_rpl == NULL) { @@ -863,7 +863,7 @@ vioscsi_handle_report_luns(struct vioscsi_dev *dev, vioscsi_next_ring_item(dev, acct->avail, acct->used, acct->req_desc, acct->req_idx); } - + free_rpl: free(reply_rpl); rpl_out: @@ -1079,7 +1079,7 @@ vioscsi_handle_read_10(struct vioscsi_dev *dev, vioscsi_next_ring_item(dev, acct->avail, acct->used, acct->req_desc, acct->req_idx); } - + goto free_read_10; } @@ -1443,7 +1443,7 @@ vioscsi_handle_gesn(struct vioscsi_dev *dev, __func__, acct->resp_desc->addr); goto gesn_out; } - + ret = 1; dev->cfg.isr_status = 1; /* Move ring indexes */ @@ -1841,16 +1841,16 @@ vioscsi_io(int dir, uint16_t reg, uint32_t *data, uint8_t *intr, if (sz == 1) { /* read third byte of cmd_per_lun */ *data &= 0xFFFFFF00; - *data |= - (uint32_t)(VIOSCSI_CMD_PER_LUN >> 16) & 0xFF; + *data |= (uint32_t)(VIOSCSI_CMD_PER_LUN >> 16) + & 0xFF; } break; case VIRTIO_CONFIG_DEVICE_CONFIG_NOMSI + 15: if (sz == 1) { /* read fourth byte of cmd_per_lun */ *data &= 0xFFFFFF00; - *data |= - (uint32_t)(VIOSCSI_CMD_PER_LUN >> 24) & 0xFF; + *data |= (uint32_t)(VIOSCSI_CMD_PER_LUN >> 24) + & 0xFF; } break; case VIRTIO_CONFIG_DEVICE_CONFIG_NOMSI + 16: @@ -1927,10 +1927,13 @@ vioscsi_io(int dir, uint16_t reg, uint32_t *data, uint8_t *intr, break; case VIRTIO_CONFIG_DEVICE_CONFIG_NOMSI + 28: /* VIRTIO_SCSI_CONFIG_MAX_CHANNEL, 16bit */ - *data &= 0xFFFF0000; /* defined by standard to be zero */ + + /* defined by standard to be zero */ + *data &= 0xFFFF0000; break; case VIRTIO_CONFIG_DEVICE_CONFIG_NOMSI + 29: - *data &= 0xFFFF0000; /* defined by standard to be zero */ + /* defined by standard to be zero */ + *data &= 0xFFFF0000; break; case VIRTIO_CONFIG_DEVICE_CONFIG_NOMSI + 30: /* VIRTIO_SCSI_CONFIG_MAX_TARGET, 16bit */ @@ -2039,7 +2042,7 @@ void vioscsi_update_qs(struct vioscsi_dev *dev) { /* Invalid queue? */ - if(dev->cfg.queue_select > VIRTIO_MAX_QUEUES) { + if (dev->cfg.queue_select > VIRTIO_MAX_QUEUES) { dev->cfg.queue_size = 0; return; } @@ -2053,7 +2056,7 @@ void vioscsi_update_qa(struct vioscsi_dev *dev) { /* Invalid queue? */ - if(dev->cfg.queue_select > VIRTIO_MAX_QUEUES) + if (dev->cfg.queue_select > VIRTIO_MAX_QUEUES) return; dev->vq[dev->cfg.queue_select].qa = dev->cfg.queue_address; @@ -2191,7 +2194,7 @@ vioscsi_notifyq(struct vioscsi_dev *dev) req.cdb[0], vioscsi_op_names(req.cdb[0])); /* opcode is first byte */ - switch(req.cdb[0]) { + switch (req.cdb[0]) { case TEST_UNIT_READY: case START_STOP: ret = vioscsi_handle_tur(dev, &req, &acct); diff --git a/usr.sbin/vmd/virtio.c b/usr.sbin/vmd/virtio.c index fc28bda51fb..4452cfcbb53 100644 --- a/usr.sbin/vmd/virtio.c +++ b/usr.sbin/vmd/virtio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: virtio.c,v 1.60 2018/04/30 08:27:53 mlarkin Exp $ */ +/* $OpenBSD: virtio.c,v 1.61 2018/06/19 17:12:34 reyk Exp $ */ /* * Copyright (c) 2015 Mike Larkin <mlarkin@openbsd.org> @@ -384,7 +384,8 @@ vioblk_finish_read(struct ioinfo *info) } static struct ioinfo * -vioblk_start_write(struct vioblk_dev *dev, off_t sector, paddr_t addr, size_t len) +vioblk_start_write(struct vioblk_dev *dev, off_t sector, + paddr_t addr, size_t len) { struct ioinfo *info; @@ -510,10 +511,11 @@ vioblk_notifyq(struct vioblk_dev *dev) struct ioinfo *info; const uint8_t *secdata; - info = vioblk_start_read(dev, cmd.sector + secbias, + info = vioblk_start_read(dev, + cmd.sector + secbias, (ssize_t)secdata_desc->len); - /* read the data (use current data descriptor) */ + /* read the data, use current data descriptor */ secdata = vioblk_finish_read(info); if (secdata == NULL) { vioblk_free_info(info); @@ -527,14 +529,16 @@ vioblk_notifyq(struct vioblk_dev *dev) log_warnx("can't write sector " "data to gpa @ 0x%llx", secdata_desc->addr); - dump_descriptor_chain(desc, cmd_desc_idx); + dump_descriptor_chain(desc, + cmd_desc_idx); vioblk_free_info(info); goto out; } vioblk_free_info(info); - secbias += (secdata_desc->len / VIRTIO_BLK_SECTOR_SIZE); + secbias += (secdata_desc->len / + VIRTIO_BLK_SECTOR_SIZE); secdata_desc_idx = secdata_desc->next & VIOBLK_QUEUE_MASK; secdata_desc = &desc[secdata_desc_idx]; @@ -553,8 +557,10 @@ vioblk_notifyq(struct vioblk_dev *dev) ret = 1; dev->cfg.isr_status = 1; - used->ring[used->idx & VIOBLK_QUEUE_MASK].id = cmd_desc_idx; - used->ring[used->idx & VIOBLK_QUEUE_MASK].len = cmd_desc->len; + used->ring[used->idx & VIOBLK_QUEUE_MASK].id = + cmd_desc_idx; + used->ring[used->idx & VIOBLK_QUEUE_MASK].len = + cmd_desc->len; used->idx++; dev->vq[dev->cfg.queue_notify].last_avail = avail->idx & @@ -585,7 +591,8 @@ vioblk_notifyq(struct vioblk_dev *dev) do { struct ioinfo *info; - info = vioblk_start_write(dev, cmd.sector + secbias, + info = vioblk_start_write(dev, + cmd.sector + secbias, secdata_desc->addr, secdata_desc->len); if (info == NULL) { @@ -645,7 +652,8 @@ vioblk_notifyq(struct vioblk_dev *dev) ds = VIRTIO_BLK_S_OK; if (write_mem(ds_desc->addr, &ds, ds_desc->len)) { - log_warnx("fl vioblk: can't write device status " + log_warnx("fl vioblk: " + "can't write device status " "data @ 0x%llx", ds_desc->addr); dump_descriptor_chain(desc, cmd_desc_idx); goto out; @@ -867,7 +875,8 @@ virtio_blk_io(int dir, uint16_t reg, uint32_t *data, uint8_t *intr, *data |= (uint32_t)(dev->max_xfer >> 16) & 0xFF; } else if (sz == 2) { *data &= 0xFFFF0000; - *data |= (uint32_t)(dev->max_xfer >> 16) & 0xFFFF; + *data |= (uint32_t)(dev->max_xfer >> 16) + & 0xFFFF; } /* XXX handle invalid sz */ break; diff --git a/usr.sbin/vmd/vm.c b/usr.sbin/vmd/vm.c index a240623752f..a797a417dc8 100644 --- a/usr.sbin/vmd/vm.c +++ b/usr.sbin/vmd/vm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm.c,v 1.33 2018/04/27 12:15:10 mlarkin Exp $ */ +/* $OpenBSD: vm.c,v 1.34 2018/06/19 17:12:34 reyk Exp $ */ /* * Copyright (c) 2015 Mike Larkin <mlarkin@openbsd.org> @@ -502,7 +502,7 @@ send_vm(int fd, struct vm_create_params *vcp) unsigned int flags = 0; unsigned int i; int ret = 0; - size_t sz; + size_t sz; if (dump_send_header(fd)) { log_info("%s: failed to send vm dump header", __func__); @@ -646,7 +646,7 @@ dump_vmr(int fd, struct vm_mem_range *vmr) char buf[PAGE_SIZE]; while (rem > 0) { - if(read_mem(vmr->vmr_gpa + read, buf, PAGE_SIZE)) { + if (read_mem(vmr->vmr_gpa + read, buf, PAGE_SIZE)) { log_warn("failed to read vmr"); return (-1); } @@ -1318,11 +1318,13 @@ vcpu_run_loop(void *arg) /* Still more pending? */ if (i8259_is_pending()) { /* XXX can probably avoid ioctls here by providing intr in vrp */ - if (vcpu_pic_intr(vrp->vrp_vm_id, vrp->vrp_vcpu_id, 1)) { + if (vcpu_pic_intr(vrp->vrp_vm_id, + vrp->vrp_vcpu_id, 1)) { fatal("can't set INTR"); } } else { - if (vcpu_pic_intr(vrp->vrp_vm_id, vrp->vrp_vcpu_id, 0)) { + if (vcpu_pic_intr(vrp->vrp_vm_id, + vrp->vrp_vcpu_id, 0)) { fatal("can't clear INTR"); } } @@ -1890,9 +1892,10 @@ set_return_data(union vm_exit *vei, uint32_t data) /* * get_input_data * - * Utility function for manipulating register data in vm exit info structs. This - * function ensures that the data is copied from the vei->vei.vei_data field with - * the proper size for the operation being performed. + * Utility function for manipulating register data in vm exit info + * structs. This function ensures that the data is copied from the + * vei->vei.vei_data field with the proper size for the operation being + * performed. * * Parameters: * vei: exit information diff --git a/usr.sbin/vmd/vmd.c b/usr.sbin/vmd/vmd.c index 0aa3424208d..cc2af555a16 100644 --- a/usr.sbin/vmd/vmd.c +++ b/usr.sbin/vmd/vmd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vmd.c,v 1.85 2018/05/13 22:48:11 pd Exp $ */ +/* $OpenBSD: vmd.c,v 1.86 2018/06/19 17:12:34 reyk Exp $ */ /* * Copyright (c) 2015 Reyk Floeter <reyk@openbsd.org> @@ -103,7 +103,8 @@ vmd_dispatch_control(int fd, struct privsep_proc *p, struct imsg *imsg) cmd = IMSG_VMDOP_START_VM_RESPONSE; } if (res == 0 && - config_setvm(ps, vm, imsg->hdr.peerid, vm->vm_params.vmc_uid) == -1) { + config_setvm(ps, vm, + imsg->hdr.peerid, vm->vm_params.vmc_uid) == -1) { res = errno; cmd = IMSG_VMDOP_START_VM_RESPONSE; } @@ -240,7 +241,8 @@ vmd_dispatch_control(int fd, struct privsep_proc *p, struct imsg *imsg) cmd = IMSG_VMDOP_START_VM_RESPONSE; break; } - if(check_vmh(&vmh)) { + + if (check_vmh(&vmh)) { res = ENOENT; close(imsg->fd); cmd = IMSG_VMDOP_START_VM_RESPONSE; @@ -469,7 +471,8 @@ vmd_dispatch_vmm(int fd, struct privsep_proc *p, struct imsg *imsg) vm->vm_params.vmc_params.vcp_name, VMM_MAX_NAME_LEN); vir.vir_info.vir_memory_size = - vm->vm_params.vmc_params.vcp_memranges[0].vmr_size; + vm->vm_params.vmc_params. + vcp_memranges[0].vmr_size; vir.vir_info.vir_ncpus = vm->vm_params.vmc_params.vcp_ncpus; /* get the configured user id for this vm */ @@ -497,7 +500,8 @@ vmd_dispatch_vmm(int fd, struct privsep_proc *p, struct imsg *imsg) } int -check_vmh(struct vm_dump_header *vmh) { +check_vmh(struct vm_dump_header *vmh) +{ int i; unsigned int code, leaf; unsigned int a, b, c, d; @@ -517,7 +521,7 @@ check_vmh(struct vm_dump_header *vmh) { return (-1); } - switch(code) { + switch (code) { case 0x00: CPUID_LEAF(code, leaf, a, b, c, d); if (vmh->vmh_cpuids[i].a > a) { @@ -854,7 +858,8 @@ vmd_configure(void) vm->vm_params.vmc_params.vcp_name); continue; } - if (config_setvm(&env->vmd_ps, vm, -1, vm->vm_params.vmc_uid) == -1) + if (config_setvm(&env->vmd_ps, vm, + -1, vm->vm_params.vmc_uid) == -1) return (-1); } @@ -890,7 +895,8 @@ vmd_reload(unsigned int reset, const char *filename) */ if (reload) { - TAILQ_FOREACH_SAFE(vm, env->vmd_vms, vm_entry, next_vm) { + TAILQ_FOREACH_SAFE(vm, env->vmd_vms, vm_entry, + next_vm) { if (vm->vm_running == 0) { log_debug("%s: calling vm_remove", __func__); @@ -930,7 +936,8 @@ vmd_reload(unsigned int reset, const char *filename) vm->vm_params.vmc_params.vcp_name); continue; } - if (config_setvm(&env->vmd_ps, vm, -1, vm->vm_params.vmc_uid) == -1) + if (config_setvm(&env->vmd_ps, vm, + -1, vm->vm_params.vmc_uid) == -1) return (-1); } else { log_debug("%s: not creating vm \"%s\": " @@ -1159,14 +1166,14 @@ vm_register(struct privsep *ps, struct vmop_create_params *vmc, log_warnx("invalid VM name"); goto fail; } else if (*vcp->vcp_name == '-' || *vcp->vcp_name == '.' || - *vcp->vcp_name == '_') { - log_warnx("Invalid VM name"); + *vcp->vcp_name == '_') { + log_warnx("invalid VM name"); goto fail; } else { for (s = vcp->vcp_name; *s != '\0'; ++s) { if (!(isalnum(*s) || *s == '.' || *s == '-' || - *s == '_')) { - log_warnx("Invalid VM name"); + *s == '_')) { + log_warnx("invalid VM name"); goto fail; } } |