Pseudo root

[linux/fs/umsdos/inode.c,416]
#Specification: pseudo root / mount

When a umsdos fs is mounted, a special handling is done if it is the root partition. We check for the presence of the file /linux/etc/init or /linux/etc/rc. If one is there, we do a chroot("/linux").

We check both because (see init/main.c) the kernel try to exec init at different place and if it fails it tries /bin/sh /etc/rc. To be consistent with init/main.c, many more test would have to be done to locate init. Any complain ?

The chroot is done manually in init/main.c but the info (the inode) is located at mount time and store in a global variable (pseudo_root) which is used at different place in the umsdos driver. There is no need to store this variable elsewhere because it will always be one, not one per mount.

This feature allows the installation of a linux system within a DOS system in a subdirectory.

A user may install its linux stuff in c:\linux avoiding any clash with existing DOS file and subdirectory. When linux boots, it hides this fact, showing a normal root directory with /etc /bin /tmp ...

The word "linux" is hardcoded in /usr/include/linux/umsdos_fs.h in the macro UMSDOS_PSDROOT_NAME.

[linux/fs/umsdos/dir.c,69]
#Specification: pseudo root / directory /DOS

When umsdos operates in pseudo root mode (C:\linux is the linux root), it simulate a directory /DOS which points to the real root of the file system.

[linux/fs/umsdos/dir.c,486]
#Specification: pseudo root / DOS hard coded

The pseudo sub-directory DOS in the pseudo root is hard coded. The name is DOS. This is done this way to help standardised the umsdos layout. The idea is that from now on /DOS is a reserved path and nobody will think of using such a path for a package.

[linux/fs/umsdos/dir.c,517]
#Specification: pseudo root / .. in real root

Whenever a lookup is those in the real root for the directory .., and pseudo root is active, the pseudo root is returned.

[linux/fs/umsdos/namei.c,166]
#Specification: pseudo root / any file creation /DOS

The pseudo sub-directory /DOS can't be created! EEXIST is returned.

The pseudo sub-directory /DOS can't be removed! EPERM is returned.

[linux/fs/umsdos/dir.c,586]
#Specification: pseudo root / dir lookup

For the same reason as readdir, a lookup in /DOS for the pseudo root directory (linux) will fail.

[linux/fs/umsdos/rdir.c,81]
#Specification: pseudo root / DOS/..

In the real root directory (c:\), the directory .. is the pseudo root (c:\linux).

[linux/fs/umsdos/rdir.c,90]
#Specification: pseudo root / DOS/linux

Even in the real root directory (c:\), the directory /linux won't show

[linux/fs/umsdos/dir.c,548]
#Specification: pseudo root / lookup(DOS)

A lookup of DOS in the pseudo root will always succeed and return the inode of the real root.

[linux/fs/umsdos/dir.c,169]
#Specification: pseudo root / reading real root

The pseudo root (/linux) is logically erased from the real root. This mean that ls /DOS, won't show "linux". This avoids infinite recursion /DOS/linux/DOS/linux while walking the file system.

[linux/fs/umsdos/rdir.c,129]
#Specification: pseudo root / rmdir /DOS

The pseudo sub-directory /DOS can't be removed! This is done even if the pseudo root is not a Umsdos directory anymore (very unlikely), but an accident (under MsDOS) is always possible.

EPERM is returned.