Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:always keep this in sync with compat_blkdev_ioctl()

Proto:int blkdev_ioctl(struct block_device *bdev, fmode_t mode, unsigned cmd, unsigned long arg)

Type:int

Parameter:

TypeParameterName
struct block_device *bdev
fmode_tmode
unsignedcmd
unsigned longarg
489  __user * argp = arg
494  Case cmd == lush buffer cache
495  Return blkdev_flushbuf(bdev, mode, cmd, arg)
496  Case cmd == set device read-only (0 = read-write)
497  Return blkdev_roset(bdev, mode, cmd, arg)
498  Case cmd == BLKDISCARD
499  Return blk_ioctl_discard(bdev, mode, arg, 0)
500  Case cmd == BLKSECDISCARD
501  Return blk_ioctl_discard(bdev, mode, arg, ssue a secure erase )
503  Case cmd == BLKZEROOUT
504  Return blk_ioctl_zeroout(bdev, mode, arg)
505  Case cmd == Zoned block device ioctl's:*@BLKREPORTZONE: Get zone information
506  Return blkdev_report_zones_ioctl(bdev, mode, cmd, arg)
507  Case cmd == BLKRESETZONE
508  Case cmd == BLKOPENZONE
509  Case cmd == BLKCLOSEZONE
510  Case cmd == BLKFINISHZONE
511  Return blkdev_zone_mgmt_ioctl(bdev, mode, cmd, arg)
512  Case cmd == BLKGETZONESZ
513  Return put_uint(arg, bdev_zone_sectors(bdev))
514  Case cmd == BLKGETNRZONES
515  Return put_uint(arg, blkdev_nr_zones(bd_disk))
516  Case cmd == get device geometry
517  Return blkdev_getgeo(bdev, argp)
518  Case cmd == get current read ahead setting
519  Case cmd == get filesystem (mm/filemap.c) read-ahead
520  If Not arg Then Return -EINVAL
522  Return put_long(arg, (ra_pages * PAGE_SIZE) / 512)
523  Case cmd == get read-only status (0 = read_write)
524  Return put_int(arg, bdev_read_only(bdev) != 0)
525  Case cmd == A jump here: 108-111 have been used for various private purposes.
526  Return put_int(arg, block_size(bdev))
527  Case cmd == get block device sector size
528  Return put_int(arg, bdev_logical_block_size(bdev))
529  Case cmd == BLKPBSZGET
530  Return put_uint(arg, bdev_physical_block_size(bdev))
531  Case cmd == BLKIOMIN
532  Return put_uint(arg, bdev_io_min(bdev))
533  Case cmd == BLKIOOPT
534  Return put_uint(arg, bdev_io_opt(bdev))
535  Case cmd == BLKALIGNOFF
536  Return put_int(arg, bdev_alignment_offset(bdev))
537  Case cmd == BLKDISCARDZEROES
538  Return put_uint(arg, 0)
539  Case cmd == get max sectors per request (ll_rw_blk.c)
540  max_sectors = min_t - return minimum of two values, using the specified type*@type: data type to use*@x: first value*@y: second value(unsignedint, USHRT_MAX, queue_max_sectors(bdev_get_queue(bdev)))
542  Return put_ushort(arg, max_sectors)
543  Case cmd == BLKROTATIONAL
544  Return put_ushort(arg, !blk_queue_nonrot(bdev_get_queue(bdev)))
545  Case cmd == set read ahead for block device
546  Case cmd == set filesystem (mm/filemap.c) read-ahead
547  If Not Check operation authority Then Return -EACCES
549  ra_pages = arg * 512 / PAGE_SIZE
550  Return 0
551  Case cmd == BLKBSZSET
552  Return set the logical block size
553  Case cmd == BLKPG
554  Return blkpg_ioctl(bdev, argp)
555  Case cmd == -read partition table
556  Return blkdev_reread_part(bdev)
557  Case cmd == urn device size /512 (long *arg)
558  size = NOTE: in a 32bit arch with a preemptable kernel and* an UP compile the i_size_read/write must be atomic* with respect to the local cpu (unlike with preempt disabled),* but they don't need to be atomic with respect to other cpus like in* true SMP (so they
559  If size >> 9 > ~0UL Then Return -EFBIG
561  Return put_ulong(arg, size >> 9)
562  Case cmd == urn device size in bytes (u64 *arg)
563  Return put_u64(arg, NOTE: in a 32bit arch with a preemptable kernel and* an UP compile the i_size_read/write must be atomic* with respect to the local cpu (unlike with preempt disabled),* but they don't need to be atomic with respect to other cpus like in* true SMP (so they )
564  Case cmd == BLKTRACESTART
565  Case cmd == BLKTRACESTOP
566  Case cmd == BLKTRACESETUP
567  Case cmd == BLKTRACETEARDOWN
568  Return blk_trace_ioctl(bdev, cmd, argp)
569  Case cmd == IOC_PR_REGISTER
570  Return blkdev_pr_register(bdev, argp)
571  Case cmd == IOC_PR_RESERVE
572  Return blkdev_pr_reserve(bdev, argp)
573  Case cmd == IOC_PR_RELEASE
574  Return blkdev_pr_release(bdev, argp)
575  Case cmd == IOC_PR_PREEMPT
576  Return blkdev_pr_preempt(bdev, argp, false)
577  Case cmd == IOC_PR_PREEMPT_ABORT
578  Return blkdev_pr_preempt(bdev, argp, true)
579  Case cmd == IOC_PR_CLEAR
580  Return blkdev_pr_clear(bdev, argp)
581  Default
582  Return __blkdev_driver_ioctl(bdev, mode, cmd, arg)
Caller
NameDescribe
compat_blkpg_ioctl
compat_blkdev_ioctlMost of the generic ioctls are handled in the normal fallback path.This assumes the blkdev's low level compat_ioctl always returnsENOIOCTLCMD for unknown ioctls.
ioctl_by_bdev