Lines Matching refs:kobject
3 * kobject.c - library routines for handling generic kernel objects
9 * Please see the file Documentation/core-api/kobject.rst for critical information
10 * about using the kobject interface.
15 #include <linux/kobject.h>
24 * @kobj: kobject in question
30 const void *kobject_namespace(const struct kobject *kobj)
42 * @kobj: kobject in question
47 * representation of given kobject. Normally used to adjust ownership of
50 void kobject_get_ownership(const struct kobject *kobj, kuid_t *uid, kgid_t *gid)
67 static int create_dir(struct kobject *kobj)
106 static int get_kobj_path_length(const struct kobject *kobj)
109 const struct kobject *parent = kobj;
124 static int fill_kobj_path(const struct kobject *kobj, char *path, int length)
126 const struct kobject *parent;
147 * @kobj: kobject in question, with which to build the path
152 char *kobject_get_path(const struct kobject *kobj, gfp_t gfp_mask)
173 /* add the kobject to its kset's list */
174 static void kobj_kset_join(struct kobject *kobj)
185 /* remove the kobject from its kset's list */
186 static void kobj_kset_leave(struct kobject *kobj)
197 static void kobject_init_internal(struct kobject *kobj)
210 static int kobject_add_internal(struct kobject *kobj)
213 struct kobject *parent;
220 "kobject: (%p): attempted to be registered with empty name!\n",
261 * kobject_set_name_vargs() - Set the name of a kobject.
262 * @kobj: struct kobject to set the name of
266 int kobject_set_name_vargs(struct kobject *kobj, const char *fmt,
300 * kobject_set_name() - Set the name of a kobject.
301 * @kobj: struct kobject to set the name of
304 * This sets the name of the kobject. If you have already added the
305 * kobject to the system, you must call kobject_rename() in order to
306 * change the name of the kobject.
308 int kobject_set_name(struct kobject *kobj, const char *fmt, ...)
322 * kobject_init() - Initialize a kobject structure.
323 * @kobj: pointer to the kobject to initialize
324 * @ktype: pointer to the ktype for this kobject.
326 * This function will properly initialize a kobject such that it can then
329 * After this function is called, the kobject MUST be cleaned up by a call
333 void kobject_init(struct kobject *kobj, const struct kobj_type *ktype)
338 err_str = "invalid kobject pointer!";
347 pr_err("kobject (%p): tried to init an initialized object, something is seriously wrong.\n",
357 pr_err("kobject (%p): %s\n", kobj, err_str);
362 static __printf(3, 0) int kobject_add_varg(struct kobject *kobj,
363 struct kobject *parent,
378 * kobject_add() - The main kobject add function.
379 * @kobj: the kobject to add
380 * @parent: pointer to the parent of the kobject.
381 * @fmt: format to name the kobject with.
383 * The kobject name is set and added to the kobject hierarchy in this
388 * kobject associated with the kset assigned to this kobject. If no kset
389 * is assigned to the kobject, then the kobject will be located in the
395 * userspace is properly notified of this kobject's creation.
399 * object. Under no instance should the kobject that is passed
410 int kobject_add(struct kobject *kobj, struct kobject *parent,
420 pr_err("kobject '%s' (%p): tried to add an uninitialized object, something is seriously wrong.\n",
434 * kobject_init_and_add() - Initialize a kobject structure and add it to
435 * the kobject hierarchy.
436 * @kobj: pointer to the kobject to initialize
437 * @ktype: pointer to the ktype for this kobject.
438 * @parent: pointer to the parent of this kobject.
439 * @fmt: the name of the kobject.
445 * same type of error handling after a call to kobject_add() and kobject
448 int kobject_init_and_add(struct kobject *kobj, const struct kobj_type *ktype,
449 struct kobject *parent, const char *fmt, ...)
471 * on the same kobject and to ensure that new_name is valid and
474 int kobject_rename(struct kobject *kobj, const char *new_name)
514 /* Install the new kobject name */
538 int kobject_move(struct kobject *kobj, struct kobject *new_parent)
541 struct kobject *old_parent;
586 static void __kobject_del(struct kobject *kobj)
613 * kobject_del() - Unlink kobject from hierarchy.
619 void kobject_del(struct kobject *kobj)
621 struct kobject *parent;
636 struct kobject *kobject_get(struct kobject *kobj)
641 "kobject: '%s' (%p): is not initialized, yet kobject_get() is being called.\n",
649 struct kobject * __must_check kobject_get_unless_zero(struct kobject *kobj)
660 * kobject_cleanup - free kobject resources.
663 static void kobject_cleanup(struct kobject *kobj)
665 struct kobject *parent = kobj->parent;
673 pr_debug("'%s' (%p): does not have a release() function, it is broken and must be fixed. See Documentation/core-api/kobject.rst.\n",
705 struct kobject, release));
711 struct kobject *kobj = container_of(kref, struct kobject, kref);
730 void kobject_put(struct kobject *kobj)
735 "kobject: '%s' (%p): is not initialized, yet kobject_put() is being called.\n",
742 static void dynamic_kobj_release(struct kobject *kobj)
754 * kobject_create() - Create a struct kobject dynamically.
756 * This function creates a kobject structure dynamically and sets it up
757 * to be a "dynamic" kobject with a default release function set up.
759 * If the kobject was not able to be created, NULL will be returned.
760 * The kobject structure returned from here must be cleaned up with a
764 static struct kobject *kobject_create(void)
766 struct kobject *kobj;
777 * kobject_create_and_add() - Create a struct kobject dynamically and
779 * @name: the name for the kobject
780 * @parent: the parent kobject of this kobject, if any.
782 * This function creates a kobject structure dynamically and registers it
787 * If the kobject was not able to be created, NULL will be returned.
789 struct kobject *kobject_create_and_add(const char *name, struct kobject *parent)
791 struct kobject *kobj;
819 /* default kobject attribute operations */
820 static ssize_t kobj_attr_show(struct kobject *kobj, struct attribute *attr,
832 static ssize_t kobj_attr_store(struct kobject *kobj, struct attribute *attr,
901 * looking for a matching kobject. If matching object is found
904 struct kobject *kset_find_obj(struct kset *kset, const char *name)
906 struct kobject *k;
907 struct kobject *ret = NULL;
923 static void kset_release(struct kobject *kobj)
931 static void kset_get_ownership(const struct kobject *kobj, kuid_t *uid, kgid_t *gid)
948 * @parent_kobj: the parent kobject of this kset, if any.
960 struct kobject *parent_kobj)
977 * The kobject of this kset will have a type of kset_ktype and belong to
992 * @parent_kobj: the parent kobject of this kset, if any.
1003 struct kobject *parent_kobj)
1059 const struct kobj_ns_type_operations *kobj_child_ns_ops(const struct kobject *parent)
1069 const struct kobj_ns_type_operations *kobj_ns_ops(const struct kobject *kobj)