Mounting and Unmounting the Filesystem

The ux_read_super() function is called to mount a uxfs filesystem. This function is declared through the DECLARE_FSTYPE_DEV() macro and becomes known to the Linux kernel when the filesystem is registered. The code for this function can be found in ux_inode.c on lines 1240 to 1302.

The ux_read_super() function takes three arguments as shown in ux_inode.c on line 1234 and iterated below:

ux_read_super(struct super_block *s, void *data, int silent)

There is one super_block structure per mounted filesystem. One of the tasks to be performed by ux_read_super() is to initialize this structure by filling in the following fields:

s_magic. This field holds the magic number of the filesystem, which for uxfs is 0x58494e55. This field has little practical value.

s_blocksize. This field holds the filesystem block size, which in the case of uxfs is 512 bytes (UX_BSIZE).

s_op. This field holds the super_operations vector, a set of functions that either deal with the filesystem as a whole or allow inodes to be read, written, and deleted.

s_root. This field is set to reference the dentry for the root inode. This is described in more detail later.

The data argument is used by the kernel to pass any arguments that were passed to mount. At this stage, uxfs does not accept any command line arguments to mount, so this parameter is ignored. The silent argument, if set, allows the filesystem writer to display more detailed information when running. This allows debugging ...

Get UNIX Filesystems: Evolution, Design, and Implementation now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.