Re: [patch 12/18] usb: mon nopage
On Wed, Dec 05, 2007 at 08:39:25AM -0800, Pete Zaitcev wrote: > On Wed, 05 Dec 2007 18:15:59 +1100, [EMAIL PROTECTED] wrote: > > > Convert USB mon driver from nopage to fault. > > > if (offset >= rp->b_size) > > - return NOPAGE_SIGBUS; > > + return VM_FAULT_SIGBUS; > > chunk_idx = offset / CHUNK_SIZE; > > pageptr = rp->b_vec[chunk_idx].pg; > > get_page(pageptr); > > - if (type) > > - *type = VM_FAULT_MINOR; > > - return pageptr; > > + vmf->page = pageptr; > > + return 0; > > Looks like a trivial change, I ack this. It's a rarely used API, I have > to run tests to see how it works. I'll collect any failing pieces later > if any. That would be great, thanks. > Signed-off-by: Pete Zaitcev <[EMAIL PROTECTED]> > > -- Pete -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [patch 12/18] usb: mon nopage
On Wed, 05 Dec 2007 18:15:59 +1100, [EMAIL PROTECTED] wrote: > Convert USB mon driver from nopage to fault. > if (offset >= rp->b_size) > - return NOPAGE_SIGBUS; > + return VM_FAULT_SIGBUS; > chunk_idx = offset / CHUNK_SIZE; > pageptr = rp->b_vec[chunk_idx].pg; > get_page(pageptr); > - if (type) > - *type = VM_FAULT_MINOR; > - return pageptr; > + vmf->page = pageptr; > + return 0; Looks like a trivial change, I ack this. It's a rarely used API, I have to run tests to see how it works. I'll collect any failing pieces later if any. Signed-off-by: Pete Zaitcev <[EMAIL PROTECTED]> -- Pete -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[patch 12/18] usb: mon nopage
Convert USB mon driver from nopage to fault. Signed-off-by: Nick Piggin <[EMAIL PROTECTED]> Cc: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Cc: linux-kernel@vger.kernel.org --- drivers/usb/mon/mon_bin.c | 16 +++- 1 file changed, 7 insertions(+), 9 deletions(-) Index: linux-2.6/drivers/usb/mon/mon_bin.c === --- linux-2.6.orig/drivers/usb/mon/mon_bin.c +++ linux-2.6/drivers/usb/mon/mon_bin.c @@ -1045,33 +1045,31 @@ static void mon_bin_vma_close(struct vm_ /* * Map ring pages to user space. */ -struct page *mon_bin_vma_nopage(struct vm_area_struct *vma, -unsigned long address, int *type) +static int mon_bin_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf) { struct mon_reader_bin *rp = vma->vm_private_data; unsigned long offset, chunk_idx; struct page *pageptr; - offset = (address - vma->vm_start) + (vma->vm_pgoff << PAGE_SHIFT); + offset = vmf->pgoff << PAGE_SHIFT; if (offset >= rp->b_size) - return NOPAGE_SIGBUS; + return VM_FAULT_SIGBUS; chunk_idx = offset / CHUNK_SIZE; pageptr = rp->b_vec[chunk_idx].pg; get_page(pageptr); - if (type) - *type = VM_FAULT_MINOR; - return pageptr; + vmf->page = pageptr; + return 0; } struct vm_operations_struct mon_bin_vm_ops = { .open = mon_bin_vma_open, .close =mon_bin_vma_close, - .nopage = mon_bin_vma_nopage, + .fault =mon_bin_vma_fault, }; int mon_bin_mmap(struct file *filp, struct vm_area_struct *vma) { - /* don't do anything here: "nopage" will set up page table entries */ + /* don't do anything here: "fault" will set up page table entries */ vma->vm_ops = _bin_vm_ops; vma->vm_flags |= VM_RESERVED; vma->vm_private_data = filp->private_data; -- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[patch 12/18] usb: mon nopage
Convert USB mon driver from nopage to fault. Signed-off-by: Nick Piggin [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Cc: linux-kernel@vger.kernel.org --- drivers/usb/mon/mon_bin.c | 16 +++- 1 file changed, 7 insertions(+), 9 deletions(-) Index: linux-2.6/drivers/usb/mon/mon_bin.c === --- linux-2.6.orig/drivers/usb/mon/mon_bin.c +++ linux-2.6/drivers/usb/mon/mon_bin.c @@ -1045,33 +1045,31 @@ static void mon_bin_vma_close(struct vm_ /* * Map ring pages to user space. */ -struct page *mon_bin_vma_nopage(struct vm_area_struct *vma, -unsigned long address, int *type) +static int mon_bin_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf) { struct mon_reader_bin *rp = vma-vm_private_data; unsigned long offset, chunk_idx; struct page *pageptr; - offset = (address - vma-vm_start) + (vma-vm_pgoff PAGE_SHIFT); + offset = vmf-pgoff PAGE_SHIFT; if (offset = rp-b_size) - return NOPAGE_SIGBUS; + return VM_FAULT_SIGBUS; chunk_idx = offset / CHUNK_SIZE; pageptr = rp-b_vec[chunk_idx].pg; get_page(pageptr); - if (type) - *type = VM_FAULT_MINOR; - return pageptr; + vmf-page = pageptr; + return 0; } struct vm_operations_struct mon_bin_vm_ops = { .open = mon_bin_vma_open, .close =mon_bin_vma_close, - .nopage = mon_bin_vma_nopage, + .fault =mon_bin_vma_fault, }; int mon_bin_mmap(struct file *filp, struct vm_area_struct *vma) { - /* don't do anything here: nopage will set up page table entries */ + /* don't do anything here: fault will set up page table entries */ vma-vm_ops = mon_bin_vm_ops; vma-vm_flags |= VM_RESERVED; vma-vm_private_data = filp-private_data; -- -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [patch 12/18] usb: mon nopage
On Wed, 05 Dec 2007 18:15:59 +1100, [EMAIL PROTECTED] wrote: Convert USB mon driver from nopage to fault. if (offset = rp-b_size) - return NOPAGE_SIGBUS; + return VM_FAULT_SIGBUS; chunk_idx = offset / CHUNK_SIZE; pageptr = rp-b_vec[chunk_idx].pg; get_page(pageptr); - if (type) - *type = VM_FAULT_MINOR; - return pageptr; + vmf-page = pageptr; + return 0; Looks like a trivial change, I ack this. It's a rarely used API, I have to run tests to see how it works. I'll collect any failing pieces later if any. Signed-off-by: Pete Zaitcev [EMAIL PROTECTED] -- Pete -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [patch 12/18] usb: mon nopage
On Wed, Dec 05, 2007 at 08:39:25AM -0800, Pete Zaitcev wrote: On Wed, 05 Dec 2007 18:15:59 +1100, [EMAIL PROTECTED] wrote: Convert USB mon driver from nopage to fault. if (offset = rp-b_size) - return NOPAGE_SIGBUS; + return VM_FAULT_SIGBUS; chunk_idx = offset / CHUNK_SIZE; pageptr = rp-b_vec[chunk_idx].pg; get_page(pageptr); - if (type) - *type = VM_FAULT_MINOR; - return pageptr; + vmf-page = pageptr; + return 0; Looks like a trivial change, I ack this. It's a rarely used API, I have to run tests to see how it works. I'll collect any failing pieces later if any. That would be great, thanks. Signed-off-by: Pete Zaitcev [EMAIL PROTECTED] -- Pete -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/