Function report |
Source Code:block\partition-generic.c |
Create Date:2022-07-28 17:21:10 |
| Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
| home page | Tree |
| Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:Must be called either with bd_mutex held, before a disk can be opened or* after all disk users are gone.
Proto:struct hd_struct *add_partition(struct gendisk *disk, int partno, sector_t start, sector_t len, int flags, struct partition_meta_info *info)
Type:struct hd_struct
Parameter:
| Type | Parameter | Name |
|---|---|---|
| struct gendisk * | disk | |
| int | partno | |
| sector_t | start | |
| sector_t | len | |
| int | flags | |
| struct partition_meta_info * | info |
| 318 | ddev = disk_to_dev(disk) |
| 329 | Case zoned == Host-managed zoned block device |
| 330 | pr_warn("%s: partitions not supported on host managed zoned block device\n", name of major driver ) |
| 333 | Case zoned == Host-aware zoned block device |
| 334 | pr_info("%s: disabling host aware zoned block device support due to partitions\n", name of major driver ) |
| 336 | zoned = Regular block device |
| 337 | Break |
| 338 | Case zoned == Regular block device |
| 339 | Break |
| 350 | p = 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). |
| 354 | If Not init_part_stats(p) Then |
| 359 | seqcount_init( & nr_sects_seq) |
| 360 | pdev = part_to_dev(p) |
| 362 | start_sect = start |
| 363 | alignment_offset = queue_limit_alignment_offset( & limits, start) |
| 367 | * nr_sects is protected by sequence counter. One might extend a * partition while IO is happening to it and update of nr_sects * can be non-atomic on 32bit machines with 64bit sector_t. = len |
| 369 | policy = get_disk_ro(disk) |
| 371 | If info Then |
| 382 | If isdigit(dname[strlen - Find the length of a string*@s: The string to be sized - 1]) Then dev_set_name(pdev, "%sp%d", dname, partno) |
| 384 | Else dev_set_name(pdev, "%s%d", dname, partno) |
| 387 | device_initialize(pdev) |
| 388 | class = block_class |
| 392 | err = 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 |
| 393 | If err Then Go to out_free_info |
| 398 | dev_set_uevent_suppress(pdev, 1) |
| 399 | err = device_add(pdev) |
| 405 | If Not holder_dir Then Go to out_del |
| 408 | dev_set_uevent_suppress(pdev, 0) |
| 409 | If flags & ADDPART_FLAG_WHOLEDISK Then |
| 410 | err = device_create_file(pdev, & dev_attr_whole_disk) |
| 415 | err = hd_ref_init(p) |
| 416 | If err Then |
| 417 | If flags & ADDPART_FLAG_WHOLEDISK Then Go to out_remove_file |
| 419 | Go to out_del |
| 428 | Return p |
| 430 | out_free_info : |
| 431 | free_part_info(p) |
| 432 | out_free_stats : |
| 433 | free_part_stats(p) |
| 434 | out_free : |
| 437 | out_remove_file : |
| 439 | out_del : |
| 441 | device_del(pdev) |
| 442 | out_put : |
| 443 | put_device(pdev) |
| Name | Describe |
|---|---|
| blk_add_partition |
| Source code conversion tool public plug-in interface | X |
|---|---|
| Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |