idgen32 wasn't really right here. Change back to how it was, but
authoroga <oga@openbsd.org>
Wed, 13 Aug 2008 20:22:55 +0000 (20:22 +0000)
committeroga <oga@openbsd.org>
Wed, 13 Aug 2008 20:22:55 +0000 (20:22 +0000)
done a little nicer.

Advice from deraadt@.

sys/dev/pci/drm/drmP.h
sys/dev/pci/drm/drm_auth.c
sys/dev/pci/drm/drm_drv.c

index 5529ce2..1649577 100644 (file)
@@ -66,7 +66,6 @@
 #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"
@@ -635,7 +634,7 @@ struct drm_device {
 
                                /* 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 */
index 4b1e20c..6425875 100644 (file)
@@ -124,11 +124,7 @@ drm_getmagic(struct drm_device *dev, void *data, struct drm_file *file_priv)
                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();
        }
index f5b201e..04331bb 100644 (file)
@@ -253,7 +253,7 @@ drm_firstopen(struct drm_device *dev)
        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;