[zaptel-commits] trunk r1221 - /trunk/zttranscode.c
zaptel-commits at lists.digium.com
zaptel-commits at lists.digium.com
Wed Jul 12 18:52:31 MST 2006
Author: kpfleming
Date: Wed Jul 12 20:52:31 2006
New Revision: 1221
URL: http://svn.digium.com/view/zaptel?rev=1221&view=rev
Log:
mark memory pages used by transcoder as reserved
Modified:
trunk/zttranscode.c
Modified: trunk/zttranscode.c
URL: http://svn.digium.com/view/zaptel/trunk/zttranscode.c?rev=1221&r1=1220&r2=1221&view=diff
==============================================================================
--- trunk/zttranscode.c (original)
+++ trunk/zttranscode.c Wed Jul 12 20:52:31 2006
@@ -171,28 +171,30 @@
{
struct zt_transcoder_channel *ztc;
struct zt_transcode_header *zth;
-
- ztc = kmalloc(sizeof(*ztc), GFP_KERNEL);
- zth = kmalloc(sizeof(*zth), GFP_KERNEL | GFP_DMA);
+ struct page *page;
+
+ if (!(ztc = kmalloc(sizeof(*ztc), GFP_KERNEL)))
+ return -ENOMEM;
+
+ if (!(zth = kmalloc(sizeof(*zth), GFP_KERNEL | GFP_DMA))) {
+ kfree(ztc);
+ return -ENOMEM;
+ }
- if (ztc && zth) {
- memset(ztc, 0, sizeof(*ztc));
- memset(zth, 0, sizeof(*zth));
- ztc->flags = ZT_TC_FLAG_TRANSIENT|ZT_TC_FLAG_BUSY;
- ztc->tch = zth;
- if (debug)
- printk("Allocated Transcoder Channel, header is at %p!\n", zth);
- zth->magic = ZT_TRANSCODE_MAGIC;
- file->private_data = ztc;
-
- return 0;
- }
-
- if (ztc)
- kfree(ztc);
- if (zth)
- kfree(zth);
- return -ENOMEM;
+ memset(ztc, 0, sizeof(*ztc));
+ memset(zth, 0, sizeof(*zth));
+ ztc->flags = ZT_TC_FLAG_TRANSIENT | ZT_TC_FLAG_BUSY;
+ ztc->tch = zth;
+ if (debug)
+ printk("Allocated Transcoder Channel, header is at %p!\n", zth);
+ zth->magic = ZT_TRANSCODE_MAGIC;
+ file->private_data = ztc;
+ for (page = virt_to_page(zth);
+ page < virt_to_page((unsigned long) zth + sizeof(*zth));
+ page++)
+ SetPageReserved(page);
+
+ return 0;
}
static void ztc_release(struct zt_transcoder_channel *ztc)
More information about the zaptel-commits
mailing list