在内核创建文件filp_open
时间:10-02
整理:3721RD
点击:
我在内核中打开文件是总是失败,创建文件也是失败,请教下大神这是为什么呢?
struct file *filp;
filename ="/sdcard/bld/offset"
filp=filp_open(filename,O_RDWR,0);if (IS_ERR(filp)){
printk("open error %s\n",filename);
filp=filp_open(filename,O_RDWR|O_CREAT,0);
if (IS_ERR(filp)){
printk("create error %s\n",filename);
return;
}
}
struct file *filp;
filename ="/sdcard/bld/offset"
filp=filp_open(filename,O_RDWR,0);if (IS_ERR(filp)){
printk("open error %s\n",filename);
filp=filp_open(filename,O_RDWR|O_CREAT,0);
if (IS_ERR(filp)){
printk("create error %s\n",filename);
return;
}
}