RE: [Xen-devel] Re: [PATCH] vmx-x86_64-byte.patch

Ian Pratt
Tue, 13 Sep 2005 11:18:27 -0000

> <ON SOAPBOX>
> While on this topic, and I know I''m starting a religious war,
> could we get some agreement over the prefered indent/coding
> style for Xen? It is currently a hotchpotch of styles,
> sometimes even within the same function. I don''t have a
> strong preference for the style (the Linux kernel style seems
> appropriate given the amount of Linux code that''s
> incorporated), as long as it is consistent.
> <OFF SOAPBOX>

This is policy we''ve been operating:

For files that belong in guest operating systems (the sparse trees) we
use the style of that particular OS.

For Xen itself (and the tools) we use bsd style with soft tabs of 4
spaces. The only exceptions to this are the small handful of files that
are very closely related to Linux couterparts (apic.c etc). Keeping them
in Linux style makes it easier to track changes.

For python we use whatever is the default emacs python mode uses.
However, some hard tabs have crept in and we could seriously do with
running all the python code through a python-specific lint.

I think the best way to enforce the above is probably to make sure we
have the appropriate magic at the bottom of every file to put common
editors into the right mode.

Some people are likely to take exception with the style we use for Xen
not being Linux style. I find 4 space tabs much easier on the eye than
the Linux style and see no reason to change. The tree could do with a
bit of tyidying up to make sure every file is at least internally
consistent and to add some editor mode info (everyone uses emacs or vi,
right?). To cause minimum pain we should do this with plenty of warning
so that people can avoid having too many local patches to merge. Right
after 3.0 would probably be good.

Ian