Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name: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

Proto:int kobject_uevent_env(struct kobject *kobj, enum kobject_action action, char *envp_ext[])

Type:int

Parameter:

TypeParameterName
struct kobject *kobj
enum kobject_actionaction
char *envp_ext
460  action_string = he strings here must match the enum in include/linux/kobject.h [action]
461  const char * devpath = NULL
466  i = 0
467  retval = 0
473  If action == KOBJ_REMOVE Then state_remove_uevent_sent = 1
476  pr_debug("kobject: '%s' (%p): %s\n", kobject_name(kobj), kobj, __func__)
480  top_kobj = kobj
481  When Not kset && parent cycle
482  top_kobj = parent
484  If Not kset Then
485  pr_debug("kobject: '%s' (%p): %s: attempted to send uevent without kset!\n", kobject_name(kobj), kobj, __func__)
488  Return -EINVAL
491  kset = kset
492  uevent_ops = uevent_ops
495  If uevent_suppress Then
496  pr_debug("kobject: '%s' (%p): %s: uevent_suppress caused the event to drop!\n", kobject_name(kobj), kobj, __func__)
499  Return 0
502  If uevent_ops && filter Then If Not filter(kset, kobj) Then
504  pr_debug("kobject: '%s' (%p): %s: filter function caused the event to drop!\n", kobject_name(kobj), kobj, __func__)
507  Return 0
511  If uevent_ops && name Then subsystem = name(kset, kobj)
513  Else subsystem = kobject_name( & kobj)
515  If Not subsystem Then
516  pr_debug("kobject: '%s' (%p): %s: unset subsystem caused the event to drop!\n", kobject_name(kobj), kobj, __func__)
519  Return 0
523  env = kzalloc - allocate memory. The memory is set to zero.*@size: how many bytes of memory are required.*@flags: the type of memory to allocate (see kmalloc).
524  If Not env Then Return -ENOMEM
528  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().
529  If Not devpath Then
530  retval = -ENOENT
531  Go to exit
535  retval = add_uevent_var - add key value string to the environment buffer*@env: environment buffer structure*@format: printf format for the key=value pair* Returns 0 if environment variable was added successfully or -ENOMEM* if no space was available.
536  If retval Then Go to exit
538  retval = add_uevent_var - add key value string to the environment buffer*@env: environment buffer structure*@format: printf format for the key=value pair* Returns 0 if environment variable was added successfully or -ENOMEM* if no space was available.
539  If retval Then Go to exit
541  retval = add_uevent_var - add key value string to the environment buffer*@env: environment buffer structure*@format: printf format for the key=value pair* Returns 0 if environment variable was added successfully or -ENOMEM* if no space was available.
542  If retval Then Go to exit
546  If envp_ext Then
547  When envp_ext[i] cycle
549  If retval Then Go to exit
555  If uevent_ops && uevent Then
556  retval = uevent(kset, kobj, env)
557  If retval Then
558  pr_debug("kobject: '%s' (%p): %s: uevent() returned %d\n", kobject_name(kobj), kobj, __func__, retval)
561  Go to exit
566  Case action == KOBJ_ADD
575  Break
577  Case action == KOBJ_UNBIND
579  Break
581  Default
582  Break
588  If retval Then
623  exit :
624  kfree(devpath)
625  kfree(env)
626  Return retval
Caller
NameDescribe
kobject_synth_ueventkobject_synth_uevent - send synthetic uevent with arguments*@kobj: struct kobject for which synthetic uevent is to be generated*@buf: buffer containing action type and action args, newline is ignored*@count: length of buffer* Returns 0 if
kobject_ueventkobject_uevent - notify userspace by sending an uevent*@kobj: struct kobject that the action is happening to*@action: action that is happening* Returns 0 if kobject_uevent() is completed with success or the* corresponding error when it fails.
kobject_renamekobject_rename() - Change the name of an object
kobject_movekobject_move() - Move object to another parent.*@kobj: object in question.*@new_parent: object's new parent (can be NULL)
disk_check_events