1
0
Fork 0

kobject: kset_create_and_add() - fetch ownership info from parent

This change implements get_ownership() for ksets created with
kset_create_and_add() call by fetching ownership data from parent kobject.
This is done mostly for benefit of "queues" attribute of net devices so
that corresponding directory belongs to container's root instead of global
root for network devices in a container.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Reviewed-by: Tyler Hicks <tyhicks@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
hifive-unleashed-5.1
Dmitry Torokhov 2018-07-20 21:56:49 +00:00 committed by David S. Miller
parent 5f81880d52
commit d028b6f703
1 changed files with 8 additions and 1 deletions

View File

@ -887,9 +887,16 @@ static void kset_release(struct kobject *kobj)
kfree(kset);
}
void kset_get_ownership(struct kobject *kobj, kuid_t *uid, kgid_t *gid)
{
if (kobj->parent)
kobject_get_ownership(kobj->parent, uid, gid);
}
static struct kobj_type kset_ktype = {
.sysfs_ops = &kobj_sysfs_ops,
.release = kset_release,
.release = kset_release,
.get_ownership = kset_get_ownership,
};
/**