aboutsummaryrefslogtreecommitdiffstats
path: root/fs/namei.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2009-08-13 12:40:45 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2009-12-16 12:16:45 -0500
commit2dd6d1f41852bbb1f66d66b3634ddfdaeddcf9bc (patch)
tree82a4e934af91a28fb2be1501b9b5392b892f40e7 /fs/namei.c
parent3cac260ad88f4e37637d6e4b33e6a6a849d273c7 (diff)
Kill path_lookup_open()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/namei.c')
-rw-r--r--fs/namei.c48
1 files changed, 16 insertions, 32 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 6ce27d6db684..b2b22f244180 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1124,36 +1124,6 @@ int vfs_path_lookup(struct dentry *dentry, struct vfsmount *mnt,
1124 return retval; 1124 return retval;
1125} 1125}
1126 1126
1127/**
1128 * path_lookup_open - lookup a file path with open intent
1129 * @dfd: the directory to use as base, or AT_FDCWD
1130 * @name: pointer to file name
1131 * @lookup_flags: lookup intent flags
1132 * @nd: pointer to nameidata
1133 * @open_flags: open intent flags
1134 */
1135static int path_lookup_open(int dfd, const char *name,
1136 unsigned int lookup_flags, struct nameidata *nd, int open_flags)
1137{
1138 struct file *filp = get_empty_filp();
1139 int err;
1140
1141 if (filp == NULL)
1142 return -ENFILE;
1143 nd->intent.open.file = filp;
1144 nd->intent.open.flags = open_flags;
1145 nd->intent.open.create_mode = 0;
1146 err = do_path_lookup(dfd, name, lookup_flags|LOOKUP_OPEN, nd);
1147 if (IS_ERR(nd->intent.open.file)) {
1148 if (err == 0) {
1149 err = PTR_ERR(nd->intent.open.file);
1150 path_put(&nd->path);
1151 }
1152 } else if (err != 0)
1153 release_open_intent(nd);
1154 return err;
1155}
1156
1157static struct dentry *__lookup_hash(struct qstr *name, 1127static struct dentry *__lookup_hash(struct qstr *name,
1158 struct dentry *base, struct nameidata *nd) 1128 struct dentry *base, struct nameidata *nd)
1159{ 1129{
@@ -1664,8 +1634,22 @@ struct file *do_filp_open(int dfd, const char *pathname,
1664 * The simplest case - just a plain lookup. 1634 * The simplest case - just a plain lookup.
1665 */ 1635 */
1666 if (!(flag & O_CREAT)) { 1636 if (!(flag & O_CREAT)) {
1667 error = path_lookup_open(dfd, pathname, lookup_flags(flag), 1637 filp = get_empty_filp();
1668 &nd, flag); 1638
1639 if (filp == NULL)
1640 return ERR_PTR(-ENFILE);
1641 nd.intent.open.file = filp;
1642 nd.intent.open.flags = flag;
1643 nd.intent.open.create_mode = 0;
1644 error = do_path_lookup(dfd, pathname,
1645 lookup_flags(flag)|LOOKUP_OPEN, &nd);
1646 if (IS_ERR(nd.intent.open.file)) {
1647 if (error == 0) {
1648 error = PTR_ERR(nd.intent.open.file);
1649 path_put(&nd.path);
1650 }
1651 } else if (error)
1652 release_open_intent(&nd);
1669 if (error) 1653 if (error)
1670 return ERR_PTR(error); 1654 return ERR_PTR(error);
1671 goto ok; 1655 goto ok;