我正在尝试在我的C++应用程序中挂载外部驱动器。我最初尝试使用mount(2),但是失败了:
int ret = mount(deviceName.c_str(), mountPoint.c_str(), fsType.c_str(), 0, NULL);
错误码是19,ENODEV
(文件系统类型在内核中未配置)
然而,如果我使用mount(8),它可以正常工作:
std::string cmd = "mount -t " + fsType + " " + deviceName + " " + mountPoint;
int ret = system(cmd.c_str());
mount(2)是否有不同的可接受文件系统类型列表?这是一个ntfs设备,所以我使用了ntfs-3g
作为fstype。我检查了/proc/filesystems,并没有看到它在列表中,所以我尝试了fuseblk
,但是出现了错误码22,EINVAL
。
使用mount(2)正确挂载NTFS设备的方法是什么?
libmount
,我会去看看的。 - jam