Go to the previous, next section.

Directories

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:

struct ext2_dir_entry {
  unsigned long  inode;
  unsigned short rec_len;
  unsigned short name_len;
  char           name[EXT2_NAME_LEN];
};

inode
points to the inode of the file.

rec_len
length of the entry record.

name_len
length of the file name.

name
name of the file. This name may have a maximum length of EXT2_NAME_LEN bytes (255 bytes as of version 0.5).

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 `.' and `..' which points to the current directory and the parent directory respectively.

Go to the previous, next section.