2016-07-30 56 views
0

我想在Linux的C程序中安装100 MB的tmpfs。 系统调用如何通过安装选项(即-o size = 100M,mode = 0755)到安装如何将选项传递给挂载系统调用?

这是对C的支架接口:

#include <sys/mount.h> 

int mount(const char *source, const char *target, 
      const char *filesystemtype, unsigned long mountflags, 
      const void *data); 

回答

0

阅读mount(2)手册页,似乎是文件系统的独立选项在mountflags给出不同的标志的组合,而在data其它文件系统特定的选项,逗号正如它们在mount(8)中使用的字符串一样。

所以你的情况只是通过这些选项字符串:

const char *data = "size=100M,mode=0755"; 
... 
mount(source, target, filesystemtype, mountflags, data); 
+0

谢谢你的回答。我通过数据发送了文件系统选项,但是我找不到我的tmpfs。我可以在我的程序之外使用这个分区吗? – SAP

+0

看看这个地址:http://stackoverflow.com/questions/32814782/mount-system-call-in-linux-cannot-display-the-mountpoint-of-file-system-by-df-co – SAP

相关问题