Release 4.7 drivers/gpu/drm/drm_auth.c
  
  
/*
 * Created: Tue Feb  2 08:37:54 1999 by faith@valinux.com
 *
 * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
 * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
 * All Rights Reserved.
 *
 * Author Rickard E. (Rik) Faith <faith@valinux.com>
 * Author Gareth Hughes <gareth@valinux.com>
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice (including the next
 * paragraph) shall be included in all copies or substantial portions of the
 * Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 */
#include <drm/drmP.h>
#include "drm_internal.h"
/**
 * drm_getmagic - Get unique magic of a client
 * @dev: DRM device to operate on
 * @data: ioctl data containing the drm_auth object
 * @file_priv: DRM file that performs the operation
 *
 * This looks up the unique magic of the passed client and returns it. If the
 * client did not have a magic assigned, yet, a new one is registered. The magic
 * is stored in the passed drm_auth object.
 *
 * Returns: 0 on success, negative error code on failure.
 */
int drm_getmagic(struct drm_device *dev, void *data, struct drm_file *file_priv)
{
	struct drm_auth *auth = data;
	int ret = 0;
	mutex_lock(&dev->struct_mutex);
	if (!file_priv->magic) {
		ret = idr_alloc(&file_priv->master->magic_map, file_priv,
				1, 0, GFP_KERNEL);
		if (ret >= 0)
			file_priv->magic = ret;
	}
	auth->magic = file_priv->magic;
	mutex_unlock(&dev->struct_mutex);
	DRM_DEBUG("%u\n", auth->magic);
	return ret < 0 ? ret : 0;
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| pre-git | pre-git | 45 | 39.47% | 2 | 16.67% | 
| david herrmann | david herrmann | 38 | 33.33% | 1 | 8.33% | 
| dave airlie | dave airlie | 18 | 15.79% | 5 | 41.67% | 
| eric anholt | eric anholt | 6 | 5.26% | 2 | 16.67% | 
| thomas hellstrom | thomas hellstrom | 5 | 4.39% | 1 | 8.33% | 
| thomas gleixner | thomas gleixner | 2 | 1.75% | 1 | 8.33% | 
 | Total | 114 | 100.00% | 12 | 100.00% | 
/**
 * drm_authmagic - Authenticate client with a magic
 * @dev: DRM device to operate on
 * @data: ioctl data containing the drm_auth object
 * @file_priv: DRM file that performs the operation
 *
 * This looks up a DRM client by the passed magic and authenticates it.
 *
 * Returns: 0 on success, negative error code on failure.
 */
int drm_authmagic(struct drm_device *dev, void *data,
		  struct drm_file *file_priv)
{
	struct drm_auth *auth = data;
	struct drm_file *file;
	DRM_DEBUG("%u\n", auth->magic);
	mutex_lock(&dev->struct_mutex);
	file = idr_find(&file_priv->master->magic_map, auth->magic);
	if (file) {
		file->authenticated = 1;
		idr_replace(&file_priv->master->magic_map, NULL, auth->magic);
	}
	mutex_unlock(&dev->struct_mutex);
	return file ? 0 : -EINVAL;
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| pre-git | pre-git | 45 | 41.67% | 1 | 12.50% | 
| david herrmann | david herrmann | 34 | 31.48% | 1 | 12.50% | 
| dave airlie | dave airlie | 15 | 13.89% | 4 | 50.00% | 
| eric anholt | eric anholt | 14 | 12.96% | 2 | 25.00% | 
 | Total | 108 | 100.00% | 8 | 100.00% | 
Overall Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| pre-git | pre-git | 92 | 39.83% | 2 | 13.33% | 
| david herrmann | david herrmann | 75 | 32.47% | 1 | 6.67% | 
| dave airlie | dave airlie | 33 | 14.29% | 6 | 40.00% | 
| eric anholt | eric anholt | 20 | 8.66% | 2 | 13.33% | 
| thomas hellstrom | thomas hellstrom | 5 | 2.16% | 1 | 6.67% | 
| daniel vetter | daniel vetter | 3 | 1.30% | 1 | 6.67% | 
| thomas gleixner | thomas gleixner | 2 | 0.87% | 1 | 6.67% | 
| david howells | david howells | 1 | 0.43% | 1 | 6.67% | 
 | Total | 231 | 100.00% | 15 | 100.00% | 
  
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.