NEXT UP previous
Next: umount System Call

mount System Call

Remember that physical disks are very often split into separate partitions and that each partition has a filesystem recorded on it. Each of these filesystems may be mounted into the directory hierarchy, and thus become a part of it. This filesystem mount operation is performed by use of the mount command, which itself uses an underlying mount() system call:

	#include <sys/mount.h>

	int mount(char *fspath, char *dir, char *fstype,
				unsigned long flags, void *data);

It is unusual to want to call the mount() system call directly, especially as it can only be used by the root user.

The fspath parameter is the pathname to the disk partition whose filesystem you wish to mount (e.g. /dev/hdb2) dir gives the directory over which the filesystem is to be mounted. The fstype parameter specifies what filesystem type is on the disk partition (e.g. second extended, mmix or DOS), flags specifies how the filesystem is to be mounted (e.g. read-only or read-write) and data is a pointer to an arbitrary structure of information whose contents (or even existence) depend on the particular filesystem type to he mounted.


NEXT UP previous
Next: umount System Call