drm_lease.c (53b3b6bbfde6aae8d1ededc86ad4e0e1e00eb5f8) drm_lease.c (918d89bb1a639adf28a61d0a35c24a2b256ca635)
1/*
2 * Copyright © 2017 Keith Packard <keithp@keithp.com>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 2 of the License, or
7 * (at your option) any later version.
8 *

--- 181 unchanged lines hidden (view full) ---

190 * drm_lease_create - create a new drm_master with leased objects (idr_mutex not held)
191 * @lessor: lease holder (or owner) of objects
192 * @leases: objects to lease to the new drm_master
193 *
194 * Uses drm_master_create to allocate a new drm_master, then checks to
195 * make sure all of the desired objects can be leased, atomically
196 * leasing them to the new drmmaster.
197 *
1/*
2 * Copyright © 2017 Keith Packard <keithp@keithp.com>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 2 of the License, or
7 * (at your option) any later version.
8 *

--- 181 unchanged lines hidden (view full) ---

190 * drm_lease_create - create a new drm_master with leased objects (idr_mutex not held)
191 * @lessor: lease holder (or owner) of objects
192 * @leases: objects to lease to the new drm_master
193 *
194 * Uses drm_master_create to allocate a new drm_master, then checks to
195 * make sure all of the desired objects can be leased, atomically
196 * leasing them to the new drmmaster.
197 *
198 * ERR_PTR(-EACCESS) some other master holds the title to any object
198 * ERR_PTR(-EACCES) some other master holds the title to any object
199 * ERR_PTR(-ENOENT) some object is not a valid DRM object for this device
200 * ERR_PTR(-EBUSY) some other lessee holds title to this object
201 * ERR_PTR(-EEXIST) same object specified more than once in the provided list
202 * ERR_PTR(-ENOMEM) allocation failed
203 */
204static struct drm_master *drm_lease_create(struct drm_master *lessor, struct idr *leases)
205{
206 struct drm_device *dev = lessor->dev;

--- 354 unchanged lines hidden (view full) ---

561
562 lessee_priv = lessee_file->private_data;
563 /* Change the file to a master one */
564 drm_master_put(&lessee_priv->master);
565 lessee_priv->master = lessee;
566 lessee_priv->is_master = 1;
567 lessee_priv->authenticated = 1;
568
199 * ERR_PTR(-ENOENT) some object is not a valid DRM object for this device
200 * ERR_PTR(-EBUSY) some other lessee holds title to this object
201 * ERR_PTR(-EEXIST) same object specified more than once in the provided list
202 * ERR_PTR(-ENOMEM) allocation failed
203 */
204static struct drm_master *drm_lease_create(struct drm_master *lessor, struct idr *leases)
205{
206 struct drm_device *dev = lessor->dev;

--- 354 unchanged lines hidden (view full) ---

561
562 lessee_priv = lessee_file->private_data;
563 /* Change the file to a master one */
564 drm_master_put(&lessee_priv->master);
565 lessee_priv->master = lessee;
566 lessee_priv->is_master = 1;
567 lessee_priv->authenticated = 1;
568
569 /* Hook up the fd */
570 fd_install(fd, lessee_file);
571
569 /* Pass fd back to userspace */
570 DRM_DEBUG_LEASE("Returning fd %d id %d\n", fd, lessee->lessee_id);
571 cl->fd = fd;
572 cl->lessee_id = lessee->lessee_id;
573
572 /* Pass fd back to userspace */
573 DRM_DEBUG_LEASE("Returning fd %d id %d\n", fd, lessee->lessee_id);
574 cl->fd = fd;
575 cl->lessee_id = lessee->lessee_id;
576
574 /* Hook up the fd */
575 fd_install(fd, lessee_file);
576
577 DRM_DEBUG_LEASE("drm_mode_create_lease_ioctl succeeded\n");
578 return 0;
579
580out_lessee:
581 drm_master_put(&lessee);
582
583out_leases:
584 put_unused_fd(fd);

--- 169 unchanged lines hidden ---
577 DRM_DEBUG_LEASE("drm_mode_create_lease_ioctl succeeded\n");
578 return 0;
579
580out_lessee:
581 drm_master_put(&lessee);
582
583out_leases:
584 put_unused_fd(fd);

--- 169 unchanged lines hidden ---