diff options
author | Oleg Nesterov <oleg@redhat.com> | 2012-07-29 14:22:47 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2012-07-30 05:27:25 -0400 |
commit | 57683f72b8c01c53c85fe13e82fe1feb3a06bcd5 (patch) | |
tree | 87014149ef710e9f3c0af87cd6ec3118fc4eb723 /kernel | |
parent | f4d6dfe55115efe981b4b5f37183ddccaaa792f0 (diff) |
uprobes: Rename vma_address() and make it return "unsigned long"
1. vma_address() returns loff_t, this looks confusing and this
is unnecessary after the previous change. Make it return "ulong",
all callers truncate the result anyway.
2. Its name conflicts with mm/rmap.c:vma_address(), rename it to
offset_to_vaddr(), this matches vaddr_to_offset().
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: Srikar Dronamraju <srikar.vnet.ibm.com>
Cc: Anton Arapov <anton@redhat.com>
Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Link: http://lkml.kernel.org/r/20120729182247.GA20365@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/events/uprobes.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c index cdc3c951251c..bb30a4fc5050 100644 --- a/kernel/events/uprobes.c +++ b/kernel/events/uprobes.c | |||
@@ -112,14 +112,9 @@ static bool valid_vma(struct vm_area_struct *vma, bool is_register) | |||
112 | return false; | 112 | return false; |
113 | } | 113 | } |
114 | 114 | ||
115 | static loff_t vma_address(struct vm_area_struct *vma, loff_t offset) | 115 | static unsigned long offset_to_vaddr(struct vm_area_struct *vma, loff_t offset) |
116 | { | 116 | { |
117 | loff_t vaddr; | 117 | return vma->vm_start + offset - ((loff_t)vma->vm_pgoff << PAGE_SHIFT); |
118 | |||
119 | vaddr = vma->vm_start + offset; | ||
120 | vaddr -= (loff_t)vma->vm_pgoff << PAGE_SHIFT; | ||
121 | |||
122 | return vaddr; | ||
123 | } | 118 | } |
124 | 119 | ||
125 | static loff_t vaddr_to_offset(struct vm_area_struct *vma, unsigned long vaddr) | 120 | static loff_t vaddr_to_offset(struct vm_area_struct *vma, unsigned long vaddr) |
@@ -775,7 +770,7 @@ build_map_info(struct address_space *mapping, loff_t offset, bool is_register) | |||
775 | curr = info; | 770 | curr = info; |
776 | 771 | ||
777 | info->mm = vma->vm_mm; | 772 | info->mm = vma->vm_mm; |
778 | info->vaddr = vma_address(vma, offset); | 773 | info->vaddr = offset_to_vaddr(vma, offset); |
779 | } | 774 | } |
780 | mutex_unlock(&mapping->i_mmap_mutex); | 775 | mutex_unlock(&mapping->i_mmap_mutex); |
781 | 776 | ||
@@ -1042,7 +1037,7 @@ int uprobe_mmap(struct vm_area_struct *vma) | |||
1042 | 1037 | ||
1043 | list_for_each_entry_safe(uprobe, u, &tmp_list, pending_list) { | 1038 | list_for_each_entry_safe(uprobe, u, &tmp_list, pending_list) { |
1044 | if (!ret) { | 1039 | if (!ret) { |
1045 | loff_t vaddr = vma_address(vma, uprobe->offset); | 1040 | unsigned long vaddr = offset_to_vaddr(vma, uprobe->offset); |
1046 | 1041 | ||
1047 | ret = install_breakpoint(uprobe, vma->vm_mm, vma, vaddr); | 1042 | ret = install_breakpoint(uprobe, vma->vm_mm, vma, vaddr); |
1048 | /* | 1043 | /* |
@@ -1103,7 +1098,7 @@ void uprobe_munmap(struct vm_area_struct *vma, unsigned long start, unsigned lon | |||
1103 | build_probe_list(inode, vma, start, end, &tmp_list); | 1098 | build_probe_list(inode, vma, start, end, &tmp_list); |
1104 | 1099 | ||
1105 | list_for_each_entry_safe(uprobe, u, &tmp_list, pending_list) { | 1100 | list_for_each_entry_safe(uprobe, u, &tmp_list, pending_list) { |
1106 | loff_t vaddr = vma_address(vma, uprobe->offset); | 1101 | unsigned long vaddr = offset_to_vaddr(vma, uprobe->offset); |
1107 | /* | 1102 | /* |
1108 | * An unregister could have removed the probe before | 1103 | * An unregister could have removed the probe before |
1109 | * unmap. So check before we decrement the count. | 1104 | * unmap. So check before we decrement the count. |