大师们好,
我在开发板上调试一个操作U盘的程序,在C代码中通过调用system函数来执行mount命令,代码如下
system("mount -o sync /dev/sda1 /mnt/sda1");
命令能够被执行,但程序运行完毕后通过df命令查看U盘空间时,提示Input/output error,
此时通过dmesg可以看到
attempt to access beyond end of device
sda: rw=2, want=29775, limit=8064
attempt to access beyond end of device
sda: rw=2, want=29776, limit=8064
attempt to access beyond end of device
sda: rw=0, want=29769, limit=8064
FAT: Directory bread(block 29640) failed
attempt to access beyond end of device
sda: rw=0, want=29770, limit=8064
FAT: Directory bread(block 29641) failed
attempt to access beyond end of device
sda: rw=0, want=29771, limit=8064
FAT: Directory bread(block 29642) failed
这样的错误信息。
这个时候在终端中再手动输入同样的mount命令并执行后,df就可以显示U盘的空间信息了。
想请教各位大师,导致这一现象可能的原因是什么?在程序中执行mount命令,与在终端中手动输入执行mount命令,有什么区别?
非常感谢。