From: Pavel Machek <pavel@ucw.cz>
To: Adam Litke <agl@us.ibm.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [RFC] Cleanup line-wrapping in pgtable.h
Date: Mon, 22 Aug 2005 11:29:13 +0200 [thread overview]
Message-ID: <20050822092913.GB11888@elf.ucw.cz> (raw)
In-Reply-To: <1124300739.3139.16.camel@localhost.localdomain>
Hi!
> The line-wrapping in most of the include/asm/pgtable.h pte test/set
> macros looks horrible in my 80 column terminal. The following "test the
> waters" patch is how I would like to see them laid out. I realize that
> the braces don't adhere to CodingStyle but the advantage is (when taking
> wrapping into account) that the code takes up no additional space. How
> do people feel about making this change? Any better suggestions? I
> personally wouldn't like a lone closing brace like normal functions
> because of the extra lines eaten. I volunteer to patch up the other
> architectures if we reach a consensus.
I'm afraid that original version looks better than new one...
Pavel
> Signed-off-by: Adam Litke <agl@us.ibm.com>
>
> pgtable.h | 51 ++++++++++++++++++++++++++++++++++-----------------
> 1 files changed, 34 insertions(+), 17 deletions(-)
> diff -upN reference/include/asm-i386/pgtable.h current/include/asm-i386/pgtable.h
> --- reference/include/asm-i386/pgtable.h
> +++ current/include/asm-i386/pgtable.h
> @@ -215,28 +215,45 @@ extern unsigned long pg0[];
> * The following only work if pte_present() is true.
> * Undefined behaviour if not..
> */
> -static inline int pte_user(pte_t pte) { return (pte).pte_low & _PAGE_USER; }
> -static inline int pte_read(pte_t pte) { return (pte).pte_low & _PAGE_USER; }
> -static inline int pte_dirty(pte_t pte) { return (pte).pte_low & _PAGE_DIRTY; }
> -static inline int pte_young(pte_t pte) { return (pte).pte_low & _PAGE_ACCESSED; }
> -static inline int pte_write(pte_t pte) { return (pte).pte_low & _PAGE_RW; }
> +static inline int pte_user(pte_t pte)
> + { return (pte).pte_low & _PAGE_USER; }
> +static inline int pte_read(pte_t pte)
> + { return (pte).pte_low & _PAGE_USER; }
> +static inline int pte_dirty(pte_t pte)
> + { return (pte).pte_low & _PAGE_DIRTY; }
> +static inline int pte_young(pte_t pte)
> + { return (pte).pte_low & _PAGE_ACCESSED; }
> +static inline int pte_write(pte_t pte)
> + { return (pte).pte_low & _PAGE_RW; }
>
> /*
> * The following only works if pte_present() is not true.
> */
> -static inline int pte_file(pte_t pte) { return (pte).pte_low & _PAGE_FILE; }
> +static inline int pte_file(pte_t pte)
> + { return (pte).pte_low & _PAGE_FILE; }
>
> -static inline pte_t pte_rdprotect(pte_t pte) { (pte).pte_low &= ~_PAGE_USER; return pte; }
> -static inline pte_t pte_exprotect(pte_t pte) { (pte).pte_low &= ~_PAGE_USER; return pte; }
> -static inline pte_t pte_mkclean(pte_t pte) { (pte).pte_low &= ~_PAGE_DIRTY; return pte; }
> -static inline pte_t pte_mkold(pte_t pte) { (pte).pte_low &= ~_PAGE_ACCESSED; return pte; }
> -static inline pte_t pte_wrprotect(pte_t pte) { (pte).pte_low &= ~_PAGE_RW; return pte; }
> -static inline pte_t pte_mkread(pte_t pte) { (pte).pte_low |= _PAGE_USER; return pte; }
> -static inline pte_t pte_mkexec(pte_t pte) { (pte).pte_low |= _PAGE_USER; return pte; }
> -static inline pte_t pte_mkdirty(pte_t pte) { (pte).pte_low |= _PAGE_DIRTY; return pte; }
> -static inline pte_t pte_mkyoung(pte_t pte) { (pte).pte_low |= _PAGE_ACCESSED; return pte; }
> -static inline pte_t pte_mkwrite(pte_t pte) { (pte).pte_low |= _PAGE_RW; return pte; }
> -static inline pte_t pte_mkhuge(pte_t pte) { (pte).pte_low |= _PAGE_PRESENT | _PAGE_PSE; return pte; }
> +static inline pte_t pte_rdprotect(pte_t pte)
> + { (pte).pte_low &= ~_PAGE_USER; return pte; }
> +static inline pte_t pte_exprotect(pte_t pte)
> + { (pte).pte_low &= ~_PAGE_USER; return pte; }
> +static inline pte_t pte_mkclean(pte_t pte)
> + { (pte).pte_low &= ~_PAGE_DIRTY; return pte; }
> +static inline pte_t pte_mkold(pte_t pte)
> + { (pte).pte_low &= ~_PAGE_ACCESSED; return pte; }
> +static inline pte_t pte_wrprotect(pte_t pte)
> + { (pte).pte_low &= ~_PAGE_RW; return pte; }
> +static inline pte_t pte_mkread(pte_t pte)
> + { (pte).pte_low |= _PAGE_USER; return pte; }
> +static inline pte_t pte_mkexec(pte_t pte)
> + { (pte).pte_low |= _PAGE_USER; return pte; }
> +static inline pte_t pte_mkdirty(pte_t pte)
> + { (pte).pte_low |= _PAGE_DIRTY; return pte; }
> +static inline pte_t pte_mkyoung(pte_t pte)
> + { (pte).pte_low |= _PAGE_ACCESSED; return pte; }
> +static inline pte_t pte_mkwrite(pte_t pte)
> + { (pte).pte_low |= _PAGE_RW; return pte; }
> +static inline pte_t pte_mkhuge(pte_t pte)
> + { (pte).pte_low |= _PAGE_PRESENT | _PAGE_PSE; return pte; }
>
> #ifdef CONFIG_X86_PAE
> # include <asm/pgtable-3level.h>
--
if you have sharp zaurus hardware you don't need... you know my address
next prev parent reply other threads:[~2005-08-22 22:23 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-08-17 17:45 Adam Litke
2005-08-17 17:56 ` Christoph Hellwig
2005-08-17 19:48 ` Alexey Dobriyan
2005-08-17 18:00 ` Tommy Reynolds
2005-08-17 18:19 ` Dave Hansen
2005-08-22 9:29 ` Pavel Machek [this message]
2005-08-22 21:11 ` Matthew Helsley
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=20050822092913.GB11888@elf.ucw.cz \
--to=pavel@ucw.cz \
--cc=agl@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
/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
all inboxes | Powered by JetHome®