Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:register_disk

Proto:static void register_disk(struct device *parent, struct gendisk *disk, const struct attribute_group **groups)

Type:void

Parameter:

TypeParameterName
struct device *parent
struct gendisk *disk
const struct attribute_group **groups
599  ddev = disk_to_dev(disk)
605  parent = parent
607  dev_set_name(ddev, "%s", name of major driver )
610  dev_set_uevent_suppress(ddev, 1)
612  If groups Then
613  WARN_ON( optional groups )
614  optional groups = groups
616  If device_add(ddev) Then Return
618  If Not sysfs_deprecated Then
619  err = sysfs_create_link(block_depr, & kobj, kobject_name( & kobj))
621  If err Then
622  device_del(ddev)
623  Return
632  pm_runtime_set_memalloc_noio(ddev, true)
634  holder_dir = kobject_create_and_add() - Create a struct kobject dynamically and* register it with sysfs.*@name: the name for the kobject*@parent: the parent kobject of this kobject, if any.* This function creates a kobject structure dynamically and registers it
635  slave_dir = kobject_create_and_add() - Create a struct kobject dynamically and* register it with sysfs.*@name: the name for the kobject*@parent: the parent kobject of this kobject, if any.* This function creates a kobject structure dynamically and registers it
637  If flags & GENHD_FL_HIDDEN Then
638  dev_set_uevent_suppress(ddev, 0)
639  Return
643  If Not disk_part_scan_enabled(disk) Then Go to exit
647  If Not get_capacity(disk) Then Go to exit
650  bdev = dget_disk - do bdget() by gendisk and partition number*@disk: gendisk of interest*@partno: partition number* Find partition @partno from @disk, do bdget() on it.* CONTEXT:* Don't care.* RETURNS:* Resulting block_device on success, NULL on failure.
651  If Not bdev Then Go to exit
654  bd_invalidated = 1
655  err = blkdev_get(bdev, le is open for reading , NULL)
656  If err < 0 Then Go to exit
658  blkdev_put(bdev, le is open for reading )
660  exit :
662  dev_set_uevent_suppress(ddev, 0)
663  kobject_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.
666  disk_part_iter_init - initialize partition iterator*@piter: iterator to initialize*@disk: disk to iterate over*@flags: DISK_PITER_* flags* Initialize @piter so that it iterates over partitions of @disk.* CONTEXT:* Don't care.
667  When part = disk_part_iter_next - proceed iterator to the next partition and return it*@piter: iterator of interest* Proceed @piter to the next partition and return it.* CONTEXT:* Don't care. cycle
668  kobject_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.
669  disk_part_iter_exit - finish up partition iteration*@piter: iter of interest* Called when iteration is over. Cleans up @piter.* CONTEXT:* Don't care.
671  If dev Then
672  err = sysfs_create_link( & kobj, & kobj, "bdi")
675  WARN_ON(err)
Caller
NameDescribe
__device_add_disk__device_add_disk - add disk information to kernel list*@parent: parent device for the disk*@disk: per-device partitioning information*@groups: Additional per-device sysfs groups*@register_queue: register the queue if set to true* This function registers