From: Jeff Layton <jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: viro-3bDd1+5oDREiFSDQTTA3OLVCufUGDwFn@public.gmane.org
Cc: linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-nfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
michael.brantley-Iq/kdjr4a97QT0dZR+AlfA@public.gmane.org,
hch-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org,
miklos-sUDqSbJrdHQHWmgEVkV9KA@public.gmane.org,
pstaubach-83r9SdEf25FBDgjK7y7TUQ@public.gmane.org
Subject: [PATCH v4 02/17] vfs: add a kern_path_at function
Date: Thu, 26 Jul 2012 07:55:05 -0400 [thread overview]
Message-ID: <1343303720-11199-3-git-send-email-jlayton@redhat.com> (raw)
In-Reply-To: <1343303720-11199-1-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
This will function like user_path_at, but does not do the getname and
putname, leaving that to the caller.
Signed-off-by: Jeff Layton <jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
fs/namei.c | 27 +++++++++++++++++++--------
include/linux/namei.h | 1 +
2 files changed, 20 insertions(+), 8 deletions(-)
diff --git a/fs/namei.c b/fs/namei.c
index 3580d47..b6fbe3d 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1974,20 +1974,31 @@ struct dentry *lookup_one_len(const char *name, struct dentry *base, int len)
return __lookup_hash(&this, base, 0);
}
+int kern_path_at(int dfd, const char *name, unsigned flags, struct path *path)
+{
+ struct nameidata nd;
+ int err;
+
+ BUG_ON(flags & LOOKUP_PARENT);
+
+ err = do_path_lookup(dfd, name, flags, &nd);
+ if (!err)
+ *path = nd.path;
+
+ return err;
+}
+
int user_path_at_empty(int dfd, const char __user *name, unsigned flags,
struct path *path, int *empty)
{
- struct nameidata nd;
char *tmp = getname_flags(name, flags, empty);
- int err = PTR_ERR(tmp);
- if (!IS_ERR(tmp)) {
-
- BUG_ON(flags & LOOKUP_PARENT);
+ int err;
- err = do_path_lookup(dfd, tmp, flags, &nd);
+ if (IS_ERR(tmp)) {
+ err = PTR_ERR(tmp);
+ } else {
+ err = kern_path_at(dfd, tmp, flags, path);
putname(tmp);
- if (!err)
- *path = nd.path;
}
return err;
}
diff --git a/include/linux/namei.h b/include/linux/namei.h
index d2ef8b3..002dc55 100644
--- a/include/linux/namei.h
+++ b/include/linux/namei.h
@@ -55,6 +55,7 @@ enum {LAST_NORM, LAST_ROOT, LAST_DOT, LAST_DOTDOT, LAST_BIND};
#define LOOKUP_ROOT 0x2000
#define LOOKUP_EMPTY 0x4000
+extern int kern_path_at(int, const char *, unsigned, struct path *);
extern int user_path_at(int, const char __user *, unsigned, struct path *);
extern int user_path_at_empty(int, const char __user *, unsigned, struct path *, int *empty);
--
1.7.11.2
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2012-07-26 11:55 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-26 11:55 [PATCH v4 00/17] vfs: add the ability to retry on ESTALE to several syscalls Jeff Layton
2012-07-26 11:55 ` [PATCH v4 01/17] vfs: add a retry_estale helper function to handle retries on ESTALE Jeff Layton
[not found] ` <1343303720-11199-1-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2012-07-26 11:55 ` Jeff Layton [this message]
2012-07-26 11:55 ` [PATCH v4 15/17] vfs: remove user_path_parent Jeff Layton
2012-07-26 11:55 ` [PATCH v4 17/17] vfs: have faccessat retry once on an ESTALE error Jeff Layton
2012-07-26 11:55 ` [PATCH v4 03/17] vfs: make fstatat retry on ESTALE errors from getattr call Jeff Layton
2012-07-26 11:55 ` [PATCH v4 04/17] vfs: fix readlinkat to retry on ESTALE Jeff Layton
2012-07-26 11:55 ` [PATCH v4 05/17] vfs: remove user_path_at_empty Jeff Layton
2012-07-26 11:55 ` [PATCH v4 06/17] vfs: turn "empty" arg in getname_flags into a bool Jeff Layton
2012-07-26 11:55 ` [PATCH v4 07/17] vfs: add new "reval" argument to kern_path_create Jeff Layton
2012-07-26 11:55 ` [PATCH v4 08/17] vfs: fix mknodat to retry on ESTALE errors Jeff Layton
2012-07-26 11:55 ` [PATCH v4 09/17] vfs: fix mkdir " Jeff Layton
2012-07-26 11:55 ` [PATCH v4 10/17] vfs: fix symlinkat " Jeff Layton
2012-07-26 11:55 ` [PATCH v4 11/17] vfs: fix linkat " Jeff Layton
2012-07-26 11:55 ` [PATCH v4 12/17] vfs: make rmdir " Jeff Layton
2012-07-26 11:55 ` [PATCH v4 13/17] vfs: make do_unlinkat " Jeff Layton
2012-07-26 11:55 ` [PATCH v4 14/17] vfs: fix renameat to " Jeff Layton
2012-07-26 11:55 ` [PATCH v4 16/17] vfs: have do_sys_truncate retry once on an ESTALE error Jeff Layton
2012-07-27 2:15 ` [PATCH v4 00/17] vfs: add the ability to retry on ESTALE to several syscalls Namjae Jeon
[not found] ` <CAKYAXd99VMYSX=k9eadB6MZvjQjQrOngOjUicjo+c9LtHvpz9w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-07-27 10:56 ` Jeff Layton
[not found] ` <20120727065630.0a3c5870-9yPaYZwiELC+kQycOl6kW4xkIHaj4LzF@public.gmane.org>
2012-08-01 1:52 ` Namjae Jeon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1343303720-11199-3-git-send-email-jlayton@redhat.com \
--to=jlayton-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
--cc=hch-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org \
--cc=linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-nfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=michael.brantley-Iq/kdjr4a97QT0dZR+AlfA@public.gmane.org \
--cc=miklos-sUDqSbJrdHQHWmgEVkV9KA@public.gmane.org \
--cc=pstaubach-83r9SdEf25FBDgjK7y7TUQ@public.gmane.org \
--cc=viro-3bDd1+5oDREiFSDQTTA3OLVCufUGDwFn@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).