Function report |
Source Code:fs\block_dev.c |
Create Date:2022-07-28 20:14:49 |
Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
home page | Tree |
Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:d_mutex locking:* mutex_lock(part->bd_mutex)* mutex_lock_nested(whole->bd_mutex, 1)
Proto:static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part)
Type:int
Parameter:
Type | Parameter | Name |
---|---|---|
struct block_device * | bdev | |
fmode_t | mode | |
int | for_part |
1562 | perm = 0 |
1563 | bool first_open = false |
1565 | If mode & le is open for reading Then perm |= MAY_READ |
1567 | If mode & le is open for writing Then perm |= MAY_WRITE |
1572 | If Not for_part Then |
1573 | ret = devcgroup_inode_permission( will die , perm) |
1574 | If ret != 0 Then |
1580 | restart : |
1583 | disk = bdev_get_gendisk(bdev, & partno) |
1587 | disk_block_events(disk) |
1588 | mutex_lock_nested( & open/close mutex , for_part) |
1589 | If Not bd_openers Then |
1590 | first_open = true |
1593 | bd_contains = bdev |
1596 | If Not partno Then |
1598 | bd_part = disk_get_part(disk, partno) |
1602 | ret = 0 |
1603 | If open Then |
1610 | disk_put_part(bd_part) |
1611 | bd_part = NULL |
1612 | bd_disk = NULL |
1613 | bd_queue = NULL |
1615 | disk_unblock_events(disk) |
1616 | put_disk_and_module(disk) |
1617 | Go to restart |
1621 | If Not ret Then |
1622 | bd_set_size(bdev, (loff_t)get_capacity(disk) << 9) |
1623 | set_init_blocksize(bdev) |
1632 | If bd_invalidated && ( Not ret || ret == -ENOMEDIUM ) Then bdev_disk_changed(bdev, ret == - ENOMEDIUM) |
1638 | Else |
1648 | bd_contains = whole |
1649 | bd_part = disk_get_part(disk, partno) |
1650 | If Not (flags & GENHD_FL_UP) || Not bd_part || Not nr_sects Then |
1655 | bd_set_size(bdev, (loff_t)nr_sects << 9) |
1656 | set_init_blocksize(bdev) |
1659 | If bd_bdi == noop_backing_dev_info Then bd_bdi = bdi_get(backing_dev_info) |
1661 | Else |
1662 | If bd_contains == bdev Then |
1674 | bd_openers++ |
1678 | disk_unblock_events(disk) |
1680 | If Not first_open Then put_disk_and_module(disk) |
1682 | Return 0 |
1684 | out_clear : |
1685 | disk_put_part(bd_part) |
1686 | bd_disk = NULL |
1687 | bd_part = NULL |
1688 | bd_queue = NULL |
1689 | If bdev != bd_contains Then __blkdev_put(bd_contains, mode, 1) |
1691 | bd_contains = NULL |
1692 | out_unlock_bdev : |
1694 | disk_unblock_events(disk) |
1695 | put_disk_and_module(disk) |
1696 | out : |
1699 | Return ret |
Name | Describe |
---|---|
__blkdev_get | d_mutex locking:* mutex_lock(part->bd_mutex)* mutex_lock_nested(whole->bd_mutex, 1) |
blkdev_get | lkdev_get - open a block device*@bdev: block_device to open*@mode: FMODE_* mask*@holder: exclusive holder identifier* Open @bdev with @mode. If @mode includes %FMODE_EXCL, @bdev is* open with exclusive access. Specifying %FMODE_EXCL with %NULL |
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 |