Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:Most 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.

Proto:long compat_blkdev_ioctl(struct file *file, unsigned cmd, unsigned long arg)

Type:long

Parameter:

TypeParameterName
struct file *file
unsignedcmd
unsigned longarg
318  ret = -No ioctl command
319  inode = host
320  bdev = i_bdev
321  disk = bd_disk
322  mode = f_mode
330  If f_flags & O_NDELAY Then mode |= File is opened with O_NDELAY (only set for block devices)
332  Else mode &= ~File is opened with O_NDELAY (only set for block devices)
336  Case cmd == get device geometry
337  Return compat_hdio_getgeo(disk, bdev, A pointer passed in from user mode. This should not* be used for syscall parameters, just declare them* as pointers because the syscall entry code will have* appropriately converted them already.)
338  Case cmd == BLKPBSZGET
339  Return compat_put_uint(arg, bdev_physical_block_size(bdev))
340  Case cmd == BLKIOMIN
341  Return compat_put_uint(arg, bdev_io_min(bdev))
342  Case cmd == BLKIOOPT
343  Return compat_put_uint(arg, bdev_io_opt(bdev))
344  Case cmd == BLKALIGNOFF
345  Return compat_put_int(arg, bdev_alignment_offset(bdev))
346  Case cmd == BLKDISCARDZEROES
347  Return compat_put_uint(arg, 0)
348  Case cmd == lush buffer cache
349  Case cmd == set device read-only (0 = read-write)
350  Case cmd == BLKDISCARD
351  Case cmd == BLKSECDISCARD
352  Case cmd == BLKZEROOUT
357  Case cmd == -read partition table
358  Case cmd == Zoned block device ioctl's:*@BLKREPORTZONE: Get zone information
359  Case cmd == BLKRESETZONE
360  Case cmd == BLKOPENZONE
361  Case cmd == BLKCLOSEZONE
362  Case cmd == BLKFINISHZONE
363  Case cmd == BLKGETZONESZ
364  Case cmd == BLKGETNRZONES
365  Return always keep this in sync with compat_blkdev_ioctl()
367  Case cmd == BLKBSZSET_32
368  Return always keep this in sync with compat_blkdev_ioctl()
370  Case cmd == BLKPG
371  Return compat_blkpg_ioctl(bdev, mode, cmd, A pointer passed in from user mode. This should not* be used for syscall parameters, just declare them* as pointers because the syscall entry code will have* appropriately converted them already.)
372  Case cmd == get current read ahead setting
373  Case cmd == get filesystem (mm/filemap.c) read-ahead
374  If Not arg Then Return -EINVAL
376  Return compat_put_long(arg, (ra_pages * PAGE_SIZE) / 512)
378  Case cmd == get read-only status (0 = read_write)
379  Return compat_put_int(arg, bdev_read_only(bdev) != 0)
380  Case cmd == BLKBSZGET_32
381  Return compat_put_int(arg, block_size(bdev))
382  Case cmd == get block device sector size
383  Return compat_put_int(arg, bdev_logical_block_size(bdev))
384  Case cmd == get max sectors per request (ll_rw_blk.c)
385  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)))
387  Return compat_put_ushort(arg, max_sectors)
388  Case cmd == BLKROTATIONAL
389  Return compat_put_ushort(arg, !blk_queue_nonrot(bdev_get_queue(bdev)))
391  Case cmd == set read ahead for block device
392  Case cmd == set filesystem (mm/filemap.c) read-ahead
393  If Not Check operation authority Then Return -EACCES
395  ra_pages = arg * 512 / PAGE_SIZE
396  Return 0
397  Case cmd == urn device size /512 (long *arg)
398  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
399  If size >> 9 > ~0UL Then Return -EFBIG
401  Return compat_put_ulong(arg, size >> 9)
403  Case cmd == BLKGETSIZE64_32
404  Return compat_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 )
406  Case cmd == BLKTRACESETUP32
407  Case cmd == BLKTRACESTART
408  Case cmd == BLKTRACESTOP
409  Case cmd == BLKTRACETEARDOWN
410  ret = blk_trace_ioctl(bdev, cmd, A pointer passed in from user mode. This should not* be used for syscall parameters, just declare them* as pointers because the syscall entry code will have* appropriately converted them already.)
411  Return ret
412  Case cmd == IOC_PR_REGISTER
413  Case cmd == IOC_PR_RESERVE
414  Case cmd == IOC_PR_RELEASE
415  Case cmd == IOC_PR_PREEMPT
416  Case cmd == IOC_PR_PREEMPT_ABORT
417  Case cmd == IOC_PR_CLEAR
418  Return always keep this in sync with compat_blkdev_ioctl()
420  Default
421  If compat_ioctl Then ret = compat_ioctl(bdev, mode, cmd, arg)
423  If ret == -No ioctl command Then ret = compat_blkdev_driver_ioctl(bdev, mode, cmd, arg)
425  Return ret