Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

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

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

Type:void

Parameter:

TypeParameterName
struct device *parent
struct gendisk *disk
const struct attribute_group **groups
boolregister_queue
704  If register_queue Then For a device queue that has no required features, use the default elevator* settings. Otherwise, use the first elevator available matching the required* features. If no suitable elevator is find or if the chosen elevator
711  WARN_ON( maximum number of minors, =1 for * disks that can't be partitioned. && !( major number of driver || first_minor))
712  WARN_ON(! maximum number of minors, =1 for * disks that can't be partitioned. && !(flags & (allow extended devt | GENHD_FL_HIDDEN)))
715  flags |= GENHD_FL_UP
717  retval = lk_alloc_devt - allocate a dev_t for a partition*@part: partition to allocate dev_t for*@devt: out parameter for resulting dev_t* Allocate a dev_t for block device
718  If retval Then
719  WARN_ON(1)
720  Return
722  major number of driver = MAJOR(devt)
723  first_minor = MINOR(devt)
725  disk_alloc_events(disk)
727  If flags & GENHD_FL_HIDDEN Then
732  flags |= GENHD_FL_SUPPRESS_PARTITION_INFO
733  flags |= GENHD_FL_NO_PART_SCAN
734  Else
738  dev_t, creates the sysfs "dev" = devt
739  ret = bdi_register_owner(backing_dev_info, disk_to_dev(disk))
741  WARN_ON(ret)
742  Register device numbers dev..(dev+range-1)* range must be nonzero* The hash chain is sorted on range, so that subranges can override.
745  register_disk(parent, disk, groups)
746  If register_queue Then lk_register_queue - register a block layer queue with sysfs*@disk: Disk of which the request queue should be registered with sysfs.
753  WARN_ON_ONCE(!blk_get_queue(queue))
755  disk_add_events(disk)
756  blk_integrity_add(disk)
Caller
NameDescribe
device_add_disk
device_add_disk_no_queue_reg