20.5 smount (6086)

6093:

“getmdev” decodes the first argument to locate a block oriented access device;

6096:

“u.u_dirp” is reset preparatory to calling “namei” to decode the second file name. (Note that “u.u_dirp” is set by “trap” to “u.u_arg[0]” (2770);

6100:

Check that the file named by the second parameter is in a satisfactory condition, i.e. no one else is currently accessing the file, and that the file is not a special file (block or character);

6103:

Search the “mount” table looking for an empty entry (“mp-$>$m bufp==NULL”) or an entry already made for the device. (The “mount” data structure is defined at line 0272);

6111:

“smp” should point to a suitable entry in the “mount” table;

6113:

Perform the appropriate “open” routine, with the device name and a read/write flag as arguments. (As was seen earlier, for the RK05 disk the “open” routine is a “no-op”);

6116:

Read block #1 from the device. This block is the “super block”;

6124:

Copy the “super block” into a buffer associated with “NODEV”, from the buffer associated with “d”. The second buffer will not be released again until the device is unmounted;

6130:

“ip” points to the “inode” for the second named file. This “inode” is now flagged as “IMOUNT”. The effect of this is to force “iget” (7292) to ignore the normal contents of the file, while the file system volume is mounted. (In practice, the second file is an empty file created especially for this purpose.)