vmmapi.c (269042) | vmmapi.c (276428) |
---|---|
1/*- 2 * Copyright (c) 2011 NetApp, Inc. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * | 1/*- 2 * Copyright (c) 2011 NetApp, Inc. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * |
26 * $FreeBSD: head/lib/libvmmapi/vmmapi.c 269042 2014-07-24 01:38:11Z neel $ | 26 * $FreeBSD: head/lib/libvmmapi/vmmapi.c 276428 2014-12-30 22:19:34Z neel $ |
27 */ 28 29#include <sys/cdefs.h> | 27 */ 28 29#include <sys/cdefs.h> |
30__FBSDID("$FreeBSD: head/lib/libvmmapi/vmmapi.c 269042 2014-07-24 01:38:11Z neel $"); | 30__FBSDID("$FreeBSD: head/lib/libvmmapi/vmmapi.c 276428 2014-12-30 22:19:34Z neel $"); |
31 32#include <sys/param.h> 33#include <sys/sysctl.h> 34#include <sys/ioctl.h> 35#include <sys/mman.h> 36#include <sys/_iovec.h> 37#include <sys/cpuset.h> 38 --- 1102 unchanged lines hidden (view full) --- 1141 int error; 1142 1143 bzero(&vmii, sizeof(struct vm_intinfo)); 1144 vmii.vcpuid = vcpu; 1145 vmii.info1 = info1; 1146 error = ioctl(ctx->fd, VM_SET_INTINFO, &vmii); 1147 return (error); 1148} | 31 32#include <sys/param.h> 33#include <sys/sysctl.h> 34#include <sys/ioctl.h> 35#include <sys/mman.h> 36#include <sys/_iovec.h> 37#include <sys/cpuset.h> 38 --- 1102 unchanged lines hidden (view full) --- 1141 int error; 1142 1143 bzero(&vmii, sizeof(struct vm_intinfo)); 1144 vmii.vcpuid = vcpu; 1145 vmii.info1 = info1; 1146 error = ioctl(ctx->fd, VM_SET_INTINFO, &vmii); 1147 return (error); 1148} |
1149 1150int 1151vm_rtc_write(struct vmctx *ctx, int offset, uint8_t value) 1152{ 1153 struct vm_rtc_data rtcdata; 1154 int error; 1155 1156 bzero(&rtcdata, sizeof(struct vm_rtc_data)); 1157 rtcdata.offset = offset; 1158 rtcdata.value = value; 1159 error = ioctl(ctx->fd, VM_RTC_WRITE, &rtcdata); 1160 return (error); 1161} 1162 1163int 1164vm_rtc_read(struct vmctx *ctx, int offset, uint8_t *retval) 1165{ 1166 struct vm_rtc_data rtcdata; 1167 int error; 1168 1169 bzero(&rtcdata, sizeof(struct vm_rtc_data)); 1170 rtcdata.offset = offset; 1171 error = ioctl(ctx->fd, VM_RTC_READ, &rtcdata); 1172 if (error == 0) 1173 *retval = rtcdata.value; 1174 return (error); 1175} 1176 1177int 1178vm_rtc_settime(struct vmctx *ctx, time_t secs) 1179{ 1180 struct vm_rtc_time rtctime; 1181 int error; 1182 1183 bzero(&rtctime, sizeof(struct vm_rtc_time)); 1184 rtctime.secs = secs; 1185 error = ioctl(ctx->fd, VM_RTC_SETTIME, &rtctime); 1186 return (error); 1187} 1188 1189int 1190vm_rtc_gettime(struct vmctx *ctx, time_t *secs) 1191{ 1192 struct vm_rtc_time rtctime; 1193 int error; 1194 1195 bzero(&rtctime, sizeof(struct vm_rtc_time)); 1196 error = ioctl(ctx->fd, VM_RTC_GETTIME, &rtctime); 1197 if (error == 0) 1198 *secs = rtctime.secs; 1199 return (error); 1200} |
|