cregit-Linux how code gets into the kernel

Release 4.7 drivers/gpu/drm/drm_auth.c

Directory: drivers/gpu/drm
/*
 * 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

PersonTokensPropCommitsCommitProp
pre-gitpre-git4539.47%216.67%
david herrmanndavid herrmann3833.33%18.33%
dave airliedave airlie1815.79%541.67%
eric anholteric anholt65.26%216.67%
thomas hellstromthomas hellstrom54.39%18.33%
thomas gleixnerthomas gleixner21.75%18.33%
Total114100.00%12100.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

PersonTokensPropCommitsCommitProp
pre-gitpre-git4541.67%112.50%
david herrmanndavid herrmann3431.48%112.50%
dave airliedave airlie1513.89%450.00%
eric anholteric anholt1412.96%225.00%
Total108100.00%8100.00%


Overall Contributors

PersonTokensPropCommitsCommitProp
pre-gitpre-git9239.83%213.33%
david herrmanndavid herrmann7532.47%16.67%
dave airliedave airlie3314.29%640.00%
eric anholteric anholt208.66%213.33%
thomas hellstromthomas hellstrom52.16%16.67%
daniel vetterdaniel vetter31.30%16.67%
thomas gleixnerthomas gleixner20.87%16.67%
david howellsdavid howells10.43%16.67%
Total231100.00%15100.00%
Directory: drivers/gpu/drm
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
{% endraw %}