From: Greg Ungerer <gerg@snapgear.com>
To: Konstantin Khlebnikov <khlebnikov@openvz.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
David Howells <dhowells@redhat.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Greg Ungerer <gerg@uclinux.org>
Subject: Re: [PATCH 04/16] mm/nommu: use vm_flags_t for vma flags
Date: Wed, 21 Mar 2012 17:08:46 +1000 [thread overview]
Message-ID: <4F697E7E.6090301@snapgear.com> (raw)
In-Reply-To: <20120321065629.13852.5630.stgit@zurg>
Hi Konstantin,
On 21/03/12 16:56, Konstantin Khlebnikov wrote:
> Signed-off-by: Konstantin Khlebnikov<khlebnikov@openvz.org>
> Cc: David Howells<dhowells@redhat.com>
> Cc: Greg Ungerer<gerg@uclinux.org>
> ---
> fs/proc/nommu.c | 3 ++-
> fs/proc/task_nommu.c | 14 ++++++++------
> mm/nommu.c | 19 ++++++++++---------
> 3 files changed, 20 insertions(+), 16 deletions(-)
>
> diff --git a/fs/proc/nommu.c b/fs/proc/nommu.c
> index b1822dd..cadc798 100644
> --- a/fs/proc/nommu.c
> +++ b/fs/proc/nommu.c
> @@ -39,7 +39,8 @@ static int nommu_region_show(struct seq_file *m, struct vm_region *region)
> unsigned long ino = 0;
> struct file *file;
> dev_t dev = 0;
> - int flags, len;
> + int len;
> + vm_flags_t vm_flags;
>
> flags = region->vm_flags;
^^^^^
I think you want vm_flags here right?
There is other uses of "flags" in this function as well.
Regards
Greg
> file = region->vm_file;
> diff --git a/fs/proc/task_nommu.c b/fs/proc/task_nommu.c
> index 8aaba8c..9abbc66 100644
> --- a/fs/proc/task_nommu.c
> +++ b/fs/proc/task_nommu.c
> @@ -142,10 +142,11 @@ static int nommu_vma_show(struct seq_file *m, struct vm_area_struct *vma,
> unsigned long ino = 0;
> struct file *file;
> dev_t dev = 0;
> - int flags, len;
> + int len;
> + vm_flags_t vm_flags;
> unsigned long long pgoff = 0;
>
> - flags = vma->vm_flags;
> + vm_flags = vma->vm_flags;
> file = vma->vm_file;
>
> if (file) {
> @@ -159,10 +160,11 @@ static int nommu_vma_show(struct seq_file *m, struct vm_area_struct *vma,
> "%08lx-%08lx %c%c%c%c %08llx %02x:%02x %lu %n",
> vma->vm_start,
> vma->vm_end,
> - flags& VM_READ ? 'r' : '-',
> - flags& VM_WRITE ? 'w' : '-',
> - flags& VM_EXEC ? 'x' : '-',
> - flags& VM_MAYSHARE ? flags& VM_SHARED ? 'S' : 's' : 'p',
> + vm_flags& VM_READ ? 'r' : '-',
> + vm_flags& VM_WRITE ? 'w' : '-',
> + vm_flags& VM_EXEC ? 'x' : '-',
> + vm_flags& VM_MAYSHARE ?
> + vm_flags& VM_SHARED ? 'S' : 's' : 'p',
> pgoff,
> MAJOR(dev), MINOR(dev), ino,&len);
>
> diff --git a/mm/nommu.c b/mm/nommu.c
> index f59e170..33d0ab7 100644
> --- a/mm/nommu.c
> +++ b/mm/nommu.c
> @@ -130,7 +130,7 @@ int __get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
> int *retry)
> {
> struct vm_area_struct *vma;
> - unsigned long vm_flags;
> + vm_flags_t vm_flags;
> int i;
>
> /* calculate required read or write permissions.
> @@ -658,13 +658,13 @@ static void put_nommu_region(struct vm_region *region)
> /*
> * update protection on a vma
> */
> -static void protect_vma(struct vm_area_struct *vma, unsigned long flags)
> +static void protect_vma(struct vm_area_struct *vma, vm_flags_t vm_flags)
> {
> #ifdef CONFIG_MPU
> struct mm_struct *mm = vma->vm_mm;
> long start = vma->vm_start& PAGE_MASK;
> while (start< vma->vm_end) {
> - protect_page(mm, start, flags);
> + protect_page(mm, start, vm_flags);
> start += PAGE_SIZE;
> }
> update_protections(mm);
> @@ -1060,12 +1060,12 @@ static int validate_mmap_request(struct file *file,
> * we've determined that we can make the mapping, now translate what we
> * now know into VMA flags
> */
> -static unsigned long determine_vm_flags(struct file *file,
> - unsigned long prot,
> - unsigned long flags,
> - unsigned long capabilities)
> +static vm_flags_t determine_vm_flags(struct file *file,
> + unsigned long prot,
> + unsigned long flags,
> + unsigned long capabilities)
> {
> - unsigned long vm_flags;
> + vm_flags_t vm_flags;
>
> vm_flags = calc_vm_prot_bits(prot) | calc_vm_flag_bits(flags);
> /* vm_flags |= mm->def_flags; */
> @@ -1243,7 +1243,8 @@ unsigned long do_mmap_pgoff(struct file *file,
> struct vm_area_struct *vma;
> struct vm_region *region;
> struct rb_node *rb;
> - unsigned long capabilities, vm_flags, result;
> + unsigned long capabilities, result;
> + vm_flags_t vm_flags;
> int ret;
>
> kenter(",%lx,%lx,%lx,%lx,%lx", addr, len, prot, flags, pgoff);
>
>
>
>
--
------------------------------------------------------------------------
Greg Ungerer -- Principal Engineer EMAIL: gerg@snapgear.com
SnapGear Group, McAfee PHONE: +61 7 3435 2888
8 Gardner Close FAX: +61 7 3217 5323
Milton, QLD, 4064, Australia WEB: http://www.SnapGear.com
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2012-03-21 7:14 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-21 6:56 [PATCH 00/16] mm: prepare for converting vm->vm_flags to 64-bit Konstantin Khlebnikov
2012-03-21 6:56 ` [PATCH 01/16] mm: introduce NR_VMA_FLAGS Konstantin Khlebnikov
2012-03-21 6:56 ` [PATCH 02/16] mm: use vm_flags_t for vma flags Konstantin Khlebnikov
2012-03-21 6:56 ` [PATCH 03/16] mm/shmem: " Konstantin Khlebnikov
2012-03-21 6:56 ` [PATCH 04/16] mm/nommu: " Konstantin Khlebnikov
2012-03-21 7:08 ` Greg Ungerer [this message]
2012-03-21 7:20 ` Konstantin Khlebnikov
2012-03-21 12:01 ` [PATCH v2 " Konstantin Khlebnikov
2012-03-23 6:47 ` Greg Ungerer
2012-03-21 6:56 ` [PATCH 05/16] mm/drivers: " Konstantin Khlebnikov
2012-03-21 10:34 ` Laurent Pinchart
2012-03-21 14:46 ` Greg Kroah-Hartman
2012-03-21 6:56 ` [PATCH 06/16] mm/x86: " Konstantin Khlebnikov
2012-03-21 6:57 ` H. Peter Anvin
2012-03-21 6:56 ` [PATCH 07/16] mm/arm: " Konstantin Khlebnikov
2012-03-22 21:21 ` Andrew Morton
2012-03-21 6:56 ` [PATCH 08/16] mm/unicore32: " Konstantin Khlebnikov
2012-03-27 3:38 ` Guan Xuetao
2012-03-27 5:58 ` Konstantin Khlebnikov
2012-03-27 7:50 ` Guan Xuetao
2012-03-21 6:56 ` [PATCH 09/16] mm/ia64: " Konstantin Khlebnikov
2012-03-21 6:56 ` [PATCH 10/16] mm/powerpc: " Konstantin Khlebnikov
2012-03-21 6:56 ` [PATCH 11/16] mm/s390: " Konstantin Khlebnikov
2012-03-21 6:57 ` [PATCH 12/16] mm/mips: " Konstantin Khlebnikov
2012-03-21 6:57 ` [PATCH 13/16] mm/parisc: " Konstantin Khlebnikov
2012-03-21 6:57 ` [PATCH 14/16] mm/score: " Konstantin Khlebnikov
2012-03-21 6:57 ` [PATCH 15/16] mm: cast vm_flags_t to u64 before printing Konstantin Khlebnikov
2012-03-21 6:57 ` [PATCH 16/16] mm: vm_flags_t strict type checking Konstantin Khlebnikov
2012-03-21 12:11 ` [PATCH v2 " Konstantin Khlebnikov
2012-03-21 10:06 ` [PATCH 00/16] mm: prepare for converting vm->vm_flags to 64-bit Minchan Kim
2012-03-21 13:16 ` Konstantin Khlebnikov
2012-03-22 5:39 ` Minchan Kim
2012-03-22 6:22 ` Benjamin Herrenschmidt
2012-03-24 14:46 ` Konstantin Khlebnikov
2012-03-24 15:00 ` Konstantin Khlebnikov
2012-03-24 23:50 ` Benjamin Herrenschmidt
2012-03-25 7:55 ` Konstantin Khlebnikov
2012-03-22 21:26 ` Andrew Morton
2012-03-22 21:28 ` Al Viro
2012-03-22 21:41 ` Andrew Morton
2012-03-22 21:57 ` Al Viro
2012-03-22 22:05 ` Konstantin Khlebnikov
2012-03-22 22:24 ` Konstantin Khlebnikov
2012-03-22 22:39 ` Linus Torvalds
2012-03-22 22:52 ` Konstantin Khlebnikov
2012-03-22 23:09 ` Andrew Morton
2012-03-23 1:42 ` Al Viro
2012-03-22 22:08 ` Linus Torvalds
2012-03-23 16:19 ` KOSAKI Motohiro
2012-03-30 2:19 ` Al Viro
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=4F697E7E.6090301@snapgear.com \
--to=gerg@snapgear.com \
--cc=akpm@linux-foundation.org \
--cc=dhowells@redhat.com \
--cc=gerg@uclinux.org \
--cc=khlebnikov@openvz.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.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