From 9ca8dbcc65cfc63d6f5ef3312a33184e1d726e00 Mon Sep 17 00:00:00 2001 From: Yunhong Jiang Date: Tue, 4 Aug 2015 12:17:53 -0700 Subject: Add the rt linux 4.1.3-rt3 as base Import the rt linux 4.1.3-rt3 as OPNFV kvm base. It's from git://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git linux-4.1.y-rt and the base is: commit 0917f823c59692d751951bf5ea699a2d1e2f26a2 Author: Sebastian Andrzej Siewior Date: Sat Jul 25 12:13:34 2015 +0200 Prepare v4.1.3-rt3 Signed-off-by: Sebastian Andrzej Siewior We lose all the git history this way and it's not good. We should apply another opnfv project repo in future. Change-Id: I87543d81c9df70d99c5001fbdf646b202c19f423 Signed-off-by: Yunhong Jiang --- kernel/fs/jffs2/symlink.c | 66 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 kernel/fs/jffs2/symlink.c (limited to 'kernel/fs/jffs2/symlink.c') diff --git a/kernel/fs/jffs2/symlink.c b/kernel/fs/jffs2/symlink.c new file mode 100644 index 000000000..1fefa25d0 --- /dev/null +++ b/kernel/fs/jffs2/symlink.c @@ -0,0 +1,66 @@ +/* + * JFFS2 -- Journalling Flash File System, Version 2. + * + * Copyright © 2001-2007 Red Hat, Inc. + * + * Created by David Woodhouse + * + * For licensing information, see the file 'LICENCE' in this directory. + * + */ + +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + +#include +#include +#include +#include "nodelist.h" + +static void *jffs2_follow_link(struct dentry *dentry, struct nameidata *nd); + +const struct inode_operations jffs2_symlink_inode_operations = +{ + .readlink = generic_readlink, + .follow_link = jffs2_follow_link, + .setattr = jffs2_setattr, + .setxattr = jffs2_setxattr, + .getxattr = jffs2_getxattr, + .listxattr = jffs2_listxattr, + .removexattr = jffs2_removexattr +}; + +static void *jffs2_follow_link(struct dentry *dentry, struct nameidata *nd) +{ + struct jffs2_inode_info *f = JFFS2_INODE_INFO(d_inode(dentry)); + char *p = (char *)f->target; + + /* + * We don't acquire the f->sem mutex here since the only data we + * use is f->target. + * + * 1. If we are here the inode has already built and f->target has + * to point to the target path. + * 2. Nobody uses f->target (if the inode is symlink's inode). The + * exception is inode freeing function which frees f->target. But + * it can't be called while we are here and before VFS has + * stopped using our f->target string which we provide by means of + * nd_set_link() call. + */ + + if (!p) { + pr_err("%s(): can't find symlink target\n", __func__); + p = ERR_PTR(-EIO); + } + jffs2_dbg(1, "%s(): target path is '%s'\n", + __func__, (char *)f->target); + + nd_set_link(nd, p); + + /* + * We will unlock the f->sem mutex but VFS will use the f->target string. This is safe + * since the only way that may cause f->target to be changed is iput() operation. + * But VFS will not use f->target after iput() has been called. + */ + return NULL; +} + -- cgit 1.2.3-korg