LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1018|回复: 1

请教filp_open的一个问题

[复制链接]
发表于 2006-7-7 14:51:06 | 显示全部楼层 |阅读模式
所涉及到的代码2.6.11/drivers/usb/gadget/file_storage.c 一个关于设备端驱动的代码

其中filp_open的时候出错,提示unable to open file

该file创建过程如下:
[root@Bill ~]vi /root/back_file
[root@Bill ~]dd bs=1M count=8 if=/dev/zero of=/root/back_file
[root@Bill ~]fdisk -S 8 -H 16 -C 128 /root/disk
Above is from llinux-usb.org/gadget/file_storage.html
then
[root@Bill ~]chmod 777 /root/back_file

请问这个错误是怎么回事呢?? 谢谢

相关代码如下
/*ro=0,filename=/root/back_file*/
static int open_backing_file(.............)
{
.......
.......
/* R/W if we can, R/O if we must */
ro = curlun->ro;
if (!ro) { /*ro=0*/
filp = filp_open(filename, O_RDWR | O_LARGEFILE, 0);
if (-EROFS == PTR_ERR(filp))
ro = 1;
}
if (ro)
filp = filp_open(filename, O_RDONLY | O_LARGEFILE, 0);
if (IS_ERR(filp)) {
LINFO(curlun, "unable to open backing file: %s\n", filename);/***/
return PTR_ERR(filp);
}
本人目前想把板子上的FLASH模拟成U盘,在主机上可以识别,可是g_file_storage驱动总是弄不好,作成模块时候insert error 编译进内核又出这样的错误。有没有谁以前做过这样的工作的??
我用的是linux 2.6.11的内核,emdoor pxa27x的扳子。
发表于 2006-7-7 18:06:53 | 显示全部楼层
不知道是我不懂还是你的问题描述的不清楚!
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表