|
|
|
[PATCH 3/3] fs: make struct nameidata private to namei.c | |
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] | |
By moving nd_set_link and nd_get_link out of line we can hide the internals
of struct nameidata now.
Signed-off-by: Christoph Hellwig <hch@xxxxxx>
---
Documentation/filesystems/porting | 6 ++++++
fs/namei.c | 31 +++++++++++++++++++++++++++++++
include/linux/namei.h | 38 ++++++--------------------------------
3 files changed, 43 insertions(+), 32 deletions(-)
Index: linux-2.6/fs/namei.c
===================================================================
--- linux-2.6.orig/fs/namei.c 2012-06-18 15:15:13.000371564 +0200
+++ linux-2.6/fs/namei.c 2012-06-18 15:20:46.920380115 +0200
@@ -110,6 +110,25 @@
* any extra contention...
*/
+enum { MAX_NESTED_LINKS = 8 };
+
+/*
+ * Type of the last component on LOOKUP_PARENT
+ */
+enum {LAST_NORM, LAST_ROOT, LAST_DOT, LAST_DOTDOT, LAST_BIND};
+
+struct nameidata {
+ struct path path;
+ struct qstr last;
+ struct path root;
+ struct inode *inode; /* path.dentry.d_inode */
+ unsigned int flags;
+ unsigned seq;
+ int last_type;
+ unsigned depth;
+ char *saved_names[MAX_NESTED_LINKS + 1];
+};
+
/* In order to reduce some races, while at the same time doing additional
* checking and hopefully speeding things up, we copy filenames to the
* kernel data space before using them..
@@ -586,6 +605,18 @@ static inline void path_to_nameidata(con
nd->path.dentry = path->dentry;
}
+void nd_set_link(struct nameidata *nd, char *path)
+{
+ nd->saved_names[nd->depth] = path;
+}
+EXPORT_SYMBOL(nd_set_link);
+
+char *nd_get_link(struct nameidata *nd)
+{
+ return nd->saved_names[nd->depth];
+}
+EXPORT_SYMBOL(nd_get_link);
+
/*
* Helper to directly jump to a known parsed path from ->follow_link,
* caller must have taken a reference to path beforehand.
Index: linux-2.6/include/linux/namei.h
===================================================================
--- linux-2.6.orig/include/linux/namei.h 2012-06-18 15:15:13.000371564 +0200
+++ linux-2.6/include/linux/namei.h 2012-06-18 15:20:46.920380115 +0200
@@ -1,31 +1,13 @@
#ifndef _LINUX_NAMEI_H
#define _LINUX_NAMEI_H
-#include <linux/dcache.h>
-#include <linux/linkage.h>
-#include <linux/path.h>
+#include <linux/kernel.h>
+struct dentry;
+struct nameidata;
+struct path;
struct vfsmount;
-enum { MAX_NESTED_LINKS = 8 };
-
-struct nameidata {
- struct path path;
- struct qstr last;
- struct path root;
- struct inode *inode; /* path.dentry.d_inode */
- unsigned int flags;
- unsigned seq;
- int last_type;
- unsigned depth;
- char *saved_names[MAX_NESTED_LINKS + 1];
-};
-
-/*
- * Type of the last component on LOOKUP_PARENT
- */
-enum {LAST_NORM, LAST_ROOT, LAST_DOT, LAST_DOTDOT, LAST_BIND};
-
/*
* The bitmask for a lookup event:
* - follow links at the end
@@ -80,18 +62,10 @@ extern int follow_up(struct path *);
extern struct dentry *lock_rename(struct dentry *, struct dentry *);
extern void unlock_rename(struct dentry *, struct dentry *);
+extern void nd_set_link(struct nameidata *nd, char *path);
+extern char *nd_get_link(struct nameidata *nd);
extern void nd_jump_link(struct nameidata *nd, struct path *path);
-static inline void nd_set_link(struct nameidata *nd, char *path)
-{
- nd->saved_names[nd->depth] = path;
-}
-
-static inline char *nd_get_link(struct nameidata *nd)
-{
- return nd->saved_names[nd->depth];
-}
-
static inline void nd_terminate_link(void *name, size_t len, size_t maxlen)
{
((char *) name)[min(len, maxlen)] = '\0';
Index: linux-2.6/Documentation/filesystems/porting
===================================================================
--- linux-2.6.orig/Documentation/filesystems/porting 2012-06-18 15:15:13.000371564 +0200
+++ linux-2.6/Documentation/filesystems/porting 2012-06-18 15:20:46.920380115 +0200
@@ -442,3 +442,9 @@ d_make_root() drops the reference to ino
two, it gets "is it an O_EXCL or equivalent?" boolean argument. Note that
local filesystems can ignore tha argument - they are guaranteed that the
object doesn't exist. It's remote/distributed ones that might care...
+
+--
+[mandatory]
+ struct nameidata is private to fs/namei.c now. All ->follow_link
+ must now either use nd_set_link to set a link path to iterate on,
+ or nd_jump_link to jump to a pre-parsed struct path directly.
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
[Linux Ext4 Filesystem] [Ecryptfs] [AutoFS] [Kernel Newbies] [Share Photos] [Security] [Netfilter] [Bugtraq] [Photo] [Yosemite] [Yosemite News] [MIPS Linux] [ARM Linux] [Linux Security] [Linux Cachefs] [Reiser Filesystem] [Linux RAID] [Samba] [Video 4 Linux] [Device Mapper] [CEPH Filesystem]
![]() |