virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Sam Ravnborg <sam@ravnborg.org>
To: Jan Engelhardt <jengelh@inai.de>
Cc: pv-drivers@vmware.com, gregkh@linuxfoundation.org,
	linux-kernel@vger.kernel.org,
	virtualization@lists.linux-foundation.org,
	vm-crosstalk@vmware.com,
	"Andrew Stiegmann (stieg)" <astiegmann@vmware.com>,
	cschamp@vmware.com
Subject: Re: [vmw_vmci 11/11] Apply the header code to make VMCI build
Date: Thu, 2 Aug 2012 22:22:05 +0200	[thread overview]
Message-ID: <20120802202205.GA9096@merkur.ravnborg.org> (raw)
In-Reply-To: <alpine.LNX.2.01.1208022145380.30631@frira.zrqbmnf.qr>

On Thu, Aug 02, 2012 at 09:50:02PM +0200, Jan Engelhardt wrote:
> 
> On Friday 2012-07-27 12:34, Sam Ravnborg wrote:
> >> +#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.
> 
> So that's where unreadable include lists come from.
> Depth-first lexicographically-sorted is a lot less hassle,
> especially when it comes to merging patches that each
> add one different include.
This is applied in many parts of the kernels and has some benefits:
- easy to spot duplicates
- clash is less likely when two commit adds includes
- easy to do so it looks the same across different files

Obviously <linux/*> comes before include <asm/*> as this is
separate blocks of includes.

net/ and arch/x86/ is two places where this is getting the norm,
and these are trendsetters for the rest of the kernel.

> 
> >> +/*
> >> + * 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.
> 
> Not really. uint32_t is the C99 type for a 32-bit quantity, and I see
> absolutely zero reason not to use standardized things.
Found the following somewhere on the net:

On Mon, 29 Nov 2004, Paul Mackerras wrote:
>
> uint32_t is defined to be exactly 32 bits wide, so where's the problem
> in using it instead of __u32 in the headers that describe the
> user/kernel interface?  (Ditto for uint{8,16,64}_t, of course.

Ok, this discussion has gone on for too long anyway, but let's make it
easier for everybody. The kernel uses u8/u16/u32 because:

	- the kernel should not depend on, or pollute user-space naming.
	  YOU MUST NOT USE "uint32_t" when that may not be defined, and
	  user-space rules for when it is defined are arcane and totally
	  arbitrary.
...

See http://yarchive.net/comp/linux/kernel_headers.html for additional
rationale. (Second mail listed).

	Sam

  parent reply	other threads:[~2012-08-02 20:22 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
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 [this message]
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=20120802202205.GA9096@merkur.ravnborg.org \
    --to=sam@ravnborg.org \
    --cc=astiegmann@vmware.com \
    --cc=cschamp@vmware.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jengelh@inai.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pv-drivers@vmware.com \
    --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).