1168fce73SSepherosa Ziehau.\" Copyright (c) 2016 Microsoft Corp. 2168fce73SSepherosa Ziehau.\" All rights reserved. 3168fce73SSepherosa Ziehau.\" 4168fce73SSepherosa Ziehau.\" Redistribution and use in source and binary forms, with or without 5168fce73SSepherosa Ziehau.\" modification, are permitted provided that the following conditions 6168fce73SSepherosa Ziehau.\" are met: 7168fce73SSepherosa Ziehau.\" 1. Redistributions of source code must retain the above copyright 8168fce73SSepherosa Ziehau.\" notice, this list of conditions and the following disclaimer. 9168fce73SSepherosa Ziehau.\" 2. Redistributions in binary form must reproduce the above copyright 10168fce73SSepherosa Ziehau.\" notice, this list of conditions and the following disclaimer in the 11168fce73SSepherosa Ziehau.\" documentation and/or other materials provided with the distribution. 12168fce73SSepherosa Ziehau.\" 13168fce73SSepherosa Ziehau.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 14168fce73SSepherosa Ziehau.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15168fce73SSepherosa Ziehau.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16168fce73SSepherosa Ziehau.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 17168fce73SSepherosa Ziehau.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18168fce73SSepherosa Ziehau.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19168fce73SSepherosa Ziehau.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20168fce73SSepherosa Ziehau.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21168fce73SSepherosa Ziehau.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22168fce73SSepherosa Ziehau.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23168fce73SSepherosa Ziehau.\" SUCH DAMAGE. 24168fce73SSepherosa Ziehau.Dd October 12, 2016 25168fce73SSepherosa Ziehau.Dt HV_VSS 4 26168fce73SSepherosa Ziehau.Os 27168fce73SSepherosa Ziehau.Sh NAME 28168fce73SSepherosa Ziehau.Nm hv_vss 29168fce73SSepherosa Ziehau.Nd Hyper-V Volume Shadow Copy Service API 30168fce73SSepherosa Ziehau.Sh SYNOPSIS 31168fce73SSepherosa Ziehau.In dev/hyperv/hv_snapshot.h 32168fce73SSepherosa Ziehau.Bd -literal 33168fce73SSepherosa Ziehau#define VSS_SUCCESS 0x00000000 34168fce73SSepherosa Ziehau#define VSS_FAIL 0x00000001 35168fce73SSepherosa Ziehau 36168fce73SSepherosa Ziehauenum hv_vss_op_t { 37168fce73SSepherosa Ziehau HV_VSS_NONE = 0, 38168fce73SSepherosa Ziehau HV_VSS_CHECK, 39168fce73SSepherosa Ziehau HV_VSS_FREEZE, 40168fce73SSepherosa Ziehau HV_VSS_THAW, 41168fce73SSepherosa Ziehau HV_VSS_COUNT 42168fce73SSepherosa Ziehau}; 43168fce73SSepherosa Ziehau 44168fce73SSepherosa Ziehaustruct hv_vss_opt_msg { 45168fce73SSepherosa Ziehau uint32_t opt; /* operation */ 46168fce73SSepherosa Ziehau uint32_t status; /* 0 for success, 1 for error */ 47168fce73SSepherosa Ziehau uint64_t msgid; /* an ID used to identify the transaction */ 48168fce73SSepherosa Ziehau uint8_t reserved[48]; /* reserved values are all zeroes */ 49168fce73SSepherosa Ziehau}; 50168fce73SSepherosa Ziehau.Ed 51168fce73SSepherosa Ziehau.Sh DESCRIPTION 52168fce73SSepherosa ZiehauThe freeze or thaw functionality of application is important to guarantee 531cc60ae8SBenedict Reuschlingthe application consistent backup. 541cc60ae8SBenedict ReuschlingOn windows platform, VSS is defined to do live backup. 551cc60ae8SBenedict ReuschlingBut for VM guest running on Hyper-V, the corresponding VSS is 561cc60ae8SBenedict Reuschlingnot defined yet. 571cc60ae8SBenedict ReuschlingFor example, a running database server instance, it knows when the 581cc60ae8SBenedict Reuschlingapplications' freeze/thaw should start or finish. 591cc60ae8SBenedict ReuschlingBut it is not aware of the freeze/thaw notification from Hyper-V host. 601cc60ae8SBenedict ReuschlingThe 61168fce73SSepherosa Ziehau.Nm 62168fce73SSepherosa Ziehauis designed to notify application freeze/thaw request. 63168fce73SSepherosa ZiehauThus, it plays a role of broker to forward the freeze/thaw command from Hyper-V host 64168fce73SSepherosa Ziehauto userland application if it registered VSS service on 65168fce73SSepherosa Ziehau.Fx 66168fce73SSepherosa ZiehauVM, and sends the result back to Hyper-V host. 67168fce73SSepherosa Ziehau.Pp 68168fce73SSepherosa ZiehauGenerally, 69168fce73SSepherosa Ziehau.Xr hv_vss_daemon 8 706e069af4SEd Mastetakes the responsibility to freeze/thaw UFS file system, 711cc60ae8SBenedict Reuschlingand it is automatically launched after system boots. 721cc60ae8SBenedict ReuschlingWhen Hyper-V host wants to take a snapshot of the 73168fce73SSepherosa Ziehau.Fx 74168fce73SSepherosa ZiehauVM, it will first send VSS capability check to 75168fce73SSepherosa Ziehau.Fx 761cc60ae8SBenedict ReuschlingVM. 771cc60ae8SBenedict ReuschlingThe 78168fce73SSepherosa Ziehau.Nm 79168fce73SSepherosa Ziehaureceived the request and forward the request to userland application if it is 801cc60ae8SBenedict Reuschlingregistered. 811cc60ae8SBenedict ReuschlingOnly after 82168fce73SSepherosa Ziehau.Nm 83168fce73SSepherosa Ziehaureceived the VSS_SUCCESS response from application, the 84168fce73SSepherosa Ziehau.Xr hv_vss_daemon 8 851cc60ae8SBenedict Reuschlingwill be informed to check whether file system freeze/thaw is supported. 861cc60ae8SBenedict ReuschlingAny error occurs during this period, 87168fce73SSepherosa Ziehau.Nm 881cc60ae8SBenedict Reuschlingwill inform Hyper-V host that VSS is not supported. 891cc60ae8SBenedict ReuschlingIn addition, there is a default timeout limit before sending response to Hyper-V host. 90168fce73SSepherosa ZiehauIf the total response time from application and 91168fce73SSepherosa Ziehau.Xr hv_vss_daemon 8 92168fce73SSepherosa Ziehauexceeds this value, timeout 93*ffc4f93eSBenedict Reuschlingwill occur and VSS unsupported is responded to Hyper-V host. 94168fce73SSepherosa Ziehau.Pp 95168fce73SSepherosa ZiehauAfter Hyper-V host confirmed the 96168fce73SSepherosa Ziehau.Fx 97168fce73SSepherosa ZiehauVM supports VSS, it will send freeze request to VM, and 98168fce73SSepherosa Ziehau.Nm 991cc60ae8SBenedict Reuschlingwill first forward it to application. 1001cc60ae8SBenedict ReuschlingAfter application finished freezing, it should inform 101168fce73SSepherosa Ziehau.Nm 102168fce73SSepherosa Ziehauand file system level freezing will be triggered by 1031cc60ae8SBenedict Reuschling.Xr hv_vss_daemon 8 . 1041cc60ae8SBenedict ReuschlingAfter all freezing on both application and 105168fce73SSepherosa Ziehau.Xr hv_vss_daemon 8 106168fce73SSepherosa Ziehauwere finished, the 107168fce73SSepherosa Ziehau.Nm 1081cc60ae8SBenedict Reuschlingwill inform Hyper-V host that freezing is done. 1091cc60ae8SBenedict ReuschlingOf course, there is a timeout limit as same as VSS capability is set to make sure freezing on 110168fce73SSepherosa Ziehau.Fx 1111cc60ae8SBenedict ReuschlingVM is not hang. 1121cc60ae8SBenedict ReuschlingIf there is any error occurs or timeout happened, the freezing is failed on Hyper-V side. 113168fce73SSepherosa Ziehau.Pp 114168fce73SSepherosa ZiehauHyper-V host will send thaw request after taking the snapshot, typically, this period is 115168fce73SSepherosa Ziehauvery short in order not to block the running application. 116168fce73SSepherosa Ziehau.Nm 117168fce73SSepherosa Ziehaufirstly thaw the file system by notifying 118168fce73SSepherosa Ziehau.Xr hv_vss_daemon 8 , 119168fce73SSepherosa Ziehauthen notifies user registered 1201cc60ae8SBenedict Reuschlingapplication. 1211cc60ae8SBenedict ReuschlingThere is also a timeout check before sending response to Hyper-V host. 122168fce73SSepherosa Ziehau.Pp 123168fce73SSepherosa ZiehauAll the default timeout limit used in VSS capability check, freeze or thaw is the same. 124168fce73SSepherosa ZiehauIt is 15 seconds currently. 125168fce73SSepherosa Ziehau.Sh NOTES 126168fce73SSepherosa Ziehau.Nm 1271cc60ae8SBenedict Reuschlingonly support UFS currently. 1281cc60ae8SBenedict ReuschlingIf any of file system partition is non UFS, the VSS capability check will fail. 1291cc60ae8SBenedict ReuschlingIf application does not register VSS, 130168fce73SSepherosa Ziehau.Nm 1311cc60ae8SBenedict Reuschlingonly support backup for file system level consistent. 1321cc60ae8SBenedict ReuschlingThe device should be closed before it was opened again. 1331cc60ae8SBenedict ReuschlingIf you want to simultaneously open "/dev/hv_appvss_dev" two or more times, 134168fce73SSepherosa Ziehauan error (-1) will be returned, and errno was set. 135168fce73SSepherosa Ziehau.Pp 136168fce73SSepherosa ZiehauIf 137168fce73SSepherosa Ziehau.Xr hv_vss_daemon 8 138168fce73SSepherosa Ziehauwas killed after system boots, the VSS functionality will not work. 139168fce73SSepherosa Ziehau.Sh EXAMPLES 140168fce73SSepherosa ZiehauThe following is a complete example which does nothing except for waiting 2 seconds when 141168fce73SSepherosa Ziehaureceiving those notifications from 142168fce73SSepherosa Ziehau.Nm 143168fce73SSepherosa Ziehau.Bd -literal 144168fce73SSepherosa Ziehau#include <string.h> 145168fce73SSepherosa Ziehau#include <stdio.h> 146168fce73SSepherosa Ziehau#include <sys/ioctl.h> 147168fce73SSepherosa Ziehau#include <sys/param.h> 148168fce73SSepherosa Ziehau#include <sys/ucred.h> 149168fce73SSepherosa Ziehau#include <sys/mount.h> 150168fce73SSepherosa Ziehau#include <sys/types.h> 151168fce73SSepherosa Ziehau#include <unistd.h> 152168fce73SSepherosa Ziehau#include <stdlib.h> 153168fce73SSepherosa Ziehau#include <poll.h> 154168fce73SSepherosa Ziehau#include <stdint.h> 155168fce73SSepherosa Ziehau#include <syslog.h> 156168fce73SSepherosa Ziehau#include <errno.h> 157168fce73SSepherosa Ziehau#include <err.h> 158168fce73SSepherosa Ziehau#include <fcntl.h> 159168fce73SSepherosa Ziehau#include <ufs/ffs/fs.h> 160168fce73SSepherosa Ziehau#include <paths.h> 161168fce73SSepherosa Ziehau#include <sys/ioccom.h> 162168fce73SSepherosa Ziehau#include <dev/hyperv/hv_snapshot.h> 163168fce73SSepherosa Ziehau 164168fce73SSepherosa Ziehau#define UNDEF_FREEZE_THAW (0) 165168fce73SSepherosa Ziehau#define FREEZE (1) 166168fce73SSepherosa Ziehau#define THAW (2) 167168fce73SSepherosa Ziehau#define CHECK (3) 168168fce73SSepherosa Ziehau 169168fce73SSepherosa Ziehau#define VSS_LOG(priority, format, args...) do { \\ 170168fce73SSepherosa Ziehau if (is_debugging == 1) { \\ 171168fce73SSepherosa Ziehau if (is_daemon == 1) \\ 172168fce73SSepherosa Ziehau syslog(priority, format, ## args); \\ 173168fce73SSepherosa Ziehau else \\ 174168fce73SSepherosa Ziehau printf(format, ## args); \\ 175168fce73SSepherosa Ziehau } else { \\ 176168fce73SSepherosa Ziehau if (priority < LOG_DEBUG) { \\ 177168fce73SSepherosa Ziehau if (is_daemon == 1) \\ 178168fce73SSepherosa Ziehau syslog(priority, format, ## args); \\ 179168fce73SSepherosa Ziehau else \\ 180168fce73SSepherosa Ziehau printf(format, ## args); \\ 181168fce73SSepherosa Ziehau } \\ 182168fce73SSepherosa Ziehau } \\ 183168fce73SSepherosa Ziehau } while(0) 184168fce73SSepherosa Ziehau 185168fce73SSepherosa Ziehau#define CHECK_TIMEOUT 1 186168fce73SSepherosa Ziehau#define CHECK_FAIL 2 187168fce73SSepherosa Ziehau#define FREEZE_TIMEOUT 1 188168fce73SSepherosa Ziehau#define FREEZE_FAIL 2 189168fce73SSepherosa Ziehau#define THAW_TIMEOUT 1 190168fce73SSepherosa Ziehau#define THAW_FAIL 2 191168fce73SSepherosa Ziehau 192168fce73SSepherosa Ziehaustatic int is_daemon = 1; 193168fce73SSepherosa Ziehaustatic int is_debugging = 0; 194168fce73SSepherosa Ziehaustatic int simu_opt_waiting = 2; // seconds 195168fce73SSepherosa Ziehau 196168fce73SSepherosa Ziehau#define GENERIC_OPT(TIMEOUT, FAIL) \\ 197168fce73SSepherosa Ziehau do { \\ 198168fce73SSepherosa Ziehau sleep(simu_opt_waiting); \\ 199168fce73SSepherosa Ziehau if (opt == CHECK_TIMEOUT) { \\ 200168fce73SSepherosa Ziehau sleep(simu_opt_waiting * 10); \\ 201168fce73SSepherosa Ziehau VSS_LOG(LOG_INFO, "%s timeout simulation\\n", \\ 202168fce73SSepherosa Ziehau __func__); \\ 203168fce73SSepherosa Ziehau return (0); \\ 204168fce73SSepherosa Ziehau } else if (opt == CHECK_FAIL) { \\ 205168fce73SSepherosa Ziehau VSS_LOG(LOG_INFO, "%s failure simulation\\n", \\ 206168fce73SSepherosa Ziehau __func__); \\ 207168fce73SSepherosa Ziehau return (CHECK_FAIL); \\ 208168fce73SSepherosa Ziehau } else { \\ 209168fce73SSepherosa Ziehau VSS_LOG(LOG_INFO, "%s success simulation\\n", \\ 210168fce73SSepherosa Ziehau __func__); \\ 211168fce73SSepherosa Ziehau return (0); \\ 212168fce73SSepherosa Ziehau } \\ 213168fce73SSepherosa Ziehau } while (0) 214168fce73SSepherosa Ziehau 215168fce73SSepherosa Ziehaustatic int 216168fce73SSepherosa Ziehaucheck(int opt) 217168fce73SSepherosa Ziehau{ 218168fce73SSepherosa Ziehau GENERIC_OPT(CHECK_TIMEOUT, CHECK_FAIL); 219168fce73SSepherosa Ziehau} 220168fce73SSepherosa Ziehau 221168fce73SSepherosa Ziehaustatic int 222168fce73SSepherosa Ziehaufreeze(int opt) 223168fce73SSepherosa Ziehau{ 224168fce73SSepherosa Ziehau GENERIC_OPT(FREEZE_TIMEOUT, FREEZE_FAIL); 225168fce73SSepherosa Ziehau} 226168fce73SSepherosa Ziehau 227168fce73SSepherosa Ziehaustatic int 228168fce73SSepherosa Ziehauthaw(int opt) 229168fce73SSepherosa Ziehau{ 230168fce73SSepherosa Ziehau GENERIC_OPT(THAW_TIMEOUT, THAW_FAIL); 231168fce73SSepherosa Ziehau} 232168fce73SSepherosa Ziehau 233168fce73SSepherosa Ziehaustatic void usage(const char* cmd) { 234168fce73SSepherosa Ziehau fprintf(stderr, 235168fce73SSepherosa Ziehau "%s -f <0|1|2>: simulate app freeze." 236168fce73SSepherosa Ziehau " 0: successful, 1: freeze timeout, 2: freeze failed\\n" 237168fce73SSepherosa Ziehau " -c <0|1|2>: simulate vss feature check" 238168fce73SSepherosa Ziehau " -t <0|1|2>: simulate app thaw." 239168fce73SSepherosa Ziehau " 0: successful, 1: freeze timeout, 2: freeze failed\\n" 240168fce73SSepherosa Ziehau " -d : enable debug mode\\n" 241168fce73SSepherosa Ziehau " -n : run this tool under non-daemon mode\\n", cmd); 242168fce73SSepherosa Ziehau} 243168fce73SSepherosa Ziehau 244168fce73SSepherosa Ziehauint 245168fce73SSepherosa Ziehaumain(int argc, char* argv[]) { 246168fce73SSepherosa Ziehau int ch, freezesimuop = 0, thawsimuop = 0, checksimuop = 0, fd, r, error; 247168fce73SSepherosa Ziehau uint32_t op; 248168fce73SSepherosa Ziehau struct pollfd app_vss_fd[1]; 249168fce73SSepherosa Ziehau struct hv_vss_opt_msg userdata; 250168fce73SSepherosa Ziehau 251168fce73SSepherosa Ziehau while ((ch = getopt(argc, argv, "f:c:t:dnh")) != -1) { 252168fce73SSepherosa Ziehau switch (ch) { 253168fce73SSepherosa Ziehau case 'f': 254168fce73SSepherosa Ziehau /* Run as regular process for debugging purpose. */ 255168fce73SSepherosa Ziehau freezesimuop = (int)strtol(optarg, NULL, 10); 256168fce73SSepherosa Ziehau break; 257168fce73SSepherosa Ziehau case 't': 258168fce73SSepherosa Ziehau thawsimuop = (int)strtol(optarg, NULL, 10); 259168fce73SSepherosa Ziehau break; 260168fce73SSepherosa Ziehau case 'c': 261168fce73SSepherosa Ziehau checksimuop = (int)strtol(optarg, NULL, 10); 262168fce73SSepherosa Ziehau break; 263168fce73SSepherosa Ziehau case 'd': 264168fce73SSepherosa Ziehau is_debugging = 1; 265168fce73SSepherosa Ziehau break; 266168fce73SSepherosa Ziehau case 'n': 267168fce73SSepherosa Ziehau is_daemon = 0; 268168fce73SSepherosa Ziehau break; 269168fce73SSepherosa Ziehau case 'h': 270168fce73SSepherosa Ziehau default: 271168fce73SSepherosa Ziehau usage(argv[0]); 272168fce73SSepherosa Ziehau exit(0); 273168fce73SSepherosa Ziehau } 274168fce73SSepherosa Ziehau } 275168fce73SSepherosa Ziehau 276168fce73SSepherosa Ziehau openlog("APPVSS", 0, LOG_USER); 277168fce73SSepherosa Ziehau /* Become daemon first. */ 278168fce73SSepherosa Ziehau if (is_daemon == 1) 279168fce73SSepherosa Ziehau daemon(1, 0); 280168fce73SSepherosa Ziehau else 281168fce73SSepherosa Ziehau VSS_LOG(LOG_DEBUG, "Run as regular process.\\n"); 282168fce73SSepherosa Ziehau 283168fce73SSepherosa Ziehau VSS_LOG(LOG_INFO, "HV_VSS starting; pid is: %d\\n", getpid()); 284168fce73SSepherosa Ziehau 285168fce73SSepherosa Ziehau fd = open(VSS_DEV(APP_VSS_DEV_NAME), O_RDWR); 286168fce73SSepherosa Ziehau if (fd < 0) { 287168fce73SSepherosa Ziehau VSS_LOG(LOG_ERR, "Fail to open %s, error: %d %s\\n", 288168fce73SSepherosa Ziehau VSS_DEV(APP_VSS_DEV_NAME), errno, strerror(errno)); 289168fce73SSepherosa Ziehau exit(EXIT_FAILURE); 290168fce73SSepherosa Ziehau } 291168fce73SSepherosa Ziehau app_vss_fd[0].fd = fd; 292168fce73SSepherosa Ziehau app_vss_fd[0].events = POLLIN | POLLRDNORM; 293168fce73SSepherosa Ziehau 294168fce73SSepherosa Ziehau while (1) { 295168fce73SSepherosa Ziehau r = poll(app_vss_fd, 1, INFTIM); 296168fce73SSepherosa Ziehau 297168fce73SSepherosa Ziehau VSS_LOG(LOG_DEBUG, "poll returned r = %d, revent = 0x%x\\n", 298168fce73SSepherosa Ziehau r, app_vss_fd[0].revents); 299168fce73SSepherosa Ziehau 300168fce73SSepherosa Ziehau if (r == 0 || (r < 0 && errno == EAGAIN) || 301168fce73SSepherosa Ziehau (r < 0 && errno == EINTR)) { 302168fce73SSepherosa Ziehau /* Nothing to read */ 303168fce73SSepherosa Ziehau continue; 304168fce73SSepherosa Ziehau } 305168fce73SSepherosa Ziehau 306168fce73SSepherosa Ziehau if (r < 0) { 307168fce73SSepherosa Ziehau /* 308168fce73SSepherosa Ziehau * For poll return failure other than EAGAIN, 309168fce73SSepherosa Ziehau * we want to exit. 310168fce73SSepherosa Ziehau */ 311168fce73SSepherosa Ziehau VSS_LOG(LOG_ERR, "Poll failed.\\n"); 312168fce73SSepherosa Ziehau perror("poll"); 313168fce73SSepherosa Ziehau exit(EIO); 314168fce73SSepherosa Ziehau } 315168fce73SSepherosa Ziehau 316168fce73SSepherosa Ziehau /* Read from character device */ 317168fce73SSepherosa Ziehau error = ioctl(fd, IOCHVVSSREAD, &userdata); 318168fce73SSepherosa Ziehau if (error < 0) { 319168fce73SSepherosa Ziehau VSS_LOG(LOG_ERR, "Read failed.\\n"); 320168fce73SSepherosa Ziehau perror("pread"); 321168fce73SSepherosa Ziehau exit(EIO); 322168fce73SSepherosa Ziehau } 323168fce73SSepherosa Ziehau 324168fce73SSepherosa Ziehau if (userdata.status != 0) { 325168fce73SSepherosa Ziehau VSS_LOG(LOG_ERR, "data read error\\n"); 326168fce73SSepherosa Ziehau continue; 327168fce73SSepherosa Ziehau } 328168fce73SSepherosa Ziehau 329168fce73SSepherosa Ziehau op = userdata.opt; 330168fce73SSepherosa Ziehau 331168fce73SSepherosa Ziehau switch (op) { 332168fce73SSepherosa Ziehau case HV_VSS_CHECK: 333168fce73SSepherosa Ziehau error = check(checksimuop); 334168fce73SSepherosa Ziehau break; 335168fce73SSepherosa Ziehau case HV_VSS_FREEZE: 336168fce73SSepherosa Ziehau error = freeze(freezesimuop); 337168fce73SSepherosa Ziehau break; 338168fce73SSepherosa Ziehau case HV_VSS_THAW: 339168fce73SSepherosa Ziehau error = thaw(thawsimuop); 340168fce73SSepherosa Ziehau break; 341168fce73SSepherosa Ziehau default: 342168fce73SSepherosa Ziehau VSS_LOG(LOG_ERR, "Illegal operation: %d\\n", op); 343168fce73SSepherosa Ziehau error = VSS_FAIL; 344168fce73SSepherosa Ziehau } 345168fce73SSepherosa Ziehau if (error) 346168fce73SSepherosa Ziehau userdata.status = VSS_FAIL; 347168fce73SSepherosa Ziehau else 348168fce73SSepherosa Ziehau userdata.status = VSS_SUCCESS; 349168fce73SSepherosa Ziehau error = ioctl(fd, IOCHVVSSWRITE, &userdata); 350168fce73SSepherosa Ziehau if (error != 0) { 351168fce73SSepherosa Ziehau VSS_LOG(LOG_ERR, "Fail to write to device\\n"); 352168fce73SSepherosa Ziehau exit(EXIT_FAILURE); 353168fce73SSepherosa Ziehau } else { 354168fce73SSepherosa Ziehau VSS_LOG(LOG_INFO, "Send response %d for %s to kernel\\n", 355168fce73SSepherosa Ziehau userdata.status, op == HV_VSS_FREEZE ? "Freeze" : 356168fce73SSepherosa Ziehau (op == HV_VSS_THAW ? "Thaw" : "Check")); 357168fce73SSepherosa Ziehau } 358168fce73SSepherosa Ziehau } 359168fce73SSepherosa Ziehau return 0; 360168fce73SSepherosa Ziehau} 3612940eb19SChristian Brueffer.Ed 362168fce73SSepherosa Ziehau.Sh SEE ALSO 3632940eb19SChristian Brueffer.Xr hv_utils 4 , 3642940eb19SChristian Brueffer.Xr hv_vss_daemon 8 365168fce73SSepherosa Ziehau.Sh HISTORY 366168fce73SSepherosa ZiehauThe daemon was introduced in October 2016 and developed by Microsoft Corp. 367168fce73SSepherosa Ziehau.Sh AUTHORS 368168fce73SSepherosa Ziehau.An -nosplit 369168fce73SSepherosa Ziehau.Fx 370168fce73SSepherosa Ziehausupport for 371168fce73SSepherosa Ziehau.Nm 372168fce73SSepherosa Ziehauwas first added by 373168fce73SSepherosa Ziehau.An Microsoft BSD Integration Services Team Aq Mt bsdic@microsoft.com . 374