aboutsummaryrefslogtreecommitdiffstats
path: root/fs/block_dev.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-10-23 13:22:40 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-10-23 13:22:40 -0400
commit5ed487bc2c44ca4e9668ef9cb54c830e2a9fac47 (patch)
treeaf19ed28db83e8f52690872ac99336da1cf2fd3b /fs/block_dev.c
parent5b34653963de7a6d0d8c783527457d68fddc60fb (diff)
parentfd217f4d70172c526478f2bc76859e909fdfa674 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6: (46 commits) [PATCH] fs: add a sanity check in d_free [PATCH] i_version: remount support [patch] vfs: make security_inode_setattr() calling consistent [patch 1/3] FS_MBCACHE: don't needlessly make it built-in [PATCH] move executable checking into ->permission() [PATCH] fs/dcache.c: update comment of d_validate() [RFC PATCH] touch_mnt_namespace when the mount flags change [PATCH] reiserfs: add missing llseek method [PATCH] fix ->llseek for more directories [PATCH vfs-2.6 6/6] vfs: add LOOKUP_RENAME_TARGET intent [PATCH vfs-2.6 5/6] vfs: remove LOOKUP_PARENT from non LOOKUP_PARENT lookup [PATCH vfs-2.6 4/6] vfs: remove unnecessary fsnotify_d_instantiate() [PATCH vfs-2.6 3/6] vfs: add __d_instantiate() helper [PATCH vfs-2.6 2/6] vfs: add d_ancestor() [PATCH vfs-2.6 1/6] vfs: replace parent == dentry->d_parent by IS_ROOT() [PATCH] get rid of on-stack dentry in udf [PATCH 2/2] anondev: switch to IDA [PATCH 1/2] anondev: init IDR statically [JFFS2] Use d_splice_alias() not d_add() in jffs2_lookup() [PATCH] Optimise NFS readdir hack slightly. ...
Diffstat (limited to 'fs/block_dev.c')
-rw-r--r--fs/block_dev.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/fs/block_dev.c b/fs/block_dev.c
index 218408eed1bb..d06fe3c3dd3f 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -1268,33 +1268,33 @@ EXPORT_SYMBOL(ioctl_by_bdev);
1268 * namespace if possible and return it. Return ERR_PTR(error) 1268 * namespace if possible and return it. Return ERR_PTR(error)
1269 * otherwise. 1269 * otherwise.
1270 */ 1270 */
1271struct block_device *lookup_bdev(const char *path) 1271struct block_device *lookup_bdev(const char *pathname)
1272{ 1272{
1273 struct block_device *bdev; 1273 struct block_device *bdev;
1274 struct inode *inode; 1274 struct inode *inode;
1275 struct nameidata nd; 1275 struct path path;
1276 int error; 1276 int error;
1277 1277
1278 if (!path || !*path) 1278 if (!pathname || !*pathname)
1279 return ERR_PTR(-EINVAL); 1279 return ERR_PTR(-EINVAL);
1280 1280
1281 error = path_lookup(path, LOOKUP_FOLLOW, &nd); 1281 error = kern_path(pathname, LOOKUP_FOLLOW, &path);
1282 if (error) 1282 if (error)
1283 return ERR_PTR(error); 1283 return ERR_PTR(error);
1284 1284
1285 inode = nd.path.dentry->d_inode; 1285 inode = path.dentry->d_inode;
1286 error = -ENOTBLK; 1286 error = -ENOTBLK;
1287 if (!S_ISBLK(inode->i_mode)) 1287 if (!S_ISBLK(inode->i_mode))
1288 goto fail; 1288 goto fail;
1289 error = -EACCES; 1289 error = -EACCES;
1290 if (nd.path.mnt->mnt_flags & MNT_NODEV) 1290 if (path.mnt->mnt_flags & MNT_NODEV)
1291 goto fail; 1291 goto fail;
1292 error = -ENOMEM; 1292 error = -ENOMEM;
1293 bdev = bd_acquire(inode); 1293 bdev = bd_acquire(inode);
1294 if (!bdev) 1294 if (!bdev)
1295 goto fail; 1295 goto fail;
1296out: 1296out:
1297 path_put(&nd.path); 1297 path_put(&path);
1298 return bdev; 1298 return bdev;
1299fail: 1299fail:
1300 bdev = ERR_PTR(error); 1300 bdev = ERR_PTR(error);