函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:fs\readdir.c Create Date:2022-07-29 10:36:34
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:filldir

函数原型:static int filldir(struct dir_context *ctx, const char *name, int namlen, loff_t offset, u64 ino, unsigned int d_type)

返回类型:int

参数:

类型参数名称
struct dir_context *ctx
const char *name
intnamlen
loff_toffset
u64ino
unsigned intd_type
221  __userdirent
222  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, structgetdents_callback, ctx)
225  reclen等于@a is a power of 2 value (offsetof(structlinux_dirent, d_name) + namlen + 2, sizeof(long))
229  error等于POSIX says that a dirent name cannot contain NULL or a '/'.* It's not 100% clear what we should really do in this case.* The filesystem is clearly corrupted, but returning a hard* error means that you now don't see any of the other names
230  如果此条件成立可能性小(为编译器优化)(error)则返回:error
232  error等于负EINVAL
233  如果reclen大于count则返回:负EINVAL
235  d_ino等于ino
236  如果d_ino的长度小于ino的长度且d_ino不等于ino
237  error等于负EOVERFLOW
238  返回:负EOVERFLOW
240  prev_reclen等于prev_reclen
241  如果prev_reclensignal_pending(当前进程)则返回:负EINTR
243  dirent等于current_dir
244  prev等于direntprev_reclen
245  如果非The "unsafe" user accesses aren't really "unsafe", but the naming* is a big fat warning: you have to not only do the access_ok()* checking before using them, but you have to surround them with the* user_access_begin/end() pair.则转到:efault
249  unsafe_put_user(offset, & d_off, efault_end)
250  unsafe_put_user(d_ino, & d_ino, efault_end)
251  unsafe_put_user(reclen, & d_reclen, efault_end)
252  unsafe_put_user(d_type, (char__user * )dirent + reclen - 1, efault_end)
253  Note the "unsafe_put_user() semantics: we goto a* label for errors.(d_name, name, namlen, efault_end)
254  user_access_end()
256  current_dir等于direntreclen
257  prev_reclen等于reclen
258  count减等于reclen
259  返回:0
260  efault_end :
261  user_access_end()
262  efault :
263  error等于负EFAULT
264  返回:负EFAULT