2005-04-16 15:20:36 -07:00
|
|
|
/*
|
|
|
|
* JFFS2 -- Journalling Flash File System, Version 2.
|
|
|
|
*
|
2007-04-25 06:16:47 -07:00
|
|
|
* Copyright © 2001-2007 Red Hat, Inc.
|
2005-04-16 15:20:36 -07:00
|
|
|
*
|
|
|
|
* Created by David Woodhouse <dwmw2@infradead.org>
|
|
|
|
*
|
|
|
|
* For licensing information, see the file 'LICENCE' in this directory.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2012-02-15 16:56:45 -07:00
|
|
|
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/fs.h>
|
|
|
|
#include <linux/namei.h>
|
|
|
|
#include "nodelist.h"
|
|
|
|
|
[PATCH] Fix up symlink function pointers
This fixes up the symlink functions for the calling convention change:
* afs, autofs4, befs, devfs, freevxfs, jffs2, jfs, ncpfs, procfs,
smbfs, sysvfs, ufs, xfs - prototype change for ->follow_link()
* befs, smbfs, xfs - same for ->put_link()
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-08-19 16:17:39 -07:00
|
|
|
static void *jffs2_follow_link(struct dentry *dentry, struct nameidata *nd);
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2007-02-12 01:55:39 -07:00
|
|
|
const struct inode_operations jffs2_symlink_inode_operations =
|
2005-11-07 04:16:07 -07:00
|
|
|
{
|
2005-04-16 15:20:36 -07:00
|
|
|
.readlink = generic_readlink,
|
|
|
|
.follow_link = jffs2_follow_link,
|
2011-07-23 08:37:31 -07:00
|
|
|
.get_acl = jffs2_get_acl,
|
2006-05-12 23:09:47 -07:00
|
|
|
.setattr = jffs2_setattr,
|
|
|
|
.setxattr = jffs2_setxattr,
|
|
|
|
.getxattr = jffs2_getxattr,
|
|
|
|
.listxattr = jffs2_listxattr,
|
|
|
|
.removexattr = jffs2_removexattr
|
2005-04-16 15:20:36 -07:00
|
|
|
};
|
|
|
|
|
[PATCH] Fix up symlink function pointers
This fixes up the symlink functions for the calling convention change:
* afs, autofs4, befs, devfs, freevxfs, jffs2, jfs, ncpfs, procfs,
smbfs, sysvfs, ufs, xfs - prototype change for ->follow_link()
* befs, smbfs, xfs - same for ->put_link()
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-08-19 16:17:39 -07:00
|
|
|
static void *jffs2_follow_link(struct dentry *dentry, struct nameidata *nd)
|
2005-04-16 15:20:36 -07:00
|
|
|
{
|
2005-03-01 03:50:52 -07:00
|
|
|
struct jffs2_inode_info *f = JFFS2_INODE_INFO(dentry->d_inode);
|
2005-07-17 04:13:51 -07:00
|
|
|
char *p = (char *)f->target;
|
|
|
|
|
2005-03-01 03:50:52 -07:00
|
|
|
/*
|
|
|
|
* We don't acquire the f->sem mutex here since the only data we
|
2005-07-17 04:13:51 -07:00
|
|
|
* use is f->target.
|
2005-03-01 03:50:52 -07:00
|
|
|
*
|
2005-07-17 04:13:51 -07:00
|
|
|
* 1. If we are here the inode has already built and f->target has
|
2005-03-01 03:50:52 -07:00
|
|
|
* to point to the target path.
|
2005-07-17 04:13:51 -07:00
|
|
|
* 2. Nobody uses f->target (if the inode is symlink's inode). The
|
|
|
|
* exception is inode freeing function which frees f->target. But
|
2005-03-01 03:50:52 -07:00
|
|
|
* it can't be called while we are here and before VFS has
|
2005-07-17 04:13:51 -07:00
|
|
|
* stopped using our f->target string which we provide by means of
|
2005-03-01 03:50:52 -07:00
|
|
|
* nd_set_link() call.
|
|
|
|
*/
|
2005-11-07 04:16:07 -07:00
|
|
|
|
2005-08-19 14:42:16 -07:00
|
|
|
if (!p) {
|
2012-02-15 16:56:44 -07:00
|
|
|
pr_err("%s(): can't find symlink target\n", __func__);
|
2005-08-19 14:42:16 -07:00
|
|
|
p = ERR_PTR(-EIO);
|
2005-03-01 03:50:52 -07:00
|
|
|
}
|
2012-02-15 16:56:43 -07:00
|
|
|
jffs2_dbg(1, "%s(): target path is '%s'\n",
|
|
|
|
__func__, (char *)f->target);
|
2005-03-01 03:50:52 -07:00
|
|
|
|
2005-08-19 14:42:16 -07:00
|
|
|
nd_set_link(nd, p);
|
2005-11-07 04:16:07 -07:00
|
|
|
|
2005-03-01 03:50:52 -07:00
|
|
|
/*
|
2005-07-17 04:13:51 -07:00
|
|
|
* 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.
|
2005-03-01 03:50:52 -07:00
|
|
|
*/
|
[PATCH] Fix up symlink function pointers
This fixes up the symlink functions for the calling convention change:
* afs, autofs4, befs, devfs, freevxfs, jffs2, jfs, ncpfs, procfs,
smbfs, sysvfs, ufs, xfs - prototype change for ->follow_link()
* befs, smbfs, xfs - same for ->put_link()
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-08-19 16:17:39 -07:00
|
|
|
return NULL;
|
2005-04-16 15:20:36 -07:00
|
|
|
}
|
|
|
|
|