版權所有 © 2014 tutorialspoint
#include <sys/mount.h> int mount(const char *source, const char *target, const char *filesystemtype, unsigned long mountflags, const void *data); int umount(const char *target); int umount2(const char *target, int flags);
int mount(const char *source, const char *target, const char *filesystemtype, unsigned long mountflags, const void *data);
int umount(const char *target);
int umount2(const char *target, int flags);
umount() 和 umount2() 刪除掛載在target上的(最頂層)檔案系統的掛載。
掛載和解除安裝檔案系統需要適當的許可權(Linux:CAP_SYS_ADMIN 能力)。
從 Linux 2.4 開始,單個檔案系統可以在多個掛載點可見,並且可以在同一個掛載點上堆疊多個掛載。
核心支援的filesystemtype 引數的值列在/proc/filesystems 中(例如“minix”、“ext2”、“msdos”、“proc”、“nfs”、“iso9660”等)。當載入適當的模組時,可能會提供其他型別。
mountflags 引數的高 16 位可能包含魔數 0xC0ED(MS_MGC_VAL)(這在 2.4 之前的核心版本中是必需的,但現在不再需要,如果指定則會被忽略),低 16 位包含各種掛載標誌(如 <linux/fs.h>(對於 libc4 和 libc5)和 <sys/mount.h>(對於 glibc2)中定義的)。
可以更改以下mountflags:MS_RDONLY、MS_SYNCHRONOUS、MS_MANDLOCK;在核心 2.6.16 之前,還可以更改以下內容:MS_NOATIME 和MS_NODIRATIME;此外,在核心 2.4 之前,還可以更改以下內容:MS_NOSUID、MS_NODEV、MS_NOEXEC。
當將不同的 MS_SYNC 新增到 <mman.h> 時,原始的 MS_SYNC 標誌在 1.1.69 中重新命名為 MS_SYNCHRONOUS。
在 Linux 2.4 之前,嘗試在使用MS_NOSUID 掛載的檔案系統上執行 set-user-ID 或 set-group-ID 程式將以EPERM 失敗。從 Linux 2.4 開始,在這種情況下,set-user-ID 和 set-group-ID 位只是被靜默忽略。
path_resolution (2)
mount (8)
umount (8)
廣告