一、介绍
mount() 用于挂载Linux系统外的文件,如USB等
umount()和 umount2()移除挂载在target上的文件系统,说白了就是卸载,不过umount2可以指定一些控制操作的标志
二、接口函数
#include <sys/mount.h>
int mount(const char *source, const char *target,
const char *filesystemtype, unsigned long mountflags,
const void *data);
参数:
source: 需要被挂载路径
target: 挂载到的路径
filesystemtype: "minix","ext2", "ext3", "jfs", "xfs", "reiserfs", "msdos", "proc", "nfs", "iso9660","vfat","ubifs"等等
mountflags:
MS_BIND: 执行bind挂载,使文件子目录树在文件系统内的另一个点上可视,filesystemtype和data被忽略,2.6.26后此参数也可以忽略
MS_DIRSYNC: 同步目录的更新
MS_MANDLOCK: 允许对此文件系统中的文件进行强制锁定
MS_MOVE: 移动子目