[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

Re: [LI] getdents() endgames



On Fri, Jan 14, 2000 at 03:24:28PM +0530, Ajit, Kumar   (IE10) wrote:
> Vimal can you tell how getdents() is fooling you? What exactly it is
> doing/showing.
> 
getdents() is the system call that gets the directory contents. My program
called getdents() and displayed the contents(a series of dirent structures -- struct dirent is defined in /usr/include/linux/dirent.h). I used the record length d_reclen to jump from one dirent structure to the next (I could have used the offset d_off also). For the last directory entry, the value of d_off shows values as I specified in my previous mail. This value (d_off for the last dirent entry in a directory) is what I need. Like I said in my previous mail, this value seems to equal the size of a block in an ext2 filesystem, 7168 bytes(14 sectors) in an MSDOS formatted floppy .... I need to be able to get this value without going through superblocks or reading through a directory. The program (I write) that would be needing this value is a kernel module; so I can access the kernel structures through the file-descriptors (if necessary). I am using kernel 2.2.13.

--vml,
Model Engg. College,
Cochin
--------------------------------------------------------------------
The Linux India Mailing List Archives are now available.  Please search
the archive at http://lists.linux-india.org/ before posting your question
to avoid repetition and save bandwidth.