done a little nicer.
Advice from deraadt@.
#include <dev/pci/vga_pcivar.h>
#include <machine/param.h>
#include <machine/bus.h>
-#include <crypto/idgen.h>
#include "drm.h"
#include "drm_linux_list.h"
/* Authentication */
drm_file_list_t files;
- struct idgen32_ctx magicid;
+ drm_magic_t magicid;
SPLAY_HEAD(drm_magic_tree, drm_magic_entry) magiclist;
/* Linked list of mappable regions. Protected by dev_lock */
auth->magic = file_priv->magic;
} else {
DRM_LOCK();
- do {
- auth->magic = idgen32(&dev->magicid);
- } while (drm_find_file(dev, auth->magic));
-
- file_priv->magic = auth->magic;
+ file_priv->magic = auth->magic = dev->magicid++;
drm_add_magic(dev, file_priv, auth->magic);
DRM_UNLOCK();
}
for ( i = 0 ; i < DRM_ARRAY_SIZE(dev->counts) ; i++ )
atomic_set( &dev->counts[i], 0 );
- idgen32_init(&dev->magicid);
+ dev->magicid = 1;
SPLAY_INIT(&dev->magiclist);
dev->lock.lock_queue = 0;