1, Mount example
Mount (/dev/hdb1 to/home/xpl) A. to mount a new device, you must create a superblock first. Use file_system_type of the file system to be mounted and call get_sb () to create a new super blockb. create vfsmountfor/dev/hdb1 and add to current EMC. new vfsmount:-mountpoint the dentry-mnt_root for xpl points to the vfsmount where/home/xpl is located for the root dentry-mnt_parent on the hdb1 Device
2, mount_hashtable table,
The vfsmount structure of the file system mounted under the mountpoint directory is determined based on the calculation hash value of the vfsmount struct to which the dentry and mountpoint belong.
3. Linux Mount command
Detailed description of the mount command
Command Format:
Mount [-T vfstype] [-O options] device dir
1.-T vfstype specifies the type of the file system, which is usually not required. Mount automatically selects the correct type. Common types include:
CD or CD image: iso9660
Mount Windows File network sharing: smbfs
Network Sharing for Unix (Linux) files: NFS
2.-O options is used to describe the mounting method of a device or file. Common parameters include:
Loop: used to connect a file to the system as a hard disk partition.
RO: mounting a device in read-only mode
RW: mounting a device in read/write mode
3. the device to be mounted.
4. mount point of the Dir device on the system ).
Supplement:
Mount-A [-T type] [-O optlist] will mount all the devices listed in/etc/fstab (unless explicitly marked as "noauto ), if both device (or label, UUID, partuuid, partlabel) and Dir are provided, mount will not read the settings in/etc/fstab.
Only the root user can mount the file system. However, if the fstab contains the "user" option, all users can mount the file system. For example, if fstab contains the following rows:
/Dev/CDROM/CD iso9660 Ro, user, noauto, unhide
If the "user" option is used for a file system, only users who have mounted the file system can uninstall the system. If you want to allow uninstallation by any other user, you can use "users" instead of "user.
Init. the mount command in RC is stored in Alps/system/CORE/init/builtins. the do_mount () function in the C file is parsed. In the following example, the initial permission of all files in the/mnt/OBB/directory is or, which is expressed in octal, GID is the group to which the left and right files belong.
4. unmount system call:
Int umount (const char * target );
Int umount2 (const char * target, int flags );
Flags mainly includes the following:
Mnt_force: even if the mounted file system is in the busy state, it is forcibly uninstalled, which may cause data loss.
Mnt_detach: If this parameter is set for a function execution, the umount operation is not performed immediately, but will not be uninstalled until the mount point is out of the busy state. However, this function prevents new access to this mount point. Previously, the access to this mount point will not force it to exit, but will wait for it to exit naturally.
Mnt_expire: Set the mount point to obsolete. If the file system to be detached is the root file system or mnt_force or mnt_detach is set at the same time,-einval is returned;
Umount_nofollow: It indicates that if the target is a symbolic link, it cannot be referenced.
[File System] File System Study Notes (11) -- Mount System Call (Others)