Lines Matching defs:magic
47 * Generate a hash key from a magic.
49 * \param magic magic.
55 static int drm_hash_magic(drm_magic_t magic)
57 return magic & (DRM_HASH_SIZE - 1);
61 * Find the file with the given magic number.
64 * \param magic magic number.
67 * the one with matching magic number, while holding the drm_device::struct_mutex
70 static struct drm_file *drm_find_file(struct drm_master *master, drm_magic_t magic)
74 int hash = drm_hash_magic(magic);
79 if (pt->magic == magic) {
89 * Adds a magic number.
93 * \param magic magic number.
96 * associated the magic number hash key in drm_device::magiclist, while holding
100 drm_magic_t magic)
106 DRM_DEBUG("%d\n", magic);
108 hash = drm_hash_magic(magic);
113 entry->magic = magic;
131 * Remove a magic number.
134 * \param magic magic number.
136 * Searches and unlinks the entry in drm_device::magiclist with the magic
139 int drm_remove_magic(struct drm_master *master, drm_magic_t magic)
146 DRM_DEBUG("%d\n", magic);
147 hash = drm_hash_magic(magic);
151 if (pt->magic == magic) {
172 * Get a unique magic number (ioctl).
180 * If there is a magic number in drm_file::magic then use it, otherwise
181 * searches an unique non-zero magic number and add it associating it with \p
184 * struct drm_file::magic and struct drm_magic_entry::priv.
192 /* Find unique magic */
193 if (file->magic) {
194 auth->magic = file->magic;
198 auth->magic = old + 1;
199 if (!atomic_cmpset_int(&sequence, old, auth->magic))
201 } while (drm_find_file(file->master, auth->magic));
202 file->magic = auth->magic;
203 (void) drm_add_magic(file->master, file, auth->magic);
206 DRM_DEBUG("%u\n", auth->magic);
212 * Authenticate with a magic.
220 * Checks if \p file_priv is associated with the magic number passed in \arg.
222 * struct drm_file::magic and struct drm_magic_entry::priv.
230 DRM_DEBUG("%u\n", auth->magic);
231 if ((file_priv = drm_find_file(file->master, auth->magic))) {
233 (void) drm_remove_magic(file->master, auth->magic);