From: Andrew Stiegmann <astiegmann@vmware.com>
To: Sam Ravnborg <sam@ravnborg.org>
Cc: pv-drivers@vmware.com, gregkh@linuxfoundation.org,
linux-kernel@vger.kernel.org,
virtualization@lists.linux-foundation.org,
vm-crosstalk@vmware.com, cschamp@vmware.com
Subject: Re: [vmw_vmci 11/11] Apply the header code to make VMCI build
Date: Fri, 27 Jul 2012 10:20:43 -0700 (PDT) [thread overview]
Message-ID: <1693394101.5749000.1343409643934.JavaMail.root@vmware.com> (raw)
In-Reply-To: <20120727103455.GA4639@merkur.ravnborg.org>
Hi Sam,
----- Original Message -----
> From: "Sam Ravnborg" <sam@ravnborg.org>
> To: "Andrew Stiegmann (stieg)" <astiegmann@vmware.com>
> Cc: linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, pv-drivers@vmware.com,
> vm-crosstalk@vmware.com, cschamp@vmware.com, gregkh@linuxfoundation.org
> Sent: Friday, July 27, 2012 3:34:55 AM
> Subject: Re: [vmw_vmci 11/11] Apply the header code to make VMCI build
>
> Hi Andrew.
>
> A few things noted in the following..
>
> >
> > diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
> > index 2661f6e..fe38c7a 100644
> > --- a/drivers/misc/Kconfig
> > +++ b/drivers/misc/Kconfig
> > @@ -517,4 +517,5 @@ source "drivers/misc/lis3lv02d/Kconfig"
> > source "drivers/misc/carma/Kconfig"
> > source "drivers/misc/altera-stapl/Kconfig"
> > source "drivers/misc/mei/Kconfig"
> > +source "drivers/misc/vmw_vmci/Kconfig"
> > endmenu
> > diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
> > index 456972f..af9e413 100644
> > --- a/drivers/misc/Makefile
> > +++ b/drivers/misc/Makefile
> > @@ -51,3 +51,4 @@ obj-y += carma/
> > obj-$(CONFIG_USB_SWITCH_FSA9480) += fsa9480.o
> > obj-$(CONFIG_ALTERA_STAPL) +=altera-stapl/
> > obj-$(CONFIG_INTEL_MEI) += mei/
> > +obj-y += vmw_vmci/
>
> Please use obj-$(CONFIG_VMWARE_VMCI) += vmw_vmci/
>
> like we do in the other cases. This prevents us from visiting the
> directory
> when this feature is not enabled.
Ok.
> > +++ b/drivers/misc/vmw_vmci/Makefile
> > @@ -0,0 +1,43 @@
> > +################################################################################
> > +#
> > +# Linux driver for VMware's VMCI device.
> > +#
> > +# Copyright (C) 2007-2012, VMware, Inc. All Rights Reserved.
> > +#
> > +# This program is free software; you can redistribute it and/or
> > modify it
> > +# under the terms of the GNU General Public License as published
> > by the
> > +# Free Software Foundation; version 2 of the License and no later
> > version.
> > +#
> > +# This program is distributed in the hope that it will be useful,
> > but
> > +# WITHOUT ANY WARRANTY; without even the implied warranty of
> > +# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE
> > or
> > +# NON INFRINGEMENT. See the GNU General Public License for more
> > +# details.
> > +#
> > +# You should have received a copy of the GNU General Public
> > License
> > +# along with this program; if not, write to the Free Software
> > +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
> > 02110-1301 USA.
> > +#
> > +# The full GNU General Public License is included in this
> > distribution in
> > +# the file called "COPYING".
> > +#
> > +# Maintained by: Andrew Stiegmann <pv-drivers@vmware.com>
> > +#
> > +################################################################################
> Lot's of boilerplate noise for such a simple file...
I removed the section containing FSF address and section below it as well per Greg KH's request.
> > +
> > +#
> > +# Makefile for the VMware VMCI
> > +#
> > +
> > +obj-$(CONFIG_VMWARE_VMCI) += vmw_vmci.o
> > +
> > +vmw_vmci-objs += vmci_context.o
> > +vmw_vmci-objs += vmci_datagram.o
> > +vmw_vmci-objs += vmci_doorbell.o
> > +vmw_vmci-objs += vmci_driver.o
> > +vmw_vmci-objs += vmci_event.o
> > +vmw_vmci-objs += vmci_handle_array.o
> > +vmw_vmci-objs += vmci_hash_table.o
> > +vmw_vmci-objs += vmci_queue_pair.o
> > +vmw_vmci-objs += vmci_resource.o
> > +vmw_vmci-objs += vmci_route.o
>
> please use:
> vmw_vmci-y += vmci_context.o
> vmw_vmci-y += vmci_datagram.o
> vmw_vmci-y += vmci_doorbell.o
>
> This is recommended these days and allows you to enable/disable
> single files later using a config option.
Ok.
> > diff --git a/drivers/misc/vmw_vmci/vmci_common_int.h
> > b/drivers/misc/vmw_vmci/vmci_common_int.h
> > +
> > +#ifndef _VMCI_COMMONINT_H_
> > +#define _VMCI_COMMONINT_H_
> > +
> > +#include <linux/printk.h>
> > +#include <linux/vmw_vmci_defs.h>
>
> Use inverse chrismas tree here.
> Longer include lines first, and soret alphabetically when
> lines are of the same length.
> This applies likely in many cases.
>
> > +#include "vmci_handle_array.h"
> > +
> > +#define ASSERT(cond) BUG_ON(!(cond))
> > +
> > +#define CAN_BLOCK(_f) (!((_f) & VMCI_QPFLAG_NONBLOCK))
> > +#define QP_PINNED(_f) ((_f) & VMCI_QPFLAG_PINNED)
>
> Looks like poor obscufation.
> Use a statis inline function if you need a helper for this.
These definitions are intended more as a helper to make reading the code easier. IMHO ts a lot easier to read
if (CAN_BLOCK(flags))
compared to
if (!(flags & VMCI_QPFLAG_NONBLOCK))
Wouldn't you agree? I'm not sure something this simple warrants a static inline function but I don't see any harm in converting it over to that.
> > +
> > +/*
> > + * Utilility function that checks whether two entities are allowed
> > + * to interact. If one of them is restricted, the other one must
> > + * be trusted.
> > + */
> > +static inline bool vmci_deny_interaction(uint32_t partOne,
> > + uint32_t partTwo)
>
> The kernel types are u32 not uint32_t - these types belongs in
> user-space.
Ok.
> > +++ b/include/linux/vmw_vmci_api.h
> > +
> > +#ifndef __VMW_VMCI_API_H__
> > +#define __VMW_VMCI_API_H__
> > +
> > +#include <linux/vmw_vmci_defs.h>
> > +
> > +#undef VMCI_KERNEL_API_VERSION
> > +#define VMCI_KERNEL_API_VERSION_2 2
> > +#define VMCI_KERNEL_API_VERSION VMCI_KERNEL_API_VERSION_2
> > +
> > +typedef void (VMCI_DeviceShutdownFn) (void *deviceRegistration,
> > void *userData);
> > +
> > +bool VMCI_DeviceGet(uint32_t *apiVersion,
> > + VMCI_DeviceShutdownFn *deviceShutdownCB,
> > + void *userData, void **deviceRegistration);
>
> The kernel style is to use lower_case for everything.
> So this would become:
>
> vmci_device_get()
>
> This is obviously a very general comment and applies everywhere.
I wish I could lower case these symbols but VMCI has already existed outside the mainline Linux tree for some time now and changing these exported symbols would mean that other drivers that depend on VMCI (vSock, vmhgfs) would need to change as well. One thought that did come to mind was exporting both VMCI_Device_Get and vmci_device_get but that would likely just confuse people. So in short I have made function names lower case where possible, but exported symbols could not be changed.
> Sam
>
next prev parent reply other threads:[~2012-07-27 17:20 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-26 23:39 [vmw_vmci 00/11] VMCI for Linux Andrew Stiegmann (stieg)
2012-07-26 23:39 ` [vmw_vmci 01/11] Apply VMCI context code Andrew Stiegmann (stieg)
2012-07-26 23:48 ` Greg KH
2012-07-27 0:01 ` Andrew Stiegmann
2012-07-26 23:39 ` [vmw_vmci 02/11] Apply VMCI datagram code Andrew Stiegmann (stieg)
2012-07-26 23:39 ` [vmw_vmci 03/11] Apply VMCI doorbell code Andrew Stiegmann (stieg)
2012-07-26 23:39 ` [vmw_vmci 04/11] Apply VMCI driver code Andrew Stiegmann (stieg)
2012-07-26 23:39 ` [vmw_vmci 05/11] Apply VMCI event code Andrew Stiegmann (stieg)
2012-07-26 23:39 ` [vmw_vmci 06/11] Apply dynamic array code Andrew Stiegmann (stieg)
2012-07-26 23:39 ` [vmw_vmci 07/11] Apply VMCI hash table Andrew Stiegmann (stieg)
2012-07-26 23:49 ` Greg KH
2012-07-27 0:01 ` Andrew Stiegmann
2012-07-26 23:39 ` [vmw_vmci 08/11] Apply VMCI queue pairs Andrew Stiegmann (stieg)
2012-07-26 23:39 ` [vmw_vmci 09/11] Apply VMCI resource code Andrew Stiegmann (stieg)
2012-07-26 23:39 ` [vmw_vmci 10/11] Apply vmci routing code Andrew Stiegmann (stieg)
2012-07-26 23:39 ` [vmw_vmci 11/11] Apply the header code to make VMCI build Andrew Stiegmann (stieg)
2012-07-26 23:56 ` Greg KH
2012-07-27 9:53 ` Alan Cox
2012-07-27 18:04 ` [Pv-drivers] " Dmitry Torokhov
2012-07-27 10:34 ` Sam Ravnborg
[not found] ` <20120727103455.GA4639@merkur.ravnborg.org>
2012-07-27 17:20 ` Andrew Stiegmann [this message]
2012-07-27 18:16 ` Greg KH
2012-07-27 18:39 ` Andrew Stiegmann
2012-07-27 18:52 ` Greg KH
2012-07-27 20:29 ` [Pv-drivers] " Dmitry Torokhov
2012-07-28 19:55 ` Greg KH
2012-07-28 21:10 ` Dmitry Torokhov
2012-07-27 19:53 ` Sam Ravnborg
2012-07-27 20:07 ` Andrew Stiegmann
2012-08-02 19:50 ` Jan Engelhardt
[not found] ` <alpine.LNX.2.01.1208022145380.30631@frira.zrqbmnf.qr>
2012-08-02 20:22 ` Sam Ravnborg
2012-08-15 20:45 ` Jan Engelhardt
2012-07-26 23:47 ` [vmw_vmci 00/11] VMCI for Linux Greg KH
2012-07-27 1:06 ` Josh Boyer
[not found] ` <CA+5PVA6RFthz5vjf-0BOogocMEwVKn5uE2q1_frjPFoVeUPACg@mail.gmail.com>
2012-07-27 1:46 ` Greg KH
2012-07-31 12:48 ` Josh Boyer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1693394101.5749000.1343409643934.JavaMail.root@vmware.com \
--to=astiegmann@vmware.com \
--cc=cschamp@vmware.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pv-drivers@vmware.com \
--cc=sam@ravnborg.org \
--cc=virtualization@lists.linux-foundation.org \
--cc=vm-crosstalk@vmware.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).