WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] xen source files and linux coding style

Subject: [Xen-devel] xen source files and linux coding style
From: "Mike D. Day" <ncmike@xxxxxxxxxx>
Date: Tue, 24 Jan 2006 20:39:50 -0500
Delivery-date: Wed, 25 Jan 2006 10:08:25 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Reply-to: ncmike@xxxxxxxxxx
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Due to my recent experience submitting a linux patch to lkml, I have
become more knowledgeable wrt linux coding style :) I've noticed a
couple of things in Xen and Xen-linux that we should consider changing
during normal development in preparation for the upstream merge.

The most immediate problem is conforming to the linux indentation
format. In Documentation/CodingStyle there is an emacs C mode for
linux, defined as:

(defun linux-c-mode ()
  "C mode with adjusted defaults for use with the Linux kernel."
  (interactive)
  (c-mode)
  (c-set-style "K&R")
  (setq tab-width 8)
  (setq indent-tabs-mode t)
  (setq c-basic-offset 8))


This is different from what we are using in Xen: 

/*
 * Local variables:
 * mode: C
 * c-set-style: "BSD"
 * c-basic-offset: 4
 * tab-width: 4
 * indent-tabs-mode: nil
 * End:
 */

The biggest problem here is turning tabs off. Tabs need to be used
instead of spaces. As well, the indentation needs to set to 8. 

The second thing I have come across recently are typedefs. Typedefs
are not mentioned in CodingStyle, but I know that they are frowned
upon. The only typedef's that might be "correct" are when using
function pointers, to make the code easier to read. 

I'm certainly not an expert on linux coding style (or CodingStyle) and
will gladly accept any advice or correction on these issues. I find
myself making these changes on files that I know may need to be
submitted to lkml. 

Mike Day

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>