Specification of the Umsdos file system for LINUX

# Dual mode

[linux/fs/umsdos/rdir.c,179]
#Specification: dual mode / introduction

One goal of UMSDOS is to allow a practical and simple coexistence between MsDOS and Linux in a single partition. Using the EMD file in each directory, UMSDOS add Unix semantics and capabilities to normal DOS file system. To help and simplify coexistence, here is the logic related to the EMD file.

If it is missing, then the directory is managed by the MsDOS driver. The names are limited to DOS limits (8.3). No links, no device special and pipe and so on.

If it is there, it is the directory. If it is there but empty, then the directory looks empty. The utility umssync allows synchronisation of the real DOS directory and the EMD.

Whenever umssync is applied to a directory without EMD, one is created on the fly. The directory is promoted to full unix semantic. Of course, the ls command will show exactly the same content as before the umssync session.

It is believed that the user/admin will promote directories to unix semantic as needed.

The strategy to implement this is to use two function table (struct inode_operations). One for true UMSDOS directory and one for directory with missing EMD.

Functions related to the DOS semantic (but aware of UMSDOS) generally have a "r" prefix (r for real) such as UMSDOS_rlookup, to differentiate from the one with full UMSDOS semantic.

[linux/fs/umsdos/rdir.c,113]
#Specification: dual mode / rmdir in a DOS directory

In a DOS (not EMD in it) directory, we use a reverse strategy compared with an Umsdos directory. We assume that a subdirectory of a DOS directory is also a DOS directory. This is not always true (umssync may be used anywhere), but make sense.

So we call msdos_rmdir() directly. If it failed with a -ENOTEMPTY then we check if it is a Umsdos directory. We check if it is really empty (only . .. and --linux-.--- in it). If it is true we remove the EMD and do a msdos_rmdir() again.

In a Umsdos directory, we assume all subdirectory are also Umsdos directory, so we check the EMD file first.

[linux/fs/umsdos/namei.c,690]
#Specification: mkdir / umsdos directory / create EMD

When we created a new sub-directory in a UMSDOS directory (one with full UMSDOS semantic), we create immediately an EMD file in the new sub-directory so it inherit UMSDOS semantic.