mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 10:41:38 -04:00
driver core: set up ownership of class devices in sysfs
Plumb in get_ownership() callback for devices belonging to a class so that they can be created with uid/gid different from global root. This will allow network devices in a container to belong to container's root and not global root. Signed-off-by: Dmitry Torokhov <[email protected]> Reviewed-by: Tyler Hicks <[email protected]> Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
parent
d028b6f703
commit
9944e894c1
2 changed files with 14 additions and 0 deletions
|
|
@ -866,10 +866,19 @@ static const void *device_namespace(struct kobject *kobj)
|
|||
return ns;
|
||||
}
|
||||
|
||||
static void device_get_ownership(struct kobject *kobj, kuid_t *uid, kgid_t *gid)
|
||||
{
|
||||
struct device *dev = kobj_to_dev(kobj);
|
||||
|
||||
if (dev->class && dev->class->get_ownership)
|
||||
dev->class->get_ownership(dev, uid, gid);
|
||||
}
|
||||
|
||||
static struct kobj_type device_ktype = {
|
||||
.release = device_release,
|
||||
.sysfs_ops = &dev_sysfs_ops,
|
||||
.namespace = device_namespace,
|
||||
.get_ownership = device_get_ownership,
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue