[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] numa.c: use spaces instead of tabs



On 09/03/14 08:40, Jan Beulich wrote:
On 03.09.14 at 14:34, <ufimtseva@xxxxxxxxx> wrote:
I understand that, but that style is mixed. Not linux, not Xen :)
Yeah, mistakes like that creep in. But we're trying to avoid them
(perhaps harder now than a few years ago).

Jan

I have attempted to get Xen coding style (not libxl coding style) into
a more automated process.

Using astyle (Artistic Style Version 2.04), the attached astyle options file does a
lot of the work.

dcs-xen-54:~/xen>astyle --options=/home/don/xen.astylerc xen/arch/x86/hvm/vmware/vmport_rpc.c
   Formatted  xen/arch/x86/hvm/vmware/vmport_rpc.c
dcs-xen-54:~/xen>emacs -nw /home/don/xen_reformat.el xen/arch/x86/hvm/vmware/vmport_rpc.c

However it does not support the:

   Space characters are used to spread out logical statements, ...

And so I use the emacs extension xen-reformat-region (also attached)
to post process the file, and adjust to the Xen style.  This only works
if the emacs local variables comment (See CODING_STYLE) is there.

Using this on xen/arch/x86/numa.c (and asking git to ignore white space
changes) gives me:

dcs-xen-54:~/xen>git diff -w
diff --git a/xen/arch/x86/numa.c b/xen/arch/x86/numa.c
index 628a40a..35ce32c 100644
--- a/xen/arch/x86/numa.c
+++ b/xen/arch/x86/numa.c
@@ -35,13 +35,15 @@ static typeof(*memnodemap) _memnodemap[64];
 unsigned long memnodemapsize;
 u8 *memnodemap;

-unsigned char cpu_to_node[NR_CPUS] __read_mostly = {
+unsigned char cpu_to_node[NR_CPUS] __read_mostly =
+{
     [0 ... NR_CPUS - 1] = NUMA_NO_NODE
 };
 /*
* Keep BIOS's CPU2node information, should not be used for memory allocaion
  */
-unsigned char apicid_to_node[MAX_LOCAL_APIC] __cpuinitdata = {
+unsigned char apicid_to_node[MAX_LOCAL_APIC] __cpuinitdata =
+{
     [0 ... MAX_LOCAL_APIC - 1] = NUMA_NO_NODE
 };
 cpumask_t node_to_cpumask[MAX_NUMNODES] __read_mostly;
@@ -413,7 +415,8 @@ static void dump_numa(unsigned char key)
     rcu_read_unlock(&domlist_read_lock);
 }

-static struct keyhandler dump_numa_keyhandler = {
+static struct keyhandler dump_numa_keyhandler =
+{
     .diagnostic = 1,
     .u.fn = dump_numa,
     .desc = "dump numa info"
@@ -426,3 +429,11 @@ static __init int register_numa_trigger(void)
 }
 __initcall(register_numa_trigger);

+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */

The attached zz.txt file the full git diff output. If there are coding styles left
I would like to know about them.


   -Don Slutz


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

Attachment: xen.astylerc
Description: Text document

Attachment: xen_reformat.el
Description: Text Data

Attachment: zz.txt
Description: Text document

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.