51 lines
1.7 KiB
HTML
51 lines
1.7 KiB
HTML
<!-- X-URL: http://step.polymtl.ca/~ldd/ext2fs/ext2fs_8.html -->
|
|
|
|
<!-- This HTML file has been created by texi2html 1.29
|
|
from ext2fs.texi on 3 August 1994 -->
|
|
|
|
<TITLE>Analysis of the Ext2fs structure - Directories</TITLE>
|
|
<P>Go to the <A HREF="ext2fs_7.html">previous</A>, <A HREF="ext2fs_9.html">next</A> section.<P>
|
|
<A NAME="IDX43"></A>
|
|
<H1><A NAME="SEC8" HREF="ext2fs_toc.html#SEC8">Directories</A></H1>
|
|
<A NAME="IDX44"></A>
|
|
<P>
|
|
Directories are special files that are used to create access path to
|
|
the files on disk. It is very important to understand that an inode may
|
|
have many access paths. Since the directories are essential part of the
|
|
file system, they have a specific structure. A directory file is a list
|
|
of entries of the following format:
|
|
<P>
|
|
<PRE>
|
|
struct ext2_dir_entry {
|
|
unsigned long inode;
|
|
unsigned short rec_len;
|
|
unsigned short name_len;
|
|
char name[EXT2_NAME_LEN];
|
|
};
|
|
</PRE>
|
|
<P>
|
|
<DL COMPACT>
|
|
<DT><CODE>inode</CODE>
|
|
<DD>points to the inode of the file.
|
|
<P>
|
|
<DT><CODE>rec_len</CODE>
|
|
<DD>length of the entry record.
|
|
<P>
|
|
<DT><CODE>name_len</CODE>
|
|
<DD>length of the file name.
|
|
<P>
|
|
<DT><CODE>name</CODE>
|
|
<DD>name of the file. This name may have a maximum length of
|
|
<CODE>EXT2_NAME_LEN</CODE> bytes (255 bytes as of version 0.5).
|
|
</DL>
|
|
<A NAME="IDX45"></A>
|
|
<A NAME="IDX46"></A>
|
|
<A NAME="IDX47"></A>
|
|
<P>
|
|
There is such an entry in the directory file for each file in the
|
|
directory. Since ext2fs is a Unix file system the first two entries in
|
|
the directory are file <SAMP>`.'</SAMP> and <SAMP>`..'</SAMP> which points to the
|
|
current directory and the parent directory respectively.
|
|
<P>
|
|
<P>Go to the <A HREF="ext2fs_7.html">previous</A>, <A HREF="ext2fs_9.html">next</A> section.<P>
|