[PATCH 1/8] Uprobe: Export vaddr <-> offset conversion functions
No functionality changes. Signed-off-by: Ravi Bangoria --- include/linux/mm.h | 12 kernel/events/uprobes.c | 10 -- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index ad06d42..95909f2 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2274,6 +2274,18 @@ struct vm_unmapped_area_info { return unmapped_area(info); } +static inline unsigned long +offset_to_vaddr(struct vm_area_struct *vma, loff_t offset) +{ + return vma->vm_start + offset - ((loff_t)vma->vm_pgoff << PAGE_SHIFT); +} + +static inline loff_t +vaddr_to_offset(struct vm_area_struct *vma, unsigned long vaddr) +{ + return ((loff_t)vma->vm_pgoff << PAGE_SHIFT) + (vaddr - vma->vm_start); +} + /* truncate.c */ extern void truncate_inode_pages(struct address_space *, loff_t); extern void truncate_inode_pages_range(struct address_space *, diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c index ce6848e..bd6f230 100644 --- a/kernel/events/uprobes.c +++ b/kernel/events/uprobes.c @@ -130,16 +130,6 @@ static bool valid_vma(struct vm_area_struct *vma, bool is_register) return vma->vm_file && (vma->vm_flags & flags) == VM_MAYEXEC; } -static unsigned long offset_to_vaddr(struct vm_area_struct *vma, loff_t offset) -{ - return vma->vm_start + offset - ((loff_t)vma->vm_pgoff << PAGE_SHIFT); -} - -static loff_t vaddr_to_offset(struct vm_area_struct *vma, unsigned long vaddr) -{ - return ((loff_t)vma->vm_pgoff << PAGE_SHIFT) + (vaddr - vma->vm_start); -} - /** * __replace_page - replace page in vma by new page. * based on replace_page in mm/ksm.c -- 1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe linux-doc" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/8] Uprobe: Export vaddr <-> offset conversion functions
On Tue, Mar 13, 2018 at 06:25:56PM +0530, Ravi Bangoria wrote: > No functionality changes. > > Signed-off-by: Ravi Bangoria Reviewed-by: Jérôme Glisse > --- > include/linux/mm.h | 12 > kernel/events/uprobes.c | 10 -- > 2 files changed, 12 insertions(+), 10 deletions(-) > > diff --git a/include/linux/mm.h b/include/linux/mm.h > index ad06d42..95909f2 100644 > --- a/include/linux/mm.h > +++ b/include/linux/mm.h > @@ -2274,6 +2274,18 @@ struct vm_unmapped_area_info { > return unmapped_area(info); > } > > +static inline unsigned long > +offset_to_vaddr(struct vm_area_struct *vma, loff_t offset) > +{ > + return vma->vm_start + offset - ((loff_t)vma->vm_pgoff << PAGE_SHIFT); > +} > + > +static inline loff_t > +vaddr_to_offset(struct vm_area_struct *vma, unsigned long vaddr) > +{ > + return ((loff_t)vma->vm_pgoff << PAGE_SHIFT) + (vaddr - vma->vm_start); > +} > + > /* truncate.c */ > extern void truncate_inode_pages(struct address_space *, loff_t); > extern void truncate_inode_pages_range(struct address_space *, > diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c > index ce6848e..bd6f230 100644 > --- a/kernel/events/uprobes.c > +++ b/kernel/events/uprobes.c > @@ -130,16 +130,6 @@ static bool valid_vma(struct vm_area_struct *vma, bool > is_register) > return vma->vm_file && (vma->vm_flags & flags) == VM_MAYEXEC; > } > > -static unsigned long offset_to_vaddr(struct vm_area_struct *vma, loff_t > offset) > -{ > - return vma->vm_start + offset - ((loff_t)vma->vm_pgoff << PAGE_SHIFT); > -} > - > -static loff_t vaddr_to_offset(struct vm_area_struct *vma, unsigned long > vaddr) > -{ > - return ((loff_t)vma->vm_pgoff << PAGE_SHIFT) + (vaddr - vma->vm_start); > -} > - > /** > * __replace_page - replace page in vma by new page. > * based on replace_page in mm/ksm.c > -- > 1.8.3.1 > -- To unsubscribe from this list: send the line "unsubscribe linux-doc" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/8] Uprobe: Export vaddr <-> offset conversion functions
On Tue, 13 Mar 2018 18:25:56 +0530 Ravi Bangoria wrote: > No functionality changes. Please add a detailed explanation why this patch is needed. All commits should be self sufficient and stand on their own. If I were to come up to this patch via a git blame, I would be clueless to why it was done. -- Steve > > Signed-off-by: Ravi Bangoria > --- > -- To unsubscribe from this list: send the line "unsubscribe linux-doc" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/8] Uprobe: Export vaddr <-> offset conversion functions
On 03/15/2018 09:57 PM, Steven Rostedt wrote: > On Tue, 13 Mar 2018 18:25:56 +0530 > Ravi Bangoria wrote: > >> No functionality changes. > Please add a detailed explanation why this patch is needed. All commits > should be self sufficient and stand on their own. If I were to come up > to this patch via a git blame, I would be clueless to why it was done. Sure Steve, Will add description it in next series. Thanks for the review, Ravi -- To unsubscribe from this list: send the line "unsubscribe linux-doc" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html