FreeBSD/sys/dev/drm2/drm_bufs.c
/* The rmmap ioctl appears to be unnecessary.  All mappings are torn down on
 * the last close of the device, and this is necessary for cleanup when things
 * exit uncleanly.  Therefore, having userland manually remove mappings seems
 * like a pointless exercise since they're going away anyway.
 *
 * One use case might be after addmap is allowed for normal users for SHM and
 * gets used by drivers that the server doesn't need to care about.  This seems
 * unlikely.
 *
 * \param inode device inode.
 * \param file_priv DRM file private.
 * \param cmd command.
 * \param arg pointer to a struct drm_map structure.
 * \return zero on success or a negative value on error.
 */
The rmmap ioctl appears to be unnecessary.  All mappings are torn down on
the last close of the device, and this is necessary for cleanup when things
exit uncleanly.  Therefore, having userland manually remove mappings seems
like a pointless exercise since they're going away anyway.

One use case might be after addmap is allowed for normal users for SHM and
gets used by drivers that the server doesn't need to care about.  This seems
unlikely.

\param inode device inode.
\param file_priv DRM file private.
\param cmd command.
\param arg pointer to a struct drm_map structure.
\return zero on success or a negative value on error.
The rmmap ioctl appears to be unnecessary . All mappings are torn down on the last close of the device and this is necessary for cleanup when things exit uncleanly . Therefore having userland manually remove mappings seems like a pointless exercise since they ' re going away anyway . One use case might be after addmap is allowed for normal users for SHM and gets used by drivers that the server doesn ' t need to care about . This seems unlikely . \ param inode device inode . \ param file_priv DRM file private . \ param cmd command . \ param arg pointer to a struct drm_map structure . \ return zero on success or a negative value on error .
int drm_rmmap_ioctl(struct drm_device *dev, void *data,
		    struct drm_file *file_priv)
{
	struct drm_map *request = data;
	struct drm_local_map *map = NULL;
	struct drm_map_list *r_list;
	int ret;
	DRM_LOCK(dev);
	list_for_each_entry(r_list, &dev->maplist, head) {
		if (r_list->map &&
		    r_list->user_token == (unsigned long)request->handle &&
		    r_list->map->flags & _DRM_REMOVABLE) {
			map = r_list->map;
			break;
		}
	}
	if (list_empty(&dev->maplist) || !map) {
		DRM_UNLOCK(dev);
		return -EINVAL;
	}
	if ((map->type == _DRM_REGISTERS) || (map->type == _DRM_FRAME_BUFFER)) {
		DRM_UNLOCK(dev);
		return 0;
	}
	ret = drm_rmmap_locked(dev, map);
	DRM_UNLOCK(dev);
	return ret;
}
int drm_rmmap_ioctl ( struct drm_device * dev , void * data , struct drm_file * file_priv ) { struct drm_map * request = data ; struct drm_local_map * map = NULL ; struct drm_map_list * r_list ; int ret ; DRM_LOCK ( dev ) ; list_for_each_entry ( r_list , & dev -> maplist , head ) { if ( r_list -> map && r_list -> user_token == ( unsigned long ) request -> handle && r_list -> map -> flags & _DRM_REMOVABLE ) { map = r_list -> map ; break ; } } if ( list_empty ( & dev -> maplist ) || ! map ) { DRM_UNLOCK ( dev ) ; return - EINVAL ; } if ( ( map -> type == _DRM_REGISTERS ) || ( map -> type == _DRM_FRAME_BUFFER ) ) { DRM_UNLOCK ( dev ) ; return 0 ; } ret = drm_rmmap_locked ( dev , map ) ; DRM_UNLOCK ( dev ) ; return ret ; }
The rmmap ioctl appears to be unnecessary.
The rmmap ioctl appears to be unnecessary .
/* List has wrapped around to the head pointer, or its empty we didn't
	 * find anything.
	 */ /* Register and framebuffer maps are permanent */