Skip to content

Commit 322ea0b

Browse files
author
Al Viro
committed
mtd: switch ubi_open_volume_path() to vfs_stat()
Signed-off-by: Al Viro <[email protected]>
1 parent 87f15d4 commit 322ea0b

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

drivers/mtd/ubi/kapi.c

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -301,27 +301,24 @@ EXPORT_SYMBOL_GPL(ubi_open_volume_nm);
301301
*/
302302
struct ubi_volume_desc *ubi_open_volume_path(const char *pathname, int mode)
303303
{
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;
307306

308307
dbg_gen("open volume %s, mode %d", pathname, mode);
309308

310309
if (!pathname || !*pathname)
311310
return ERR_PTR(-EINVAL);
312311

313-
error = kern_path(pathname, LOOKUP_FOLLOW, &path);
312+
error = vfs_stat(pathname, &stat);
314313
if (error)
315314
return ERR_PTR(error);
316315

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))
324317
return ERR_PTR(-EINVAL);
318+
319+
ubi_num = ubi_major2num(MAJOR(stat.rdev));
320+
vol_id = MINOR(stat.rdev) - 1;
321+
325322
if (vol_id >= 0 && ubi_num >= 0)
326323
return ubi_open_volume(ubi_num, vol_id, mode);
327324
return ERR_PTR(-ENODEV);

0 commit comments

Comments
 (0)