Question about vfs_readdir

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I am trying to understand the code flow for how 'ls' works. What I
have understood till now is that inorder to display files in a
directory filesystems must implement readdir vfs ops, which internally
calls filldir to fill the entries. So if vfs readdir maps to
myfs_readdir say, then myfs_readdir will be called multiple times with
incremented offsets in the directory entry. So myfs_readdir can either
fill the new entries with filldir and return 1 , or  return 0 if no
more entries are there and it will not be called further.

What i couldn't get was which is the code which is calling vfs_readdir
in the loop and checks for the return value of 0 or 1. Below is the
stack trace when vfs_readdir is called. In the function sys_getdents
it is called only once.

(gdb) bt
#0  vfs_readdir (file=0x27201260, filler=0x80aff69 <filldir>,
buf=0x26bfbf04) at fs/readdir.c:23
#1  0x080b0106 in sys_getdents (fd=5, dirent=0x2a88d6ac, count=4096)
at fs/readdir.c:204
#2  0x0805939a in handle_syscall (r=0x9191494) at
arch/um/kernel/skas/syscall.c:38
#3  0x0806584a in handle_trap (pid=24694, regs=0x9191494,
local_using_sysemu=2) at arch/um/os-Linux/skas/process.c:173
#4  0x08065c41 in userspace (regs=0x9191494) at
arch/um/os-Linux/skas/process.c:330
#5  0x08059145 in fork_handler () at arch/um/kernel/skas/process.c:96
#6  0x085d8b3b in ?? ()


Any pointers/suggestions appreciated. Thanks in advance.

-- 
Thanks & Regards,
********************************************
Manish Katiyar  ( http://mkatiyar.googlepages.com )
3rd Floor, Fair Winds Block
EGL Software Park
Off Intermediate Ring Road
Bangalore 560071, India
***********************************************

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux