Linux Kernel Architecture

(Jacob Rumans) #1

Chapter 9: The Extended Filesystem Family


__u16 i_pad1;
__le16 l_i_uid_high; /* these 2 fields */
__le16 l_i_gid_high; /* were reserved2[0] */
__u32 l_i_reserved2;
} linux2;
struct {
...
} hurd2;
struct {
...
} masix2;
} osd2; /* OS dependent 2 */
};

The structure includes three operating-system-specificunions that accept different data, depending on
use. The Ext2 filesystem is used not only in Linux but also in the HURD kernel^10 of the GNU project and
in the Masix experimental operating system (one of the principal authors of Ext2 was involved in the
development of Masix). The structure in the preceding code shows only the Linux-specific elements; the
data of other operating systems are beyond the scope of this book.

At the beginning of the structure there is a whole host of data on the properties of the file characterized
by the inode. Many of these data will be familiar from Chapter 8, where the structure of a generalized
virtual filesystem inode is discussed.

❑ i_modesaves the access rights (in accordance with the usualUnixscheme of user, group, others)
and the file type (directory, device file, etc.).
❑ Time stamps with the following meanings are held inctime,atime,mtime,anddtime:

❑ atimegives the time of the last file access.
❑ mtimegives the time of the last file change.
❑ ctimegives the time of the last inode change.
❑ dtimegives the time of file deletion.

All time stamps are stored in the conventionalUnixformat to indicate the number of seconds
elapsed since midnight on 1 January 1970.
❑ The user and group ID consist of 32 bits and are, for historical reasons, split into two fields. The
lower-order part is ini_uidandi_gid, and the higher-order parts are inl_i_uid_highand
l_i_gid_high.
Why is this rather strange approach adopted instead of two simple 32-bit numbers? When the
Ext2 filesystem was conceived, 16-bit numberswere adequate for user and group IDs because
this permitted a maximum of 2^16 =65,536 users. At the time, this figure seemed to be large
enough, but this assumption was proved to be wrong, particularly onverylarge systems such as
commercial mail servers. To support enhancement to 32 bits without the need for a new filesys-
tem format, a 32-bit entry from the Linux-specificosd1field was split into two 16-bit parts that
had been reserved for enhancements. Used in conjunction with the existing data, these permit

(^10) Hurd = Hird ofUnixreplacing daemons, Hird = Hurd of interfaces representing depth — a recursive acronym. The Hurd is well
known for announcements of its developers that it will be finished in half a year — or so. Unfortunately, this tradition had already
been established nearly a decade ago, and a final (or at least usable) version is still far on the horizon.

Free download pdf