summaryrefslogtreecommitdiff
path: root/linux
diff options
context:
space:
mode:
authorJeff Hartmann <jhartmann@valinux.com>2000-04-10 16:04:56 +0000
committerJeff Hartmann <jhartmann@valinux.com>2000-04-10 16:04:56 +0000
commit5aa43c056c7686174da60e72cf9c667d04220b17 (patch)
tree7136bba6404683b128144ebf3246405d1a3cbfac /linux
parent136e86822aa82efd73115bd85df7d30db9c931ae (diff)
Created a seperate fops structure so that the code only changes mmap for
the file its operating on
Diffstat (limited to 'linux')
-rw-r--r--linux/i810_dma.c17
-rw-r--r--linux/i810_drv.h1
2 files changed, 16 insertions, 2 deletions
diff --git a/linux/i810_dma.c b/linux/i810_dma.c
index 90c7eb15..c940f5cd 100644
--- a/linux/i810_dma.c
+++ b/linux/i810_dma.c
@@ -138,6 +138,17 @@ static int i810_freelist_put(drm_device_t *dev, drm_buf_t *buf)
return 0;
}
+static struct file_operations i810_buffer_fops = {
+ open: i810_open,
+ flush: drm_flush,
+ release: i810_release,
+ ioctl: i810_ioctl,
+ mmap: i810_mmap_buffers,
+ read: drm_read,
+ fasync: drm_fasync,
+ poll: drm_poll,
+};
+
int i810_mmap_buffers(struct file *filp, struct vm_area_struct *vma)
{
vma->vm_flags |= VM_IO;
@@ -152,15 +163,17 @@ static int i810_map_buffer(drm_buf_t *buf, struct file *filp)
{
drm_i810_buf_priv_t *buf_priv = buf->dev_private;
int retcode = 0;
+ struct file_operations *old_fops;
if(buf_priv->currently_mapped == I810_BUF_MAPPED) return -EINVAL;
down(&current->mm->mmap_sem);
- filp->f_op->mmap = i810_mmap_buffers;
+ old_fops = filp->f_op;
+ filp->f_op = &i810_buffer_fops;
buf_priv->virtual = (void *)do_mmap(filp, 0, buf->total,
PROT_READ|PROT_WRITE,
MAP_SHARED,
buf->bus_address);
- filp->f_op->mmap = drm_mmap;
+ filp->f_op = old_fops;
if ((unsigned long)buf_priv->virtual > -1024UL) {
/* Real error */
DRM_DEBUG("mmap error\n");
diff --git a/linux/i810_drv.h b/linux/i810_drv.h
index a4e4d6c7..e775d1b6 100644
--- a/linux/i810_drv.h
+++ b/linux/i810_drv.h
@@ -86,6 +86,7 @@ extern int i810_flush_ioctl(struct inode *inode, struct file *filp,
extern void i810_reclaim_buffers(drm_device_t *dev, pid_t pid);
extern int i810_getage(struct inode *inode, struct file *filp, unsigned int cmd,
unsigned long arg);
+extern int i810_mmap_buffers(struct file *filp, struct vm_area_struct *vma);
/* i810_bufs.c */