Clean up the handling of device minors
Submitted by: Ed MFC after: 2 weeks
This commit is contained in:
parent
b149016ae8
commit
f98d8dac77
@ -416,7 +416,6 @@ struct drm_file {
|
||||
struct drm_device *dev;
|
||||
int authenticated;
|
||||
int master;
|
||||
int minor;
|
||||
pid_t pid;
|
||||
uid_t uid;
|
||||
drm_magic_t magic;
|
||||
|
@ -53,9 +53,6 @@ static void drm_unload(struct drm_device *dev);
|
||||
static drm_pci_id_list_t *drm_find_description(int vendor, int device,
|
||||
drm_pci_id_list_t *idlist);
|
||||
|
||||
#define DRIVER_SOFTC(unit) \
|
||||
((struct drm_device *)devclass_get_softc(drm_devclass, unit))
|
||||
|
||||
MODULE_VERSION(drm, 1);
|
||||
MODULE_DEPEND(drm, agp, 1, 1, 1);
|
||||
MODULE_DEPEND(drm, pci, 1, 1, 1);
|
||||
@ -210,11 +207,12 @@ int drm_attach(device_t kdev, drm_pci_id_list_t *idlist)
|
||||
dev->device = kdev;
|
||||
#endif
|
||||
dev->devnode = make_dev(&drm_cdevsw,
|
||||
unit,
|
||||
0,
|
||||
DRM_DEV_UID,
|
||||
DRM_DEV_GID,
|
||||
DRM_DEV_MODE,
|
||||
"dri/card%d", unit);
|
||||
dev->devnode->si_drv1 = dev;
|
||||
|
||||
#if __FreeBSD_version >= 700053
|
||||
dev->pci_domain = pci_get_domain(dev->device);
|
||||
@ -606,7 +604,7 @@ int drm_open(struct cdev *kdev, int flags, int fmt, DRM_STRUCTPROC *p)
|
||||
struct drm_device *dev = NULL;
|
||||
int retcode = 0;
|
||||
|
||||
dev = DRIVER_SOFTC(dev2unit(kdev));
|
||||
dev = kdev->si_drv1;
|
||||
|
||||
DRM_DEBUG("open_count = %d\n", dev->open_count);
|
||||
|
||||
|
@ -44,14 +44,13 @@ int drm_open_helper(struct cdev *kdev, int flags, int fmt, DRM_STRUCTPROC *p,
|
||||
struct drm_device *dev)
|
||||
{
|
||||
struct drm_file *priv;
|
||||
int m = dev2unit(kdev);
|
||||
int retcode;
|
||||
|
||||
if (flags & O_EXCL)
|
||||
return EBUSY; /* No exclusive opens */
|
||||
dev->flags = flags;
|
||||
|
||||
DRM_DEBUG("pid = %d, minor = %d\n", DRM_CURRENTPID, m);
|
||||
DRM_DEBUG("pid = %d, device = %s\n", DRM_CURRENTPID, devtoname(kdev));
|
||||
|
||||
priv = malloc(sizeof(*priv), DRM_MEM_FILES, M_NOWAIT | M_ZERO);
|
||||
if (priv == NULL) {
|
||||
@ -68,7 +67,6 @@ int drm_open_helper(struct cdev *kdev, int flags, int fmt, DRM_STRUCTPROC *p,
|
||||
priv->dev = dev;
|
||||
priv->uid = p->td_ucred->cr_svuid;
|
||||
priv->pid = p->td_proc->p_pid;
|
||||
priv->minor = m;
|
||||
priv->ioctl_count = 0;
|
||||
|
||||
/* for compatibility root is always authenticated */
|
||||
|
@ -298,12 +298,13 @@ static int drm_clients_info DRM_SYSCTL_HANDLER_ARGS
|
||||
|
||||
DRM_UNLOCK();
|
||||
|
||||
DRM_SYSCTL_PRINT("\na dev pid uid magic ioctls\n");
|
||||
DRM_SYSCTL_PRINT(
|
||||
"\na dev pid uid magic ioctls\n");
|
||||
for (i = 0; i < privcount; i++) {
|
||||
priv = &tempprivs[i];
|
||||
DRM_SYSCTL_PRINT("%c %3d %5d %5d %10u %10lu\n",
|
||||
DRM_SYSCTL_PRINT("%c %-12s %5d %5d %10u %10lu\n",
|
||||
priv->authenticated ? 'y' : 'n',
|
||||
priv->minor,
|
||||
devtoname(priv->dev->devnode),
|
||||
priv->pid,
|
||||
priv->uid,
|
||||
priv->magic,
|
||||
|
Loading…
x
Reference in New Issue
Block a user