On 11/26/2017 09:12 AM, Hans de Goede wrote:
This commits adds a header describing the hardware interface for the
Virtual Box Guest PCI device used in Virtual Box virtual machines and
utility functions for talking to the Virtual Box hypervisor over this
interface.
These utility functions will used both by the vboxguest driver for the
PCI device which offers the /dev/vboxguest ioctl API and by the vboxfs
driver which offers folder sharing support.
Signed-off-by: Hans de Goede <hdegoede@xxxxxxxxxx>
Reviewed-by: Larry Finger <Larry.Finger.net>
This patch has only minor defects. Please see the inline comments.
---
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
+
+/**
+ * Translates linear address types to page list direction flags.
+ *
+ * Return: page list flags.
+ * @type:Â The type.
+ */
+static u32 hgcm_call_linear_addr_type_to_pagelist_flags(
+ÂÂÂ enum vmmdev_hgcm_function_parameter_type type)
+{
+ÂÂÂ switch (type) {
+ÂÂÂ default:
+ÂÂÂÂÂÂÂ WARN_ON(1);
Do you intend a fall through here? If so, please add a comment to that effect.
+ÂÂÂ case VMMDEV_HGCM_PARM_TYPE_LINADDR:
+ÂÂÂ case VMMDEV_HGCM_PARM_TYPE_LINADDR_KERNEL:
+ÂÂÂÂÂÂÂ return VMMDEV_HGCM_F_PARM_DIRECTION_BOTH;
+
+ÂÂÂ case VMMDEV_HGCM_PARM_TYPE_LINADDR_IN:
+ÂÂÂ case VMMDEV_HGCM_PARM_TYPE_LINADDR_KERNEL_IN:
+ÂÂÂÂÂÂÂ return VMMDEV_HGCM_F_PARM_DIRECTION_TO_HOST;
+
+ÂÂÂ case VMMDEV_HGCM_PARM_TYPE_LINADDR_OUT:
+ÂÂÂ case VMMDEV_HGCM_PARM_TYPE_LINADDR_KERNEL_OUT:
+ÂÂÂÂÂÂÂ return VMMDEV_HGCM_F_PARM_DIRECTION_FROM_HOST;
+ÂÂÂ }
+}