file - filp_open not working with O_RDWR or O_WRONLY -


i trying use filp_open function within kernel open file under /proc/.../mynode. able open when use o_rdonly flag not work o_rdwr or o_wronly; infact breaks boot sequence of device.

does know issue is?

code:

struct file* file_open(const char* path, int flags, int rights) {     struct file* filp = null;     mm_segment_t oldfs;     int err = 0;     oldfs = get_fs();     set_fs(get_ds());      filp = filp_open(path, flags, rights);      set_fs(oldfs);     if(is_err(filp)) {         err = ptr_err(filp);         return null;     }     return filp; } 

i calling method so:

struct file *fp = null; fp = file_open("/proc/.../mynode", o_wronly,0); 

i not understand why're turning on address conversion before error checking. you've called filp_open in kernel address space(i assume get_ds takes there) , hence it's practice error checks in same space. might reason filp gets translated random address , why device boot sequence breaking. if issue persists after has been looked into, target file-sys might not having write permission on file.


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -