Function report |
Source Code:block\ioctl.c |
Create Date:2022-07-28 17:16:01 |
Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
home page | Tree |
Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:blkpg_ioctl
Proto:static int blkpg_ioctl(struct block_device *bdev, struct blkpg_ioctl_arg __user *arg)
Type:int
Parameter:
Type | Parameter | Name |
---|---|---|
struct block_device * | bdev | |
struct blkpg_ioctl_arg __user * | arg |
25 | If Not Check operation authority Then Return -EACCES |
27 | If copy_from_user( & a, arg, sizeof(structblkpg_ioctl_arg)) Then Return -EFAULT |
29 | If copy_from_user( & p, data, sizeof(structblkpg_partition)) Then Return -EFAULT |
32 | If bdev != bd_contains Then Return -EINVAL |
34 | partno = partition number |
38 | Case op == The subfunctions (for the op field) |
39 | start = starting offset in bytes >> 9 |
40 | length = length in bytes >> 9 |
50 | If starting offset in bytes & bdev_logical_block_size(bdev) - 1 Then Return -EINVAL |
53 | mutex_lock( & open/close mutex ) |
56 | disk_part_iter_init( & piter, disk, clude 0-sized parts ) |
58 | When part = disk_part_iter_next( & piter) cycle |
66 | disk_part_iter_exit( & piter) |
69 | part = add_partition(disk, partno, start, length, ADDPART_FLAG_NONE, NULL) |
72 | Return PTR_ERR_OR_ZERO(part) |
73 | Case op == BLKPG_DEL_PARTITION |
74 | part = disk_get_part(disk, partno) |
79 | disk_put_part(part) |
83 | mutex_lock( & open/close mutex ) |
84 | If bd_openers Then |
87 | Return -EBUSY |
90 | fsync_bdev(bdevp) |
91 | invalidate_bdev(bdevp) |
93 | mutex_lock_nested( & open/close mutex , 1) |
94 | delete_partition(disk, partno) |
99 | Return 0 |
100 | Case op == BLKPG_RESIZE_PARTITION |
101 | start = starting offset in bytes >> 9 |
103 | length = length in bytes >> 9 |
112 | part = disk_get_part(disk, partno) |
116 | If Not bdevp Then |
117 | disk_put_part(part) |
118 | Return -ENOMEM |
120 | mutex_lock( & open/close mutex ) |
121 | mutex_lock_nested( & open/close mutex , 1) |
122 | If start != start_sect Then |
126 | disk_put_part(part) |
127 | Return -EINVAL |
130 | disk_part_iter_init( & piter, disk, clude 0-sized parts ) |
132 | When lpart = disk_part_iter_next( & piter) cycle |
145 | disk_part_iter_exit( & piter) |
151 | disk_put_part(part) |
152 | Return 0 |
153 | Default |
154 | Return -EINVAL |
Name | Describe |
---|---|
blkdev_ioctl | always keep this in sync with compat_blkdev_ioctl() |
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 |