2 * JFFS2 -- Journalling Flash File System, Version 2.
4 * Copyright (C) 2001, 2002 Red Hat, Inc.
6 * Created by David Woodhouse <dwmw2@cambridge.redhat.com>
8 * The original JFFS, from which the design for JFFS2 was derived,
9 * was designed and implemented by Axis Communications AB.
11 * The contents of this file are subject to the Red Hat eCos Public
12 * License Version 1.1 (the "Licence"); you may not use this file
13 * except in compliance with the Licence. You may obtain a copy of
14 * the Licence at http://www.redhat.com/
16 * Software distributed under the Licence is distributed on an "AS IS"
17 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
18 * See the Licence for the specific language governing rights and
19 * limitations under the Licence.
21 * The Original Code is JFFS2 - Journalling Flash File System, version 2
23 * Alternatively, the contents of this file may be used under the
24 * terms of the GNU General Public License version 2 (the "GPL"), in
25 * which case the provisions of the GPL are applicable instead of the
26 * above. If you wish to allow the use of your version of this file
27 * only under the terms of the GPL and not to allow others to use your
28 * version of this file under the RHEPL, indicate your decision by
29 * deleting the provisions above and replace them with the notice and
30 * other provisions required by the GPL. If you do not delete the
31 * provisions above, a recipient may use your version of this file
32 * under either the RHEPL or the GPL.
34 * $Id: symlink.c,v 1.1.1.1 2005/04/11 02:50:46 jack Exp $
39 #include <linux/kernel.h>
40 #include <linux/slab.h>
42 #include <linux/jffs2.h>
45 int jffs2_readlink(struct dentry *dentry, char *buffer, int buflen);
46 int jffs2_follow_link(struct dentry *dentry, struct nameidata *nd);
48 struct inode_operations jffs2_symlink_inode_operations =
50 readlink: jffs2_readlink,
51 follow_link: jffs2_follow_link,
52 setattr: jffs2_setattr
55 static char *jffs2_getlink(struct dentry *dentry)
57 struct jffs2_inode_info *f = JFFS2_INODE_INFO(dentry->d_inode);
64 printk(KERN_NOTICE "No metadata for symlink inode #%lu\n", dentry->d_inode->i_ino);
65 return ERR_PTR(-EINVAL);
67 buf = kmalloc(f->metadata->size+1, GFP_USER);
70 return ERR_PTR(-ENOMEM);
72 buf[f->metadata->size]=0;
74 ret = jffs2_read_dnode(JFFS2_SB_INFO(dentry->d_inode->i_sb), f->metadata, buf, 0, f->metadata->size);
83 int jffs2_readlink(struct dentry *dentry, char *buffer, int buflen)
88 kbuf = jffs2_getlink(dentry);
92 ret = vfs_readlink(dentry, buffer, buflen, kbuf);
97 int jffs2_follow_link(struct dentry *dentry, struct nameidata *nd)
102 buf = jffs2_getlink(dentry);
107 ret = vfs_follow_link(nd, buf);