• Home
  • Raw
  • Download

Lines Matching refs:kn

26 static const struct sysfs_ops *sysfs_file_ops(struct kernfs_node *kn)  in sysfs_file_ops()  argument
28 struct kobject *kobj = kn->parent->priv; in sysfs_file_ops()
30 if (kn->flags & KERNFS_LOCKDEP) in sysfs_file_ops()
31 lockdep_assert_held(kn); in sysfs_file_ops()
43 struct kobject *kobj = of->kn->parent->priv; in sysfs_kf_seq_show()
44 const struct sysfs_ops *ops = sysfs_file_ops(of->kn); in sysfs_kf_seq_show()
61 count = ops->show(kobj, of->kn->priv, buf); in sysfs_kf_seq_show()
83 struct bin_attribute *battr = of->kn->priv; in sysfs_kf_bin_read()
84 struct kobject *kobj = of->kn->parent->priv; in sysfs_kf_bin_read()
107 const struct sysfs_ops *ops = sysfs_file_ops(of->kn); in sysfs_kf_read()
108 struct kobject *kobj = of->kn->parent->priv; in sysfs_kf_read()
117 len = ops->show(kobj, of->kn->priv, buf); in sysfs_kf_read()
133 const struct sysfs_ops *ops = sysfs_file_ops(of->kn); in sysfs_kf_write()
134 struct kobject *kobj = of->kn->parent->priv; in sysfs_kf_write()
139 return ops->store(kobj, of->kn->priv, buf, count); in sysfs_kf_write()
146 struct bin_attribute *battr = of->kn->priv; in sysfs_kf_bin_write()
147 struct kobject *kobj = of->kn->parent->priv; in sysfs_kf_bin_write()
167 struct bin_attribute *battr = of->kn->priv; in sysfs_kf_bin_mmap()
168 struct kobject *kobj = of->kn->parent->priv; in sysfs_kf_bin_mmap()
175 struct kernfs_node *kn = kobj->sd, *tmp; in sysfs_notify() local
177 if (kn && dir) in sysfs_notify()
178 kn = kernfs_find_and_get(kn, dir); in sysfs_notify()
180 kernfs_get(kn); in sysfs_notify()
182 if (kn && attr) { in sysfs_notify()
183 tmp = kernfs_find_and_get(kn, attr); in sysfs_notify()
184 kernfs_put(kn); in sysfs_notify()
185 kn = tmp; in sysfs_notify()
188 if (kn) { in sysfs_notify()
189 kernfs_notify(kn); in sysfs_notify()
190 kernfs_put(kn); in sysfs_notify()
252 struct kernfs_node *kn; in sysfs_add_file_mode_ns() local
306 kn = __kernfs_create_file(parent, attr->name, mode & 0777, uid, gid, in sysfs_add_file_mode_ns()
308 if (IS_ERR(kn)) { in sysfs_add_file_mode_ns()
309 if (PTR_ERR(kn) == -EEXIST) in sysfs_add_file_mode_ns()
311 return PTR_ERR(kn); in sysfs_add_file_mode_ns()
395 struct kernfs_node *kn; in sysfs_chmod_file() local
399 kn = kernfs_find_and_get(kobj->sd, attr->name); in sysfs_chmod_file()
400 if (!kn) in sysfs_chmod_file()
403 newattrs.ia_mode = (mode & S_IALLUGO) | (kn->mode & ~S_IALLUGO); in sysfs_chmod_file()
406 rc = kernfs_setattr(kn, &newattrs); in sysfs_chmod_file()
408 kernfs_put(kn); in sysfs_chmod_file()
426 struct kernfs_node *kn; in sysfs_break_active_protection() local
429 kn = kernfs_find_and_get(kobj->sd, attr->name); in sysfs_break_active_protection()
430 if (kn) in sysfs_break_active_protection()
431 kernfs_break_active_protection(kn); in sysfs_break_active_protection()
432 return kn; in sysfs_break_active_protection()
447 void sysfs_unbreak_active_protection(struct kernfs_node *kn) in sysfs_unbreak_active_protection() argument
449 struct kobject *kobj = kn->parent->priv; in sysfs_unbreak_active_protection()
451 kernfs_unbreak_active_protection(kn); in sysfs_unbreak_active_protection()
452 kernfs_put(kn); in sysfs_unbreak_active_protection()
484 struct kernfs_node *kn; in sysfs_remove_file_self() local
487 kn = kernfs_find_and_get(parent, attr->name); in sysfs_remove_file_self()
488 if (WARN_ON_ONCE(!kn)) in sysfs_remove_file_self()
491 ret = kernfs_remove_self(kn); in sysfs_remove_file_self()
493 kernfs_put(kn); in sysfs_remove_file_self()
564 static int internal_change_owner(struct kernfs_node *kn, kuid_t kuid, in internal_change_owner() argument
572 return kernfs_setattr(kn, &newattrs); in internal_change_owner()
592 struct kernfs_node *kn = NULL; in sysfs_link_change_owner() local
599 kn = kernfs_find_and_get_ns(kobj->sd, name, targ->sd->ns); in sysfs_link_change_owner()
600 if (!kn) in sysfs_link_change_owner()
604 if (kernfs_type(kn) != KERNFS_LINK) in sysfs_link_change_owner()
606 if (kn->symlink.target_kn->priv != targ) in sysfs_link_change_owner()
609 error = internal_change_owner(kn, kuid, kgid); in sysfs_link_change_owner()
612 kernfs_put(kn); in sysfs_link_change_owner()
631 struct kernfs_node *kn; in sysfs_file_change_owner() local
640 kn = kernfs_find_and_get(kobj->sd, name); in sysfs_file_change_owner()
641 if (!kn) in sysfs_file_change_owner()
644 error = internal_change_owner(kn, kuid, kgid); in sysfs_file_change_owner()
646 kernfs_put(kn); in sysfs_file_change_owner()