Lines Matching refs:kobj
34 struct kobject *kobj = sysfs_file_kobj(kn); in sysfs_file_ops() local
38 return kobj->ktype ? kobj->ktype->sysfs_ops : NULL; in sysfs_file_ops()
49 struct kobject *kobj = sysfs_file_kobj(of->kn); in sysfs_kf_seq_show() local
65 count = ops->show(kobj, of->kn->priv, buf); in sysfs_kf_seq_show()
87 struct kobject *kobj = sysfs_file_kobj(of->kn); in sysfs_kf_bin_read() local
104 return battr->read_new(of->file, kobj, battr, buf, pos, count); in sysfs_kf_bin_read()
106 return battr->read(of->file, kobj, battr, buf, pos, count); in sysfs_kf_bin_read()
114 struct kobject *kobj = sysfs_file_kobj(of->kn); in sysfs_kf_read() local
123 len = ops->show(kobj, of->kn->priv, buf); in sysfs_kf_read()
140 struct kobject *kobj = sysfs_file_kobj(of->kn); in sysfs_kf_write() local
145 return ops->store(kobj, of->kn->priv, buf, count); in sysfs_kf_write()
153 struct kobject *kobj = sysfs_file_kobj(of->kn); in sysfs_kf_bin_write() local
168 return battr->write_new(of->file, kobj, battr, buf, pos, count); in sysfs_kf_bin_write()
170 return battr->write(of->file, kobj, battr, buf, pos, count); in sysfs_kf_bin_write()
177 struct kobject *kobj = sysfs_file_kobj(of->kn); in sysfs_kf_bin_mmap() local
179 return battr->mmap(of->file, kobj, battr, vma); in sysfs_kf_bin_mmap()
186 struct kobject *kobj = sysfs_file_kobj(of->kn); in sysfs_kf_bin_llseek() local
189 return battr->llseek(of->file, kobj, battr, offset, whence); in sysfs_kf_bin_llseek()
204 void sysfs_notify(struct kobject *kobj, const char *dir, const char *attr) in sysfs_notify() argument
206 struct kernfs_node *kn = kobj->sd, *tmp; in sysfs_notify()
283 struct kobject *kobj = parent->priv; in sysfs_add_file_mode_ns() local
284 const struct sysfs_ops *sysfs_ops = kobj->ktype->sysfs_ops; in sysfs_add_file_mode_ns()
292 kobject_name(kobj))) in sysfs_add_file_mode_ns()
376 int sysfs_create_file_ns(struct kobject *kobj, const struct attribute *attr, in sysfs_create_file_ns() argument
382 if (WARN_ON(!kobj || !kobj->sd || !attr)) in sysfs_create_file_ns()
385 kobject_get_ownership(kobj, &uid, &gid); in sysfs_create_file_ns()
386 return sysfs_add_file_mode_ns(kobj->sd, attr, attr->mode, uid, gid, ns); in sysfs_create_file_ns()
390 int sysfs_create_files(struct kobject *kobj, const struct attribute * const *ptr) in sysfs_create_files() argument
396 err = sysfs_create_file(kobj, ptr[i]); in sysfs_create_files()
399 sysfs_remove_file(kobj, ptr[i]); in sysfs_create_files()
410 int sysfs_add_file_to_group(struct kobject *kobj, in sysfs_add_file_to_group() argument
419 parent = kernfs_find_and_get(kobj->sd, group); in sysfs_add_file_to_group()
421 parent = kobj->sd; in sysfs_add_file_to_group()
428 kobject_get_ownership(kobj, &uid, &gid); in sysfs_add_file_to_group()
444 int sysfs_chmod_file(struct kobject *kobj, const struct attribute *attr, in sysfs_chmod_file() argument
451 kn = kernfs_find_and_get(kobj->sd, attr->name); in sysfs_chmod_file()
475 struct kernfs_node *sysfs_break_active_protection(struct kobject *kobj, in sysfs_break_active_protection() argument
480 kobject_get(kobj); in sysfs_break_active_protection()
481 kn = kernfs_find_and_get(kobj->sd, attr->name); in sysfs_break_active_protection()
485 kobject_put(kobj); in sysfs_break_active_protection()
503 struct kobject *kobj = sysfs_file_kobj(kn); in sysfs_unbreak_active_protection() local
507 kobject_put(kobj); in sysfs_unbreak_active_protection()
519 void sysfs_remove_file_ns(struct kobject *kobj, const struct attribute *attr, in sysfs_remove_file_ns() argument
522 struct kernfs_node *parent = kobj->sd; in sysfs_remove_file_ns()
535 bool sysfs_remove_file_self(struct kobject *kobj, const struct attribute *attr) in sysfs_remove_file_self() argument
537 struct kernfs_node *parent = kobj->sd; in sysfs_remove_file_self()
552 void sysfs_remove_files(struct kobject *kobj, const struct attribute * const *ptr) in sysfs_remove_files() argument
557 sysfs_remove_file(kobj, ptr[i]); in sysfs_remove_files()
567 void sysfs_remove_file_from_group(struct kobject *kobj, in sysfs_remove_file_from_group() argument
573 parent = kernfs_find_and_get(kobj->sd, group); in sysfs_remove_file_from_group()
575 parent = kobj->sd; in sysfs_remove_file_from_group()
591 int sysfs_create_bin_file(struct kobject *kobj, in sysfs_create_bin_file() argument
597 if (WARN_ON(!kobj || !kobj->sd || !attr)) in sysfs_create_bin_file()
600 kobject_get_ownership(kobj, &uid, &gid); in sysfs_create_bin_file()
601 return sysfs_add_bin_file_mode_ns(kobj->sd, attr, attr->attr.mode, in sysfs_create_bin_file()
611 void sysfs_remove_bin_file(struct kobject *kobj, in sysfs_remove_bin_file() argument
614 kernfs_remove_by_name(kobj->sd, attr->attr.name); in sysfs_remove_bin_file()
643 int sysfs_link_change_owner(struct kobject *kobj, struct kobject *targ, in sysfs_link_change_owner() argument
649 if (!name || !kobj->state_in_sysfs || !targ->state_in_sysfs) in sysfs_link_change_owner()
653 kn = kernfs_find_and_get_ns(kobj->sd, name, targ->sd->ns); in sysfs_link_change_owner()
682 int sysfs_file_change_owner(struct kobject *kobj, const char *name, kuid_t kuid, in sysfs_file_change_owner() argument
691 if (!kobj->state_in_sysfs) in sysfs_file_change_owner()
694 kn = kernfs_find_and_get(kobj->sd, name); in sysfs_file_change_owner()
724 int sysfs_change_owner(struct kobject *kobj, kuid_t kuid, kgid_t kgid) in sysfs_change_owner() argument
729 if (!kobj->state_in_sysfs) in sysfs_change_owner()
733 error = internal_change_owner(kobj->sd, kuid, kgid); in sysfs_change_owner()
737 ktype = get_ktype(kobj); in sysfs_change_owner()
743 error = sysfs_groups_change_owner(kobj, ktype->default_groups, in sysfs_change_owner()
825 ssize_t sysfs_bin_attr_simple_read(struct file *file, struct kobject *kobj, in sysfs_bin_attr_simple_read() argument