Re: How to know if dir is empty?

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

 



> Is it possible to tell, at VFS level, if a dir is empty by only seeing
> its inode (struct inode)? If not, what do I need?

hi.
dont take me for an expert, but:
if ur not writing code to a specific f/s, then no.
these detailed are _supposed_ to be hidden from the vfs's point of view.
however, at the vfs level, u can check if a dentry has some cached 
children -> and by no means u can take that as an authoritive answer...
what u can do, and it is highly recommended to avoid, is to open a 
corresponding file for the inode, and then invoke the file->f_op->readdir 
function. (dont forget, the magik is in the filldir function u pass it...)

anyway, why do you need such a thing????

-- 
========================================================================
nir.


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           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