[svn-commits] trunk r1219 - /trunk/zttranscode.c

svn-commits at lists.digium.com svn-commits at lists.digium.com
Wed Jul 12 05:57:20 MST 2006


Author: kpfleming
Date: Wed Jul 12 07:57:19 2006
New Revision: 1219

URL: http://svn.digium.com/view/zaptel?rev=1219&view=rev
Log:
use mmap API that is present in kernels < 2.6.10 when needed
fix address assignment for mmap in more recent kernels

Modified:
    trunk/zttranscode.c

Modified: trunk/zttranscode.c
URL: http://svn.digium.com/view/zaptel/trunk/zttranscode.c?rev=1219&r1=1218&r2=1219&view=diff
==============================================================================
--- trunk/zttranscode.c (original)
+++ trunk/zttranscode.c Wed Jul 12 07:57:19 2006
@@ -351,6 +351,7 @@
 {
 	struct zt_transcoder_channel *ztc = file->private_data;
 	unsigned long physical;
+	int res;
 
 	if (!ztc)
 		return -EINVAL;
@@ -369,7 +370,12 @@
 	}
 
 	physical = (unsigned long) virt_to_phys(ztc->tch);
-	if (remap_pfn_range(vma, vma->vm_start, physical >> PAGE_SHIFT, sizeof(struct zt_transcode_header), PAGE_SHARED)) {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10)
+	res = remap_pfn_range(vma, vma->vm_start, physical, sizeof(struct zt_transcode_header), PAGE_SHARED);
+#else
+	res = remap_page_range(vma, vma->vm_start, physical >> PAGE_SHIFT, sizeof(struct zt_transcode_header), PAGE_SHARED);
+#endif
+	if (res) {
 		if (debug)
 			printk("zttranscode: remap failed!\n");
 		return -EAGAIN;



More information about the svn-commits mailing list