Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:fs\readdir.c Create Date:2022-07-28 20:06:38
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:compat_filldir

Proto:static int compat_filldir(struct dir_context *ctx, const char *name, int namlen, loff_t offset, u64 ino, unsigned int d_type)

Type:int

Parameter:

TypeParameterName
struct dir_context *ctx
const char *name
intnamlen
loff_toffset
u64ino
unsigned intd_type
482  __user * dirent
483  buf = container_of - cast a member of a structure out to the containing structure*@ptr: the pointer to the member.*@type: the type of the container struct this is embedded in.*@member: the name of the member within the struct.(ctx, structcompat_getdents_callback, ctx)
486  reclen = @a is a power of 2 value (offsetof(structcompat_linux_dirent, d_name) + namlen + 2, sizeof(compat_long_t))
489  error = -EINVAL
490  If reclen > count Then Return -EINVAL
492  d_ino = ino
493  If size of d_ino < size of ino && d_ino != ino Then
494  error = -EOVERFLOW
495  Return -EOVERFLOW
497  dirent = previous
498  If dirent Then
499  If signal_pending(current process) Then Return -EINTR
501  If Write a simple value into user space, with less checking(offset, & d_off) Then Go to efault
504  dirent = current_dir
505  If Write a simple value into user space, with less checking(d_ino, & d_ino) Then Go to efault
507  If Write a simple value into user space, with less checking(reclen, & d_reclen) Then Go to efault
509  If copy_to_user(d_name, name, namlen) Then Go to efault
511  If Write a simple value into user space, with less checking(0, d_name + namlen) Then Go to efault
513  If Write a simple value into user space, with less checking(d_type, (char__user * )dirent + reclen - 1) Then Go to efault
515  previous = dirent
516  dirent = dirent + reclen
517  current_dir = dirent
518  count -= reclen
519  Return 0
520  efault :
521  error = -EFAULT
522  Return -EFAULT