Lines Matching defs:kobj

34 static umode_t __first_visible(const struct attribute_group *grp, struct kobject *kobj)
37 return grp->is_visible(kobj, grp->attrs[0], 0);
40 return grp->is_bin_visible(kobj, grp->bin_attrs[0], 0);
45 static int create_files(struct kernfs_node *parent, struct kobject *kobj,
65 mode = grp->is_visible(kobj, *attr, i);
95 mode = grp->is_bin_visible(kobj, *bin_attr, i);
120 static int internal_create_group(struct kobject *kobj, int update,
128 if (WARN_ON(!kobj || (!update && !kobj->sd)))
132 if (unlikely(update && !kobj->sd))
137 kobj->name, grp->name ?: "");
141 kobject_get_ownership(kobj, &uid, &gid);
143 umode_t mode = __first_visible(grp, kobj);
151 kn = kernfs_find_and_get(kobj->sd, grp->name);
154 kobj->name, grp->name);
158 sysfs_remove_group(kobj, grp);
167 kn = kernfs_create_dir_ns(kobj->sd, grp->name, mode,
168 uid, gid, kobj, NULL);
171 sysfs_warn_dup(kobj->sd, grp->name);
176 kn = kobj->sd;
180 error = create_files(kn, kobj, uid, gid, grp, update);
195 * @kobj: The kobject to create the group on
203 int sysfs_create_group(struct kobject *kobj,
206 return internal_create_group(kobj, 0, grp);
210 static int internal_create_groups(struct kobject *kobj, int update,
220 error = internal_create_group(kobj, update, groups[i]);
223 sysfs_remove_group(kobj, groups[i]);
232 * @kobj: The kobject to create the group on
243 int sysfs_create_groups(struct kobject *kobj,
246 return internal_create_groups(kobj, 0, groups);
252 * @kobj: The kobject to update the group on
261 int sysfs_update_groups(struct kobject *kobj,
264 return internal_create_groups(kobj, 1, groups);
270 * @kobj: The kobject to update the group on
279 * kobj's directory in sysfs) is not allowed.
286 int sysfs_update_group(struct kobject *kobj,
289 return internal_create_group(kobj, 1, grp);
295 * @kobj: kobject to remove the group from
301 void sysfs_remove_group(struct kobject *kobj,
304 struct kernfs_node *parent = kobj->sd;
311 grp->name, kobject_name(kobj));
330 * @kobj: The kobject for the groups to be removed from
335 void sysfs_remove_groups(struct kobject *kobj,
343 sysfs_remove_group(kobj, groups[i]);
349 * @kobj: The kobject containing the group.
356 int sysfs_merge_group(struct kobject *kobj,
366 parent = kernfs_find_and_get(kobj->sd, grp->name);
370 kobject_get_ownership(kobj, &uid, &gid);
387 * @kobj: The kobject containing the group.
390 void sysfs_unmerge_group(struct kobject *kobj,
396 parent = kernfs_find_and_get(kobj->sd, grp->name);
407 * @kobj: The kobject containing the group.
412 int sysfs_add_link_to_group(struct kobject *kobj, const char *group_name,
418 parent = kernfs_find_and_get(kobj->sd, group_name);
431 * @kobj: The kobject containing the group.
435 void sysfs_remove_link_from_group(struct kobject *kobj, const char *group_name,
440 parent = kernfs_find_and_get(kobj->sd, group_name);
451 * @kobj: The kobject containing the group.
457 int compat_only_sysfs_link_entry_to_kobj(struct kobject *kobj,
488 link = kernfs_create_link(kobj->sd, symlink_name, entry);
490 sysfs_warn_dup(kobj->sd, symlink_name);
540 * @kobj: The kobject containing the group.
547 int sysfs_group_change_owner(struct kobject *kobj,
559 if (!kobj->state_in_sysfs)
563 grp_kn = kernfs_find_and_get(kobj->sd, grp->name);
565 kernfs_get(kobj->sd);
566 grp_kn = kobj->sd;
583 * @kobj: The kobject containing the groups.
590 int sysfs_groups_change_owner(struct kobject *kobj,
596 if (!kobj->state_in_sysfs)
603 error = sysfs_group_change_owner(kobj, groups[i], kuid, kgid);