diff options
author | Kevin E Martin <kem@kem.org> | 2001-03-14 22:22:50 +0000 |
---|---|---|
committer | Kevin E Martin <kem@kem.org> | 2001-03-14 22:22:50 +0000 |
commit | 74e19a40187ac3b5907922e5dc01418135a5794b (patch) | |
tree | 6623cfe435730e28c25829ebc6931e46871b81ce /linux/drm_ioctl.h | |
parent | e2b2bffc6b25361b2f09afc5a28030645440cd03 (diff) |
Merged sarea-1-0-0sarea-1-0-0-20010314-mergefull-1-0-0-20010315-head
Diffstat (limited to 'linux/drm_ioctl.h')
-rw-r--r-- | linux/drm_ioctl.h | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/linux/drm_ioctl.h b/linux/drm_ioctl.h index ce6ac2e6..2fba6b0c 100644 --- a/linux/drm_ioctl.h +++ b/linux/drm_ioctl.h @@ -105,22 +105,40 @@ int DRM(getmap)( struct inode *inode, struct file *filp, drm_file_t *priv = filp->private_data; drm_device_t *dev = priv->dev; drm_map_t map; + drm_map_list_t *r_list = NULL; + struct list_head *list; int idx; + int i; if (copy_from_user(&map, (drm_map_t *)arg, sizeof(map))) return -EFAULT; idx = map.offset; + down(&dev->struct_sem); if (idx < 0 || idx >= dev->map_count) { up(&dev->struct_sem); return -EINVAL; } - map.offset = dev->maplist[idx]->offset; - map.size = dev->maplist[idx]->size; - map.type = dev->maplist[idx]->type; - map.flags = dev->maplist[idx]->flags; - map.handle = dev->maplist[idx]->handle; - map.mtrr = dev->maplist[idx]->mtrr; + + i = 0; + list_for_each(list, &dev->maplist->head) { + if(i == idx) { + r_list = (drm_map_list_t *)list; + break; + } + i++; + } + if(!r_list || !r_list->map) { + up(&dev->struct_sem); + return -EINVAL; + } + + map.offset = r_list->map->offset; + map.size = r_list->map->size; + map.type = r_list->map->type; + map.flags = r_list->map->flags; + map.handle = r_list->map->handle; + map.mtrr = r_list->map->mtrr; up(&dev->struct_sem); if (copy_to_user((drm_map_t *)arg, &map, sizeof(map))) return -EFAULT; |