File tree Expand file tree Collapse file tree 1 file changed +8
-11
lines changed Expand file tree Collapse file tree 1 file changed +8
-11
lines changed Original file line number Diff line number Diff line change @@ -301,27 +301,24 @@ EXPORT_SYMBOL_GPL(ubi_open_volume_nm);
301
301
*/
302
302
struct ubi_volume_desc * ubi_open_volume_path (const char * pathname , int mode )
303
303
{
304
- int error , ubi_num , vol_id , mod ;
305
- struct inode * inode ;
306
- struct path path ;
304
+ int error , ubi_num , vol_id ;
305
+ struct kstat stat ;
307
306
308
307
dbg_gen ("open volume %s, mode %d" , pathname , mode );
309
308
310
309
if (!pathname || !* pathname )
311
310
return ERR_PTR (- EINVAL );
312
311
313
- error = kern_path (pathname , LOOKUP_FOLLOW , & path );
312
+ error = vfs_stat (pathname , & stat );
314
313
if (error )
315
314
return ERR_PTR (error );
316
315
317
- inode = d_backing_inode (path .dentry );
318
- mod = inode -> i_mode ;
319
- ubi_num = ubi_major2num (imajor (inode ));
320
- vol_id = iminor (inode ) - 1 ;
321
- path_put (& path );
322
-
323
- if (!S_ISCHR (mod ))
316
+ if (!S_ISCHR (stat .mode ))
324
317
return ERR_PTR (- EINVAL );
318
+
319
+ ubi_num = ubi_major2num (MAJOR (stat .rdev ));
320
+ vol_id = MINOR (stat .rdev ) - 1 ;
321
+
325
322
if (vol_id >= 0 && ubi_num >= 0 )
326
323
return ubi_open_volume (ubi_num , vol_id , mode );
327
324
return ERR_PTR (- ENODEV );
You can’t perform that action at this time.
0 commit comments