From fa6b1d129e7bf8acf41e66c9c665ae9f9c1d5b0d Mon Sep 17 00:00:00 2001 From: Jon Smirl Date: Mon, 27 Sep 2004 19:51:38 +0000 Subject: First check in for DRM that splits core from personality modules --- linux-core/drm_auth.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'linux-core/drm_auth.c') diff --git a/linux-core/drm_auth.c b/linux-core/drm_auth.c index fe099871..84c39f74 100644 --- a/linux-core/drm_auth.c +++ b/linux-core/drm_auth.c @@ -44,7 +44,7 @@ * The key is the modulus of the hash table size, #DRM_HASH_SIZE, which must be * a power of 2. */ -static int DRM(hash_magic)(drm_magic_t magic) +static int drm_hash_magic(drm_magic_t magic) { return magic & (DRM_HASH_SIZE-1); } @@ -59,11 +59,11 @@ static int DRM(hash_magic)(drm_magic_t magic) * the one with matching magic number, while holding the drm_device::struct_sem * lock. */ -static drm_file_t *DRM(find_file)(drm_device_t *dev, drm_magic_t magic) +static drm_file_t *drm_find_file(drm_device_t *dev, drm_magic_t magic) { drm_file_t *retval = NULL; drm_magic_entry_t *pt; - int hash = DRM(hash_magic)(magic); + int hash = drm_hash_magic(magic); down(&dev->struct_sem); for (pt = dev->magiclist[hash].head; pt; pt = pt->next) { @@ -87,15 +87,15 @@ static drm_file_t *DRM(find_file)(drm_device_t *dev, drm_magic_t magic) * associated the magic number hash key in drm_device::magiclist, while holding * the drm_device::struct_sem lock. */ -int DRM(add_magic)(drm_device_t *dev, drm_file_t *priv, drm_magic_t magic) +int drm_add_magic(drm_device_t *dev, drm_file_t *priv, drm_magic_t magic) { int hash; drm_magic_entry_t *entry; DRM_DEBUG("%d\n", magic); - hash = DRM(hash_magic)(magic); - entry = DRM(alloc)(sizeof(*entry), DRM_MEM_MAGIC); + hash = drm_hash_magic(magic); + entry = drm_alloc(sizeof(*entry), DRM_MEM_MAGIC); if (!entry) return -ENOMEM; memset(entry, 0, sizeof(*entry)); entry->magic = magic; @@ -124,7 +124,7 @@ int DRM(add_magic)(drm_device_t *dev, drm_file_t *priv, drm_magic_t magic) * Searches and unlinks the entry in drm_device::magiclist with the magic * number hash key, while holding the drm_device::struct_sem lock. */ -int DRM(remove_magic)(drm_device_t *dev, drm_magic_t magic) +int drm_remove_magic(drm_device_t *dev, drm_magic_t magic) { drm_magic_entry_t *prev = NULL; drm_magic_entry_t *pt; @@ -132,7 +132,7 @@ int DRM(remove_magic)(drm_device_t *dev, drm_magic_t magic) DRM_DEBUG("%d\n", magic); - hash = DRM(hash_magic)(magic); + hash = drm_hash_magic(magic); down(&dev->struct_sem); for (pt = dev->magiclist[hash].head; pt; prev = pt, pt = pt->next) { @@ -152,7 +152,7 @@ int DRM(remove_magic)(drm_device_t *dev, drm_magic_t magic) } up(&dev->struct_sem); - DRM(free)(pt, sizeof(*pt), DRM_MEM_MAGIC); + drm_free(pt, sizeof(*pt), DRM_MEM_MAGIC); return -EINVAL; } @@ -170,7 +170,7 @@ int DRM(remove_magic)(drm_device_t *dev, drm_magic_t magic) * searches an unique non-zero magic number and add it associating it with \p * filp. */ -int DRM(getmagic)(struct inode *inode, struct file *filp, +int drm_getmagic(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) { static drm_magic_t sequence = 0; @@ -188,9 +188,9 @@ int DRM(getmagic)(struct inode *inode, struct file *filp, if (!sequence) ++sequence; /* reserve 0 */ auth.magic = sequence++; spin_unlock(&lock); - } while (DRM(find_file)(dev, auth.magic)); + } while (drm_find_file(dev, auth.magic)); priv->magic = auth.magic; - DRM(add_magic)(dev, priv, auth.magic); + drm_add_magic(dev, priv, auth.magic); } DRM_DEBUG("%u\n", auth.magic); @@ -210,7 +210,7 @@ int DRM(getmagic)(struct inode *inode, struct file *filp, * * Checks if \p filp is associated with the magic number passed in \arg. */ -int DRM(authmagic)(struct inode *inode, struct file *filp, +int drm_authmagic(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) { drm_file_t *priv = filp->private_data; @@ -221,9 +221,9 @@ int DRM(authmagic)(struct inode *inode, struct file *filp, if (copy_from_user(&auth, (drm_auth_t __user *)arg, sizeof(auth))) return -EFAULT; DRM_DEBUG("%u\n", auth.magic); - if ((file = DRM(find_file)(dev, auth.magic))) { + if ((file = drm_find_file(dev, auth.magic))) { file->authenticated = 1; - DRM(remove_magic)(dev, auth.magic); + drm_remove_magic(dev, auth.magic); return 0; } return -EINVAL; -- cgit v1.2.3