Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:lib\kobject.c Create Date:2022-07-28 06:16:11
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:kobject_rename() - Change the name of an object

Proto:int kobject_rename(struct kobject *kobj, const char *new_name)

Type:int

Parameter:

TypeParameterName
struct kobject *kobj
const char *new_name
492  error = 0
493  const char * devpath = NULL
494  dup_name = NULL
495  char * devpath_string = NULL
498  kobj = kobject_get() - Increment refcount for object.*@kobj: object.
499  If Not kobj Then Return -EINVAL
501  If Not parent Then
502  kobject_put() - Decrement refcount for object.*@kobj: object.* Decrement the refcount, and if 0, call kobject_cleanup().
503  Return -EINVAL
506  devpath = kobject_get_path() - Allocate memory and fill in the path for @kobj.*@kobj: kobject in question, with which to build the path*@gfp_mask: the allocation type used to allocate the path* Return: The newly allocated memory, caller must free with kfree().
507  If Not devpath Then
508  error = -ENOMEM
509  Go to out
511  devpath_string = Allocation memory
512  If Not devpath_string Then
513  error = -ENOMEM
514  Go to out
516  sprintf - Format a string and place it in a buffer*@buf: The buffer to place the result into*@fmt: The format string to use*@...: Arguments for the format string* The function returns the number of characters written* into @buf
517  envp[0] = devpath_string
518  envp[1] = NULL
520  name = dup_name = kstrdup_const - conditionally duplicate an existing const string*@s: the string to duplicate*@gfp: the GFP mask used in the kmalloc() call when allocating memory* Note: Strings allocated by kstrdup_const should be freed by kfree_const.
521  If Not name Then
522  error = -ENOMEM
523  Go to out
526  error = sysfs_rename_dir_ns(kobj, new_name, kobject_namespace() - Return @kobj's namespace tag.*@kobj: kobject in question* Returns namespace tag of @kobj if its parent has namespace ops enabled* and thus @kobj should have a namespace tag associated with it. Returns* %NULL otherwise.)
527  If error Then Go to out
531  dup_name = name
532  name = name
537  kobject_uevent_env - send an uevent with environmental data*@kobj: struct kobject that the action is happening to*@action: action that is happening*@envp_ext: pointer to environmental data* Returns 0 if kobject_uevent_env() is completed with success or the
539  out :
540  kfree_const - conditionally free memory*@x: pointer to the memory* Function calls kfree only if @x is not in .rodata section.
541  kfree(devpath_string)
542  kfree(devpath)
543  kobject_put() - Decrement refcount for object.*@kobj: object.* Decrement the refcount, and if 0, call kobject_cleanup().
545  Return error