Andreas Dilger
2006-May-19 07:36 UTC
[Lustre-discuss] How to open and read directory in obdfilter?
On Apr 22, 2005 00:30 -0500, Dingshan He wrote:> I am trying to extend the obdfilter module to do some HSM related work. I > need to implement the function to read the directories of "/O/0/d*" in order > to know what files are there. > > My question is how can I open directory files and read the entries in the > kernel.The code in mds_cleanup_orphans() does essentially this - traverse a directory and handle each entry from within the kernel. Cheers, Andreas -- Andreas Dilger Principal Software Engineer Cluster File Systems, Inc.
Dingshan He
2006-May-19 07:36 UTC
[Lustre-discuss] How to open and read directory in obdfilter?
I am trying to extend the obdfilter module to do some HSM related work. I
need to implement the function to read the directories of "/O/0/d*" in
order
to know what files are there.
My question is how can I open directory files and read the entries in the
kernel.
I have tried to use filp_open("O/0/d0", O_RDONLY | O_DIRECTORY, 0) but
it
returns an error saying "Is a directory". So, what is the correct way
to
open a dir in the kernel?
For reading an opened directory, I assume that I can use vfs_readdir(). Am I
right?
Thanks for any help!