Received: by 10.223.164.202 with SMTP id h10csp2090703wrb; Mon, 27 Nov 2017 11:45:18 -0800 (PST) X-Google-Smtp-Source: AGs4zMYvJA0QV1sRFB4eV77DGJH7wPXA1HNGGgEhsTxktZGvzjvXTY33NwSWrMJ3aqHFhZo9rlAr X-Received: by 10.98.14.15 with SMTP id w15mr18988564pfi.222.1511811918041; Mon, 27 Nov 2017 11:45:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511811917; cv=none; d=google.com; s=arc-20160816; b=L3mO7zNrZ7roGeY/foRh3FJk4eCncpnC6zzjeEDc4wAzXMQyd57JDhzJkHdbBdPb7P JBYXiYj5x3wVE0s5y+xWBToS00t4mDbmiMzeAE4wX7BiMPCB8v6Vx6V8ozzWmX5InbQ3 p5JEv7eBg9roiFeUKmF9J+RA3Vlku7sREW/VOWD/8rpbWr/YzOwtMgNXGsQIcjO268HP No8kg7RLbXWnaIwRi+/9Mxy49aZdCCkOkFsrCQUfmGchQn23hBuUUrDl4yLJp48ccuJh gez8/5nY7LO/MlA1WyW3MF35aZ9hAuGL41tQdK/8wOYjC/Ks/48l+xGLwlvr41fJ/CTe gaCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=TaK/LZ+ATz2+nXsWSZpfWBo830G4IbjLoy9oYpnfC/A=; b=tw2YI8O1bUNYtnM+x+clcSEB+h2gsPdr/5Tun9knplG2asTFdaG+s2SB1JmiMw6c6o pGV0Hv2/3HdXWNi1FehFGOhjE5qxwRJPSnvyBwUl7j2aR0NXjIAL6HS7+cKDf/JmfvPJ w2ysw4ozZr0fcnhu0UpTJfXZAN7fZbHgkKQeFA+MNChlirs9XWYKpheowcq0Bpu3fmKr PmGqIoXk0Rl9V/hbouR5WcNjMTzWjLmL03VBF2XdF98mpAfxNITmrBJQadKZUTxGYGou CC9QtnvCNM/vbf33ta0uWCftSDZPXEP5tL4ymDmpf7ICqHW8kwtbDJYPP4sknNaYJIh8 i3JQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=toaZe3/u; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q13si22673664pgt.668.2017.11.27.11.45.06; Mon, 27 Nov 2017 11:45:17 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=toaZe3/u; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932068AbdK0ToV (ORCPT + 79 others); Mon, 27 Nov 2017 14:44:21 -0500 Received: from mail-oi0-f66.google.com ([209.85.218.66]:37225 "EHLO mail-oi0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753100AbdK0ToT (ORCPT ); Mon, 27 Nov 2017 14:44:19 -0500 Received: by mail-oi0-f66.google.com with SMTP id d93so12538861oic.4 for ; Mon, 27 Nov 2017 11:44:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=TaK/LZ+ATz2+nXsWSZpfWBo830G4IbjLoy9oYpnfC/A=; b=toaZe3/uQ3/plPTBnLwcJ11XKzx06iIiQpHlAw9aDwP/8c/L18hznrVHhPl7mnIB/z J6MYkFhXwbQNcZdblTc0NAeJyJ0HmbbjJmPJ9TkbK1K7baM+LVJvQVQhCZk5BWjfmNAZ d/iobYrDUEyVa8iVan+MbOYzOoUtFkP6Q0Dujh6O1BCfEX98ltRotAr6iI4N/725qdqF La0c7NVAVgK3dOyp4gQI/LFgPB79JXcCzSqdSy6OmADF7WU/dYgkq507XVTU+QiImLvE kH3n7YrXExVy7RR2E5KEE6l9DSs2Tn9NWwJWsazfzRmN5j2d4TQUYZLU8SyuoezYL1gH weyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=TaK/LZ+ATz2+nXsWSZpfWBo830G4IbjLoy9oYpnfC/A=; b=umav1txzPNtp/BwHHxeOEt4zwpdC0DYy23WTbJ2rORukdsITw6PfyY52C2rNke7jbG d/V1zlGIDAHzT3qkQ8WKVZR8MdnD3YnO3xdcfR9pzpQMYbIINSmAzeV/HqFDZu65+6YF 1j/plBPb6YBC9z7Z8Vslg8aeLHbzuLQqoRsXaJW3cu6EA27JJg0JxaXkvlf5mX/2CKBR ej63iIQtxLUTfUB245L1fAXFp1mXY6luXL8oNcblKHUVdzVxkVIgUfUHOPuBXg6x6HRK D8AyeJO5REdOHkTvgXyI1nR9yfYNnR4Elie1Znk4a2scKq8MYz/rDooWlAkB4oSi2EeM CK1Q== X-Gm-Message-State: AJaThX50f+f1kUReTMB6HQh5EoCchUXfJSHLl7PBDJCPz75lEF9ieStU /MyrAoXRGsXMThC1cAkrvS2N5Q== X-Received: by 10.202.245.144 with SMTP id t138mr24021593oih.201.1511811857846; Mon, 27 Nov 2017 11:44:17 -0800 (PST) Received: from Larrylap.localdomain (cpe-24-31-251-255.kc.res.rr.com. [24.31.251.255]) by smtp.gmail.com with ESMTPSA id t90sm11318667ota.79.2017.11.27.11.44.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 Nov 2017 11:44:17 -0800 (PST) Subject: Re: [PATCH resend v2 1/3] virt: Add vboxguest driver for Virtual Box Guest integration UAPI To: Hans de Goede , Arnd Bergmann , Greg Kroah-Hartman Cc: Michael Thayer , "Knut St . Osmundsen" , Christoph Hellwig , linux-kernel@vger.kernel.org References: <20171126151221.26410-1-hdegoede@redhat.com> <20171126151221.26410-2-hdegoede@redhat.com> From: Larry Finger Message-ID: Date: Mon, 27 Nov 2017 13:44:16 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <20171126151221.26410-2-hdegoede@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/26/2017 09:12 AM, Hans de Goede wrote: > This commit adds the headers describing the ioctl API for the > /dev/vboxguest device used by the Virtual Box Guest Additions > in Virtual Box virtual machines. > > The driver providing the /dev/vboxguest device will allow Virtual Box > Guest Additions features such as copy-and-paste, seamless mode and > OpenGL pass-through. > > Signed-off-by: Hans de Goede Minor comments inline in the code. Reviewed-by: Larry Finger Larry > --- > Changes in v2: > -Change all uapi headers to kernel coding style: Drop struct and enum typedefs > make type and struct-member names all lowercase, enum values all uppercase. > -Remove unused struct type declarations from some headers (shaving of another > 1000 lines) > -Remove or fixup doxygen style comments > -Get rid of CHECK macros, use a function taking in_ and out_size args instead > -Some other small codyingstyle fixes > -Split into multiple patches > --- > MAINTAINERS | 7 + > include/uapi/linux/vbox_err.h | 170 ++++++++++++++++ > include/uapi/linux/vbox_vmmdev_types.h | 237 +++++++++++++++++++++++ > include/uapi/linux/vboxguest.h | 341 +++++++++++++++++++++++++++++++++ > 4 files changed, 755 insertions(+) > create mode 100644 include/uapi/linux/vbox_err.h > create mode 100644 include/uapi/linux/vbox_vmmdev_types.h > create mode 100644 include/uapi/linux/vboxguest.h > > diff --git a/MAINTAINERS b/MAINTAINERS > index 275815e2ef44..fe3dc0e9b901 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -14549,6 +14549,13 @@ S: Maintained > F: drivers/virtio/virtio_input.c > F: include/uapi/linux/virtio_input.h > > +VIRTUAL BOX GUEST DEVICE DRIVER > +M: Hans de Goede > +M: Arnd Bergmann > +M: Greg Kroah-Hartman > +S: Maintained > +F: include/uapi/linux/vbox*.h > + > VIRTUAL SERIO DEVICE DRIVER > M: Stephen Chandler Paul > S: Maintained > diff --git a/include/uapi/linux/vbox_err.h b/include/uapi/linux/vbox_err.h > new file mode 100644 > index 000000000000..6f56d2952621 > --- /dev/null > +++ b/include/uapi/linux/vbox_err.h > @@ -0,0 +1,170 @@ > +/* > + * Copyright (C) 2017 Oracle Corporation > + * > + * Permission is hereby granted, free of charge, to any person obtaining a > + * copy of this software and associated documentation files (the "Software"), > + * to deal in the Software without restriction, including without limitation > + * the rights to use, copy, modify, merge, publish, distribute, sublicense, > + * and/or sell copies of the Software, and to permit persons to whom the > + * Software is furnished to do so, subject to the following conditions: > + * > + * The above copyright notice and this permission notice shall be included in > + * all copies or substantial portions of the Software. > + * > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR > + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, > + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL > + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR > + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, > + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR > + * OTHER DEALINGS IN THE SOFTWARE. > + */ > + > +#ifndef __UAPI_VBOX_ERR_H__ > +#define __UAPI_VBOX_ERR_H__ > + > +#define VINF_SUCCESS 0 > +#define VERR_GENERAL_FAILURE (-1) > +#define VERR_INVALID_PARAMETER (-2) > +#define VERR_INVALID_MAGIC (-3) > +#define VERR_INVALID_HANDLE (-4) > +#define VERR_LOCK_FAILED (-5) > +#define VERR_INVALID_POINTER (-6) > +#define VERR_IDT_FAILED (-7) > +#define VERR_NO_MEMORY (-8) > +#define VERR_ALREADY_LOADED (-9) > +#define VERR_PERMISSION_DENIED (-10) > +#define VERR_VERSION_MISMATCH (-11) > +#define VERR_NOT_IMPLEMENTED (-12) > +#define VERR_INVALID_FLAGS (-13) > + > +#define VERR_NOT_EQUAL (-18) > +#define VERR_NOT_SYMLINK (-19) > +#define VERR_NO_TMP_MEMORY (-20) > +#define VERR_INVALID_FMODE (-21) > +#define VERR_WRONG_ORDER (-22) > +#define VERR_NO_TLS_FOR_SELF (-23) > +#define VERR_FAILED_TO_SET_SELF_TLS (-24) > +#define VERR_NO_CONT_MEMORY (-26) > +#define VERR_NO_PAGE_MEMORY (-27) > +#define VERR_THREAD_IS_DEAD (-29) > +#define VERR_THREAD_NOT_WAITABLE (-30) > +#define VERR_PAGE_TABLE_NOT_PRESENT (-31) > +#define VERR_INVALID_CONTEXT (-32) > +#define VERR_TIMER_BUSY (-33) > +#define VERR_ADDRESS_CONFLICT (-34) > +#define VERR_UNRESOLVED_ERROR (-35) > +#define VERR_INVALID_FUNCTION (-36) > +#define VERR_NOT_SUPPORTED (-37) > +#define VERR_ACCESS_DENIED (-38) > +#define VERR_INTERRUPTED (-39) > +#define VERR_TIMEOUT (-40) > +#define VERR_BUFFER_OVERFLOW (-41) > +#define VERR_TOO_MUCH_DATA (-42) > +#define VERR_MAX_THRDS_REACHED (-43) > +#define VERR_MAX_PROCS_REACHED (-44) > +#define VERR_SIGNAL_REFUSED (-45) > +#define VERR_SIGNAL_PENDING (-46) > +#define VERR_SIGNAL_INVALID (-47) > +#define VERR_STATE_CHANGED (-48) > +#define VERR_INVALID_UUID_FORMAT (-49) > +#define VERR_PROCESS_NOT_FOUND (-50) > +#define VERR_PROCESS_RUNNING (-51) > +#define VERR_TRY_AGAIN (-52) > +#define VERR_PARSE_ERROR (-53) > +#define VERR_OUT_OF_RANGE (-54) > +#define VERR_NUMBER_TOO_BIG (-55) > +#define VERR_NO_DIGITS (-56) > +#define VERR_NEGATIVE_UNSIGNED (-57) > +#define VERR_NO_TRANSLATION (-58) > + > +#define VERR_NOT_FOUND (-78) > +#define VERR_INVALID_STATE (-79) > +#define VERR_OUT_OF_RESOURCES (-80) > + > +#define VERR_FILE_NOT_FOUND (-102) > +#define VERR_PATH_NOT_FOUND (-103) > +#define VERR_INVALID_NAME (-104) > +#define VERR_ALREADY_EXISTS (-105) > +#define VERR_TOO_MANY_OPEN_FILES (-106) > +#define VERR_SEEK (-107) > +#define VERR_NEGATIVE_SEEK (-108) > +#define VERR_SEEK_ON_DEVICE (-109) > +#define VERR_EOF (-110) > +#define VERR_READ_ERROR (-111) > +#define VERR_WRITE_ERROR (-112) > +#define VERR_WRITE_PROTECT (-113) > +#define VERR_SHARING_VIOLATION (-114) > +#define VERR_FILE_LOCK_FAILED (-115) > +#define VERR_FILE_LOCK_VIOLATION (-116) > +#define VERR_CANT_CREATE (-117) > +#define VERR_CANT_DELETE_DIRECTORY (-118) > +#define VERR_NOT_SAME_DEVICE (-119) > +#define VERR_FILENAME_TOO_LONG (-120) > +#define VERR_MEDIA_NOT_PRESENT (-121) > +#define VERR_MEDIA_NOT_RECOGNIZED (-122) > +#define VERR_FILE_NOT_LOCKED (-123) > +#define VERR_FILE_LOCK_LOST (-124) > +#define VERR_DIR_NOT_EMPTY (-125) > +#define VERR_NOT_A_DIRECTORY (-126) > +#define VERR_IS_A_DIRECTORY (-127) > +#define VERR_FILE_TOO_BIG (-128) > + > +#define VERR_NET_IO_ERROR (-400) > +#define VERR_NET_OUT_OF_RESOURCES (-401) > +#define VERR_NET_HOST_NOT_FOUND (-402) > +#define VERR_NET_PATH_NOT_FOUND (-403) > +#define VERR_NET_PRINT_ERROR (-404) > +#define VERR_NET_NO_NETWORK (-405) > +#define VERR_NET_NOT_UNIQUE_NAME (-406) > + > +#define VERR_NET_IN_PROGRESS (-436) > +#define VERR_NET_ALREADY_IN_PROGRESS (-437) > +#define VERR_NET_NOT_SOCKET (-438) > +#define VERR_NET_DEST_ADDRESS_REQUIRED (-439) > +#define VERR_NET_MSG_SIZE (-440) > +#define VERR_NET_PROTOCOL_TYPE (-441) > +#define VERR_NET_PROTOCOL_NOT_AVAILABLE (-442) > +#define VERR_NET_PROTOCOL_NOT_SUPPORTED (-443) > +#define VERR_NET_SOCKET_TYPE_NOT_SUPPORTED (-444) > +#define VERR_NET_OPERATION_NOT_SUPPORTED (-445) > +#define VERR_NET_PROTOCOL_FAMILY_NOT_SUPPORTED (-446) > +#define VERR_NET_ADDRESS_FAMILY_NOT_SUPPORTED (-447) > +#define VERR_NET_ADDRESS_IN_USE (-448) > +#define VERR_NET_ADDRESS_NOT_AVAILABLE (-449) > +#define VERR_NET_DOWN (-450) > +#define VERR_NET_UNREACHABLE (-451) > +#define VERR_NET_CONNECTION_RESET (-452) > +#define VERR_NET_CONNECTION_ABORTED (-453) > +#define VERR_NET_CONNECTION_RESET_BY_PEER (-454) > +#define VERR_NET_NO_BUFFER_SPACE (-455) > +#define VERR_NET_ALREADY_CONNECTED (-456) > +#define VERR_NET_NOT_CONNECTED (-457) > +#define VERR_NET_SHUTDOWN (-458) > +#define VERR_NET_TOO_MANY_REFERENCES (-459) > +#define VERR_NET_CONNECTION_TIMED_OUT (-460) > +#define VERR_NET_CONNECTION_REFUSED (-461) > +#define VERR_NET_HOST_DOWN (-464) > +#define VERR_NET_HOST_UNREACHABLE (-465) > +#define VERR_NET_PROTOCOL_ERROR (-466) > +#define VERR_NET_INCOMPLETE_TX_PACKET (-467) > + > +/* misc. unsorted codes */ > +#define VERR_RESOURCE_BUSY (-138) > +#define VERR_DISK_FULL (-152) > +#define VERR_TOO_MANY_SYMLINKS (-156) > +#define VERR_NO_MORE_FILES (-201) > +#define VERR_INTERNAL_ERROR (-225) > +#define VERR_INTERNAL_ERROR_2 (-226) > +#define VERR_INTERNAL_ERROR_3 (-227) > +#define VERR_INTERNAL_ERROR_4 (-228) > +#define VERR_DEV_IO_ERROR (-250) > +#define VERR_IO_BAD_LENGTH (-255) > +#define VERR_BROKEN_PIPE (-301) > +#define VERR_NO_DATA (-304) > +#define VERR_SEM_DESTROYED (-363) > +#define VERR_DEADLOCK (-365) > +#define VERR_BAD_EXE_FORMAT (-608) > +#define VINF_HGCM_ASYNC_EXECUTE (2903) > + > +#endif > diff --git a/include/uapi/linux/vbox_vmmdev_types.h b/include/uapi/linux/vbox_vmmdev_types.h > new file mode 100644 > index 000000000000..1fdabee603fa > --- /dev/null > +++ b/include/uapi/linux/vbox_vmmdev_types.h > @@ -0,0 +1,237 @@ > +/* > + * Virtual Device for Guest <-> VMM/Host communication, type definitions > + * which are also used for the vboxguest ioctl interface / by vboxsf > + * > + * Copyright (C) 2006-2016 Oracle Corporation > + * > + * This program is free software; you can redistribute it and/or modify > + * it under the terms of the GNU General Public License version 2 as > + * published by the Free Software Foundation. > + * > + * The contents of this file may alternatively be used under the terms > + * of the Common Development and Distribution License Version 1.0 > + * (CDDL) only, in which case the provisions of the CDDL are applicable > + * instead of those of the GPL. > + * > + * You may elect to license modified versions of this file under the > + * terms and conditions of either the GPL or the CDDL or both. > + */ > + > +#ifndef __UAPI_VBOX_VMMDEV_TYPES_H__ > +#define __UAPI_VBOX_VMMDEV_TYPES_H__ > + > +#include > +#include > + > +/* > + * We cannot use linux' compiletime_assert here because it expects to be used > + * inside a function only. Use a typedef to a char array with a negative size. > + */ > +#define VMMDEV_ASSERT_SIZE(type, size) \ > + typedef char type ## _asrt_size[1 - 2*!!(sizeof(struct type) != (size))] I wondered about defining a new typedef here, and checkpatch.pl complained about it. I think your comment explains it very well. > + > +/** enum vmmdev_request_type - VMMDev request types. */ > +enum vmmdev_request_type { > + VMMDEVREQ_INVALID_REQUEST = 0, > + VMMDEVREQ_GET_MOUSE_STATUS = 1, > + VMMDEVREQ_SET_MOUSE_STATUS = 2, > + VMMDEVREQ_SET_POINTER_SHAPE = 3, > + VMMDEVREQ_GET_HOST_VERSION = 4, > + VMMDEVREQ_IDLE = 5, > + VMMDEVREQ_GET_HOST_TIME = 10, > + VMMDEVREQ_GET_HYPERVISOR_INFO = 20, > + VMMDEVREQ_SET_HYPERVISOR_INFO = 21, > + VMMDEVREQ_REGISTER_PATCH_MEMORY = 22, /* since version 3.0.6 */ > + VMMDEVREQ_DEREGISTER_PATCH_MEMORY = 23, /* since version 3.0.6 */ > + VMMDEVREQ_SET_POWER_STATUS = 30, > + VMMDEVREQ_ACKNOWLEDGE_EVENTS = 41, > + VMMDEVREQ_CTL_GUEST_FILTER_MASK = 42, > + VMMDEVREQ_REPORT_GUEST_INFO = 50, > + VMMDEVREQ_REPORT_GUEST_INFO2 = 58, /* since version 3.2.0 */ > + VMMDEVREQ_REPORT_GUEST_STATUS = 59, /* since version 3.2.8 */ > + VMMDEVREQ_REPORT_GUEST_USER_STATE = 74, /* since version 4.3 */ > + /* Retrieve a display resize request sent by the host, deprecated. */ > + VMMDEVREQ_GET_DISPLAY_CHANGE_REQ = 51, > + VMMDEVREQ_VIDEMODE_SUPPORTED = 52, > + VMMDEVREQ_GET_HEIGHT_REDUCTION = 53, > + /** > + * @VMMDEVREQ_GET_DISPLAY_CHANGE_REQ2: > + * Retrieve a display resize request sent by the host. > + * > + * Queries a display resize request sent from the host. If the > + * event_ack member is sent to true and there is an unqueried request > + * available for one of the virtual display then that request will > + * be returned. If several displays have unqueried requests the lowest > + * numbered display will be chosen first. Only the most recent unseen > + * request for each display is remembered. > + * If event_ack is set to false, the last host request queried with > + * event_ack set is resent, or failing that the most recent received > + * from the host. If no host request was ever received then all zeros > + * are returned. > + */ > + VMMDEVREQ_GET_DISPLAY_CHANGE_REQ2 = 54, > + VMMDEVREQ_REPORT_GUEST_CAPABILITIES = 55, > + VMMDEVREQ_SET_GUEST_CAPABILITIES = 56, > + VMMDEVREQ_VIDEMODE_SUPPORTED2 = 57, /* since version 3.2.0 */ > + VMMDEVREQ_GET_DISPLAY_CHANGE_REQEX = 80, /* since version 4.2.4 */ > + VMMDEVREQ_HGCM_CONNECT = 60, > + VMMDEVREQ_HGCM_DISCONNECT = 61, > + VMMDEVREQ_HGCM_CALL32 = 62, > + VMMDEVREQ_HGCM_CALL64 = 63, > + VMMDEVREQ_HGCM_CANCEL = 64, > + VMMDEVREQ_HGCM_CANCEL2 = 65, > + VMMDEVREQ_VIDEO_ACCEL_ENABLE = 70, > + VMMDEVREQ_VIDEO_ACCEL_FLUSH = 71, > + VMMDEVREQ_VIDEO_SET_VISIBLE_REGION = 72, > + VMMDEVREQ_GET_SEAMLESS_CHANGE_REQ = 73, > + VMMDEVREQ_QUERY_CREDENTIALS = 100, > + VMMDEVREQ_REPORT_CREDENTIALS_JUDGEMENT = 101, > + VMMDEVREQ_REPORT_GUEST_STATS = 110, > + VMMDEVREQ_GET_MEMBALLOON_CHANGE_REQ = 111, > + VMMDEVREQ_GET_STATISTICS_CHANGE_REQ = 112, > + VMMDEVREQ_CHANGE_MEMBALLOON = 113, > + VMMDEVREQ_GET_VRDPCHANGE_REQ = 150, > + VMMDEVREQ_LOG_STRING = 200, > + VMMDEVREQ_GET_CPU_HOTPLUG_REQ = 210, > + VMMDEVREQ_SET_CPU_HOTPLUG_STATUS = 211, > + VMMDEVREQ_REGISTER_SHARED_MODULE = 212, > + VMMDEVREQ_UNREGISTER_SHARED_MODULE = 213, > + VMMDEVREQ_CHECK_SHARED_MODULES = 214, > + VMMDEVREQ_GET_PAGE_SHARING_STATUS = 215, > + VMMDEVREQ_DEBUG_IS_PAGE_SHARED = 216, > + VMMDEVREQ_GET_SESSION_ID = 217, /* since version 3.2.8 */ > + VMMDEVREQ_WRITE_COREDUMP = 218, > + VMMDEVREQ_GUEST_HEARTBEAT = 219, > + VMMDEVREQ_HEARTBEAT_CONFIGURE = 220, > + /* Ensure the enum is a 32 bit data-type */ > + VMMDEVREQ_SIZEHACK = 0x7fffffff > +}; > + > +#if __BITS_PER_LONG == 64 > +#define VMMDEVREQ_HGCM_CALL VMMDEVREQ_HGCM_CALL64 > +#else > +#define VMMDEVREQ_HGCM_CALL VMMDEVREQ_HGCM_CALL32 > +#endif > + > +/** HGCM service location types. */ > +enum vmmdev_hgcm_service_location_type { > + VMMDEV_HGCM_LOC_INVALID = 0, > + VMMDEV_HGCM_LOC_LOCALHOST = 1, > + VMMDEV_HGCM_LOC_LOCALHOST_EXISTING = 2, > + /* Ensure the enum is a 32 bit data-type */ > + VMMDEV_HGCM_LOC_SIZEHACK = 0x7fffffff > +}; > + > +/** HGCM host service location. */ > +struct vmmdev_hgcm_service_location_localhost { > + /** Service name */ > + char service_name[128]; > +}; > +VMMDEV_ASSERT_SIZE(vmmdev_hgcm_service_location_localhost, 128); > + > +/** HGCM service location. */ > +struct vmmdev_hgcm_service_location { > + /** Type of the location. */ > + enum vmmdev_hgcm_service_location_type type; > + > + union { > + struct vmmdev_hgcm_service_location_localhost localhost; > + } u; > +}; This union only has one member. Is there some reason to keep the union here? > +VMMDEV_ASSERT_SIZE(vmmdev_hgcm_service_location, 128 + 4); > + > +/** HGCM function parameter type. */ > +enum vmmdev_hgcm_function_parameter_type { > + VMMDEV_HGCM_PARM_TYPE_INVALID = 0, > + VMMDEV_HGCM_PARM_TYPE_32BIT = 1, > + VMMDEV_HGCM_PARM_TYPE_64BIT = 2, > + /** Deprecated Doesn't work, use PAGELIST. */ > + VMMDEV_HGCM_PARM_TYPE_PHYSADDR = 3, > + /** In and Out, user-memory */ > + VMMDEV_HGCM_PARM_TYPE_LINADDR = 4, > + /** In, user-memory (read; host<-guest) */ > + VMMDEV_HGCM_PARM_TYPE_LINADDR_IN = 5, > + /** Out, user-memory (write; host->guest) */ > + VMMDEV_HGCM_PARM_TYPE_LINADDR_OUT = 6, > + /** In and Out, kernel-memory */ > + VMMDEV_HGCM_PARM_TYPE_LINADDR_KERNEL = 7, > + /** In, kernel-memory (read; host<-guest) */ > + VMMDEV_HGCM_PARM_TYPE_LINADDR_KERNEL_IN = 8, > + /** Out, kernel-memory (write; host->guest) */ > + VMMDEV_HGCM_PARM_TYPE_LINADDR_KERNEL_OUT = 9, > + /** Physical addresses of locked pages for a buffer. */ > + VMMDEV_HGCM_PARM_TYPE_PAGELIST = 10, > + /* Ensure the enum is a 32 bit data-type */ > + VMMDEV_HGCM_PARM_TYPE_SIZEHACK = 0x7fffffff > +}; > + > +/** HGCM function parameter, 32-bit client. */ > +struct vmmdev_hgcm_function_parameter32 { > + enum vmmdev_hgcm_function_parameter_type type; > + union { > + __u32 value32; > + __u64 value64; > + struct { > + __u32 size; > + union { > + __u32 phys_addr; > + __u32 linear_addr; > + } u; > + } pointer; > + struct { > + /** Size of the buffer described by the page list. */ > + __u32 size; > + /** Relative to the request header. */ > + __u32 offset; > + } page_list; > + } u; > +} __packed; > +VMMDEV_ASSERT_SIZE(vmmdev_hgcm_function_parameter32, 4 + 8); > + > +/** HGCM function parameter, 64-bit client. */ > +struct vmmdev_hgcm_function_parameter64 { > + enum vmmdev_hgcm_function_parameter_type type; > + union { > + __u32 value32; > + __u64 value64; > + struct { > + __u32 size; > + union { > + __u64 phys_addr; > + __u64 linear_addr; > + } u; > + } __packed pointer; > + struct { > + /** Size of the buffer described by the page list. */ > + __u32 size; > + /** Relative to the request header. */ > + __u32 offset; > + } page_list; > + } __packed u; > +} __packed; > +VMMDEV_ASSERT_SIZE(vmmdev_hgcm_function_parameter64, 4 + 12); > + > +#if __BITS_PER_LONG == 64 > +#define vmmdev_hgcm_function_parameter vmmdev_hgcm_function_parameter64 > +#else > +#define vmmdev_hgcm_function_parameter vmmdev_hgcm_function_parameter32 > +#endif > + > +#define VMMDEV_HGCM_F_PARM_DIRECTION_NONE 0x00000000U > +#define VMMDEV_HGCM_F_PARM_DIRECTION_TO_HOST 0x00000001U > +#define VMMDEV_HGCM_F_PARM_DIRECTION_FROM_HOST 0x00000002U > +#define VMMDEV_HGCM_F_PARM_DIRECTION_BOTH 0x00000003U > + > +/** > + * struct vmmdev_hgcm_pagelist - VMMDEV_HGCM_PARM_TYPE_PAGELIST parameters > + * point to this structure to actually describe the buffer. > + */ > +struct vmmdev_hgcm_pagelist { > + __u32 flags; /** VMMDEV_HGCM_F_PARM_*. */ > + __u16 offset_first_page; /** Data offset in the first page. */ > + __u16 page_count; /** Number of pages. */ > + __u64 pages[1]; /** Page addresses. */ > +}; > +VMMDEV_ASSERT_SIZE(vmmdev_hgcm_pagelist, 4 + 2 + 2 + 8); > + > +#endif > diff --git a/include/uapi/linux/vboxguest.h b/include/uapi/linux/vboxguest.h > new file mode 100644 > index 000000000000..d201eb080df2 > --- /dev/null > +++ b/include/uapi/linux/vboxguest.h > @@ -0,0 +1,341 @@ > +/* > + * VBoxGuest - VirtualBox Guest Additions Driver Interface. > + * > + * Copyright (C) 2006-2016 Oracle Corporation > + * > + * This program is free software; you can redistribute it and/or modify > + * it under the terms of the GNU General Public License version 2 as > + * published by the Free Software Foundation. > + * > + * The contents of this file may alternatively be used under the terms > + * of the Common Development and Distribution License Version 1.0 > + * (CDDL) only, in which case the provisions of the CDDL are applicable > + * instead of those of the GPL. > + * > + * You may elect to license modified versions of this file under the > + * terms and conditions of either the GPL or the CDDL or both. > + */ > + > +#ifndef __UAPI_VBOXGUEST_H__ > +#define __UAPI_VBOXGUEST_H__ > + > +#include > +#include > +#include > +#include > + > +/* Version of vbg_ioctl_hdr structure. */ > +#define VBG_IOCTL_HDR_VERSION 0x10001 > +/* Default request type. Use this for non-VMMDev requests. */ > +#define VBG_IOCTL_HDR_TYPE_DEFAULT 0 > + > +/** > + * Common ioctl header. > + * > + * This is a mirror of vmmdev_request_header to prevent duplicating data and > + * needing to verify things multiple times. > + */ > +struct vbg_ioctl_hdr { > + /** IN: The request input size, and output size if size_out is zero. */ > + __u32 size_in; > + /** IN: Structure version (VBG_IOCTL_HDR_VERSION) */ > + __u32 version; > + /** IN: The VMMDev request type or VBG_IOCTL_HDR_TYPE_DEFAULT. */ > + __u32 type; > + /** > + * OUT: The VBox status code of the operation, out direction only. > + * This is a VINF_ or VERR_ value as defined in vbox_err.h. > + */ > + __s32 rc; > + /** IN: Output size. Set to zero to use size_in as output size. */ > + __u32 size_out; > + /** Reserved, MBZ. */ > + __u32 reserved; > +}; > +VMMDEV_ASSERT_SIZE(vbg_ioctl_hdr, 24); > + > + > +/* > + * The VBoxGuest I/O control version. > + * > + * As usual, the high word contains the major version and changes to it > + * signifies incompatible changes. > + * > + * The lower word is the minor version number, it is increased when new > + * functions are added or existing changed in a backwards compatible manner. > + */ > +#define VBG_IOC_VERSION 0x00010000u > + > +/** > + * VBG_IOCTL_DRIVER_VERSION_INFO data structure > + * > + * Note VBG_IOCTL_DRIVER_VERSION_INFO may switch the session to a backwards > + * compatible interface version if uClientVersion indicates older client code. > + */ > +struct vbg_ioctl_driver_version_info { > + /** The header. */ > + struct vbg_ioctl_hdr hdr; > + union { > + struct { > + /** Requested interface version (VBG_IOC_VERSION). */ > + __u32 req_version; > + /** > + * Minimum interface version number (typically the > + * major version part of VBG_IOC_VERSION). > + */ > + __u32 min_version; > + /** Reserved, MBZ. */ > + __u32 reserved1; > + /** Reserved, MBZ. */ > + __u32 reserved2; > + } in; > + struct { > + /** Version for this session (typ. VBG_IOC_VERSION). */ > + __u32 session_version; > + /** Version of the IDC interface (VBG_IOC_VERSION). */ > + __u32 driver_version; > + /** The SVN revision of the driver, or 0. */ > + __u32 driver_revision; > + /** Reserved \#1 (zero until defined). */ > + __u32 reserved1; > + /** Reserved \#2 (zero until defined). */ > + __u32 reserved2; > + } out; > + } u; > +}; > +VMMDEV_ASSERT_SIZE(vbg_ioctl_driver_version_info, 24 + 20); > + > +#define VBG_IOCTL_DRIVER_VERSION_INFO \ > + _IOWR('V', 0, struct vbg_ioctl_driver_version_info) > + > + > +/* IOCTL to perform a VMM Device request less than 1KB in size. */ > +#define VBG_IOCTL_VMMDEV_REQUEST(s) _IOC(_IOC_READ | _IOC_WRITE, 'V', 2, s) > + > + > +/* IOCTL to perform a VMM Device request larger then 1KB. */ > +#define VBG_IOCTL_VMMDEV_REQUEST_BIG _IOC(_IOC_READ | _IOC_WRITE, 'V', 3, 0) > + > + > +/** VBG_IOCTL_HGCM_CONNECT data structure. */ > +struct vbg_ioctl_hgcm_connect { > + struct vbg_ioctl_hdr hdr; > + union { > + struct { > + struct vmmdev_hgcm_service_location loc; > + } in; > + struct { > + __u32 client_id; > + } out; > + } u; > +}; > +VMMDEV_ASSERT_SIZE(vbg_ioctl_hgcm_connect, 24 + 132); > + > +#define VBG_IOCTL_HGCM_CONNECT \ > + _IOWR('V', 4, struct vbg_ioctl_hgcm_connect) > + > + > +/** VBG_IOCTL_HGCM_DISCONNECT data structure. */ > +struct vbg_ioctl_hgcm_disconnect { > + struct vbg_ioctl_hdr hdr; > + union { > + struct { > + __u32 client_id; > + } in; > + } u; > +}; Another single-member union. > +VMMDEV_ASSERT_SIZE(vbg_ioctl_hgcm_disconnect, 24 + 4); > + > +#define VBG_IOCTL_HGCM_DISCONNECT \ > + _IOWR('V', 5, struct vbg_ioctl_hgcm_disconnect) > + > + > +/** VBG_IOCTL_HGCM_CALL data structure. */ > +struct vbg_ioctl_hgcm_call { > + /** The header. */ > + struct vbg_ioctl_hdr hdr; > + /** Input: The id of the caller. */ > + __u32 client_id; > + /** Input: Function number. */ > + __u32 function; > + /** > + * Input: How long to wait (milliseconds) for completion before > + * cancelling the call. Set to -1 to wait indefinitely. > + */ > + __u32 timeout_ms; > + /** Interruptable flag, ignored for userspace calls. */ > + __u8 interruptible; > + /** Explicit padding, MBZ. */ > + __u8 reserved; > + /** > + * Input: How many parameters following this structure. > + * > + * The parameters are either HGCMFunctionParameter64 or 32, > + * depending on whether we're receiving a 64-bit or 32-bit request. > + * > + * The current maximum is 61 parameters (given a 1KB max request size, > + * and a 64-bit parameter size of 16 bytes). > + */ > + __u16 parm_count; > + /* > + * Parameters follow in form: > + * struct hgcm_function_parameter<32|64> parms[parm_count] > + */ > +}; > +VMMDEV_ASSERT_SIZE(vbg_ioctl_hgcm_call, 24 + 16); > + > +#define VBG_IOCTL_HGCM_CALL_32(s) _IOC(_IOC_READ | _IOC_WRITE, 'V', 6, s) > +#define VBG_IOCTL_HGCM_CALL_64(s) _IOC(_IOC_READ | _IOC_WRITE, 'V', 7, s) > +#if __BITS_PER_LONG == 64 > +#define VBG_IOCTL_HGCM_CALL(s) VBG_IOCTL_HGCM_CALL_64(s) > +#else > +#define VBG_IOCTL_HGCM_CALL(s) VBG_IOCTL_HGCM_CALL_32(s) > +#endif > + > + > +/** VBG_IOCTL_LOG data structure. */ > +struct vbg_ioctl_log { > + /** The header. */ > + struct vbg_ioctl_hdr hdr; > + union { > + struct { > + /** > + * The log message, this may be zero terminated. If it > + * is not zero terminated then the length is determined > + * from the input size. > + */ > + char msg[1]; > + } in; > + } u; > +}; Amother single-member union. > + > +#define VBG_IOCTL_LOG(s) _IOC(_IOC_READ | _IOC_WRITE, 'V', 9, s) > + > + > +/** VBG_IOCTL_WAIT_FOR_EVENTS data structure. */ > +struct vbg_ioctl_wait_for_events { > + /** The header. */ > + struct vbg_ioctl_hdr hdr; > + union { > + struct { > + /** Timeout in milliseconds. */ > + __u32 timeout_ms; > + /** Events to wait for. */ > + __u32 events; > + } in; > + struct { > + /** Events that occurred. */ > + __u32 events; > + } out; > + } u; > +}; > +VMMDEV_ASSERT_SIZE(vbg_ioctl_wait_for_events, 24 + 8); > + > +#define VBG_IOCTL_WAIT_FOR_EVENTS \ > + _IOWR('V', 10, struct vbg_ioctl_wait_for_events) > + > + > +/* > + * IOCTL to VBoxGuest to interrupt (cancel) any pending > + * VBG_IOCTL_WAIT_FOR_EVENTS and return. > + * > + * Handled inside the vboxguest driver and not seen by the host at all. > + * After calling this, VBG_IOCTL_WAIT_FOR_EVENTS should no longer be called in > + * the same session. Any VBOXGUEST_IOCTL_WAITEVENT calls in the same session > + * done after calling this will directly exit with -EINTR. > + */ > +#define VBG_IOCTL_INTERRUPT_ALL_WAIT_FOR_EVENTS \ > + _IOWR('V', 11, struct vbg_ioctl_hdr) > + > + > +/** VBG_IOCTL_CHANGE_FILTER_MASK data structure. */ > +struct vbg_ioctl_change_filter { > + /** The header. */ > + struct vbg_ioctl_hdr hdr; > + union { > + struct { > + /** Flags to set. */ > + __u32 or_mask; > + /** Flags to remove. */ > + __u32 not_mask; > + } in; > + } u; > +}; Amother single-member union. > +VMMDEV_ASSERT_SIZE(vbg_ioctl_change_filter, 24 + 8); > + > +/* IOCTL to VBoxGuest to control the event filter mask. */ > +#define VBG_IOCTL_CHANGE_FILTER_MASK \ > + _IOWR('V', 12, struct vbg_ioctl_change_filter) > + > + > +/** VBG_IOCTL_CHANGE_GUEST_CAPABILITIES data structure. */ > +struct vbg_ioctl_set_guest_caps { > + /** The header. */ > + struct vbg_ioctl_hdr hdr; > + union { > + struct { > + /** Capabilities to set (VMMDEV_GUEST_SUPPORTS_XXX). */ > + __u32 or_mask; > + /** Capabilities to drop (VMMDEV_GUEST_SUPPORTS_XXX). */ > + __u32 not_mask; > + } in; > + struct { > + /** Capabilities held by the session after the call. */ > + __u32 session_caps; > + /** Capabilities for all the sessions after the call. */ > + __u32 global_caps; > + } out; > + } u; > +}; > +VMMDEV_ASSERT_SIZE(vbg_ioctl_set_guest_caps, 24 + 8); > + > +#define VBG_IOCTL_CHANGE_GUEST_CAPABILITIES \ > + _IOWR('V', 14, struct vbg_ioctl_set_guest_caps) > + > + > +/** VBG_IOCTL_CHECK_BALLOON data structure. */ > +struct vbg_ioctl_check_balloon { > + /** The header. */ > + struct vbg_ioctl_hdr hdr; > + union { > + struct { > + /** The size of the balloon in chunks of 1MB. */ > + __u32 balloon_chunks; > + /** > + * false = handled in R0, no further action required. > + * true = allocate balloon memory in R3. > + */ > + __u8 handle_in_r3; > + /** Explicit padding, MBZ. */ > + __u8 padding[3]; > + } out; > + } u; > +}; > +VMMDEV_ASSERT_SIZE(vbg_ioctl_check_balloon, 24 + 8); > + > +/* > + * IOCTL to check memory ballooning. > + * > + * The guest kernel module will ask the host for the current size of the > + * balloon and adjust the size. Or it will set handle_in_r3 = true and R3 is > + * responsible for allocating memory and calling VBG_IOCTL_CHANGE_BALLOON. > + */ > +#define VBG_IOCTL_CHECK_BALLOON \ > + _IOWR('V', 17, struct vbg_ioctl_check_balloon) > + > + > +/** VBG_IOCTL_WRITE_CORE_DUMP data structure. */ > +struct vbg_ioctl_write_coredump { > + struct vbg_ioctl_hdr hdr; > + union { > + struct { > + __u32 flags; /** Flags (reserved, MBZ). */ > + } in; > + } u; > +}; > +VMMDEV_ASSERT_SIZE(vbg_ioctl_write_coredump, 24 + 4); Another single-member union. > + > +#define VBG_IOCTL_WRITE_CORE_DUMP \ > + _IOWR('V', 19, struct vbg_ioctl_write_coredump) > + > +#endif > From 1585142016907802447@xxx Sun Nov 26 15:13:49 +0000 2017 X-GM-THRID: 1585142016907802447 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread