diff mbox series

[RESEND,v2,1/7] xen/guest_access: Add emacs magics

Message ID 20200730181827.1670-2-julien@xen.org (mailing list archive)
State New, archived
Headers show
Series xen: Consolidate asm-*/guest_access.h in xen/guest_access.h | expand

Commit Message

Julien Grall July 30, 2020, 6:18 p.m. UTC
From: Julien Grall <jgrall@amazon.com>

Add emacs magics for xen/guest_access.h and
asm-x86/guest_access.h.

Signed-off-by: Julien Grall <jgrall@amazon.com>
Acked-by: Jan Beulich <jbeulich@suse.com>

---
    Changes in v2:
        - Remove the word "missing"
---
 xen/include/asm-x86/guest_access.h | 8 ++++++++
 xen/include/xen/guest_access.h     | 8 ++++++++
 2 files changed, 16 insertions(+)

Comments

Bertrand Marquis July 31, 2020, 1:04 p.m. UTC | #1
> On 30 Jul 2020, at 20:18, Julien Grall <julien@xen.org> wrote:
> 
> From: Julien Grall <jgrall@amazon.com>
> 
> Add emacs magics for xen/guest_access.h and
> asm-x86/guest_access.h.
> 
> Signed-off-by: Julien Grall <jgrall@amazon.com>
> Acked-by: Jan Beulich <jbeulich@suse.com>

Most of file in Xen source code seem to have a white line before the “emacs magics”.
If this is something that should be enforced, it should be done here.

If not the change seems ok :-)

> 
> ---
>    Changes in v2:
>        - Remove the word "missing"
> ---
> xen/include/asm-x86/guest_access.h | 8 ++++++++
> xen/include/xen/guest_access.h     | 8 ++++++++
> 2 files changed, 16 insertions(+)
> 
> diff --git a/xen/include/asm-x86/guest_access.h b/xen/include/asm-x86/guest_access.h
> index 2be3577bd340..3ffde205f6a1 100644
> --- a/xen/include/asm-x86/guest_access.h
> +++ b/xen/include/asm-x86/guest_access.h
> @@ -160,3 +160,11 @@
> })
> 
> #endif /* __ASM_X86_GUEST_ACCESS_H__ */
> +/*
> + * Local variables:
> + * mode: C
> + * c-file-style: "BSD"
> + * c-basic-offset: 4
> + * indent-tabs-mode: nil
> + * End:
> + */
> diff --git a/xen/include/xen/guest_access.h b/xen/include/xen/guest_access.h
> index 09989df819ce..ef9aaa3efcfe 100644
> --- a/xen/include/xen/guest_access.h
> +++ b/xen/include/xen/guest_access.h
> @@ -33,3 +33,11 @@ char *safe_copy_string_from_guest(XEN_GUEST_HANDLE(char) u_buf,
>                                   size_t size, size_t max_size);
> 
> #endif /* __XEN_GUEST_ACCESS_H__ */
> +/*
> + * Local variables:
> + * mode: C
> + * c-file-style: "BSD"
> + * c-basic-offset: 4
> + * indent-tabs-mode: nil
> + * End:
> + */
> -- 
> 2.17.1
> 
>
Julien Grall Aug. 14, 2020, 6:36 p.m. UTC | #2
Hi,

On 31/07/2020 14:04, Bertrand Marquis wrote:
> 
> 
>> On 30 Jul 2020, at 20:18, Julien Grall <julien@xen.org> wrote:
>>
>> From: Julien Grall <jgrall@amazon.com>
>>
>> Add emacs magics for xen/guest_access.h and
>> asm-x86/guest_access.h.
>>
>> Signed-off-by: Julien Grall <jgrall@amazon.com>
>> Acked-by: Jan Beulich <jbeulich@suse.com>
> 
> Most of file in Xen source code seem to have a white line before the “emacs magics”.
> If this is something that should be enforced, it should be done here.
I am not sure whether we always ask the newline before. Anyway, I have 
added one as this is trivial.

Cheers,
Volodymyr Babchuk Sept. 22, 2020, 10:05 a.m. UTC | #3
Hi Julie,

Julien Grall writes:

> From: Julien Grall <jgrall@amazon.com>
>
> Add emacs magics for xen/guest_access.h and
> asm-x86/guest_access.h.

As Emacs user I fully approve this.

But I want to hijack this thread a little to discuss even better
solution. Emacs supports .dir-locals.el file [1], which allows to set
all per-buffer variables once for all files down the directory tree. So,
instead of having "/* Local variables */" scourge in every file we can have
bunch of ".dir-locals.el" files placed in a strategic places to define
coding styles for different parts of Xen. As a bonus, it will be
possible to define Linux coding style for files taken from Linux, for example.

[1] https://www.gnu.org/software/emacs/manual/html_node/emacs/Directory-Variables.html
diff mbox series

Patch

diff --git a/xen/include/asm-x86/guest_access.h b/xen/include/asm-x86/guest_access.h
index 2be3577bd340..3ffde205f6a1 100644
--- a/xen/include/asm-x86/guest_access.h
+++ b/xen/include/asm-x86/guest_access.h
@@ -160,3 +160,11 @@ 
 })
 
 #endif /* __ASM_X86_GUEST_ACCESS_H__ */
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/xen/include/xen/guest_access.h b/xen/include/xen/guest_access.h
index 09989df819ce..ef9aaa3efcfe 100644
--- a/xen/include/xen/guest_access.h
+++ b/xen/include/xen/guest_access.h
@@ -33,3 +33,11 @@  char *safe_copy_string_from_guest(XEN_GUEST_HANDLE(char) u_buf,
                                   size_t size, size_t max_size);
 
 #endif /* __XEN_GUEST_ACCESS_H__ */
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */