ia64/linux-2.6.18-xen.hg

annotate fs/jffs2/symlink.c @ 524:7f8b544237bf

netfront: Allow netfront in domain 0.

This is useful if your physical network device is in a utility domain.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Apr 15 15:18:58 2008 +0100 (2008-04-15)
parents 831230e53067
children
rev   line source
ian@0 1 /*
ian@0 2 * JFFS2 -- Journalling Flash File System, Version 2.
ian@0 3 *
ian@0 4 * Copyright (C) 2001, 2002 Red Hat, Inc.
ian@0 5 *
ian@0 6 * Created by David Woodhouse <dwmw2@infradead.org>
ian@0 7 *
ian@0 8 * For licensing information, see the file 'LICENCE' in this directory.
ian@0 9 *
ian@0 10 * $Id: symlink.c,v 1.19 2005/11/07 11:14:42 gleixner Exp $
ian@0 11 *
ian@0 12 */
ian@0 13
ian@0 14
ian@0 15 #include <linux/kernel.h>
ian@0 16 #include <linux/slab.h>
ian@0 17 #include <linux/fs.h>
ian@0 18 #include <linux/namei.h>
ian@0 19 #include "nodelist.h"
ian@0 20
ian@0 21 static void *jffs2_follow_link(struct dentry *dentry, struct nameidata *nd);
ian@0 22
ian@0 23 struct inode_operations jffs2_symlink_inode_operations =
ian@0 24 {
ian@0 25 .readlink = generic_readlink,
ian@0 26 .follow_link = jffs2_follow_link,
ian@0 27 .permission = jffs2_permission,
ian@0 28 .setattr = jffs2_setattr,
ian@0 29 .setxattr = jffs2_setxattr,
ian@0 30 .getxattr = jffs2_getxattr,
ian@0 31 .listxattr = jffs2_listxattr,
ian@0 32 .removexattr = jffs2_removexattr
ian@0 33 };
ian@0 34
ian@0 35 static void *jffs2_follow_link(struct dentry *dentry, struct nameidata *nd)
ian@0 36 {
ian@0 37 struct jffs2_inode_info *f = JFFS2_INODE_INFO(dentry->d_inode);
ian@0 38 char *p = (char *)f->target;
ian@0 39
ian@0 40 /*
ian@0 41 * We don't acquire the f->sem mutex here since the only data we
ian@0 42 * use is f->target.
ian@0 43 *
ian@0 44 * 1. If we are here the inode has already built and f->target has
ian@0 45 * to point to the target path.
ian@0 46 * 2. Nobody uses f->target (if the inode is symlink's inode). The
ian@0 47 * exception is inode freeing function which frees f->target. But
ian@0 48 * it can't be called while we are here and before VFS has
ian@0 49 * stopped using our f->target string which we provide by means of
ian@0 50 * nd_set_link() call.
ian@0 51 */
ian@0 52
ian@0 53 if (!p) {
ian@0 54 printk(KERN_ERR "jffs2_follow_link(): can't find symlink taerget\n");
ian@0 55 p = ERR_PTR(-EIO);
ian@0 56 }
ian@0 57 D1(printk(KERN_DEBUG "jffs2_follow_link(): target path is '%s'\n", (char *) f->target));
ian@0 58
ian@0 59 nd_set_link(nd, p);
ian@0 60
ian@0 61 /*
ian@0 62 * We will unlock the f->sem mutex but VFS will use the f->target string. This is safe
ian@0 63 * since the only way that may cause f->target to be changed is iput() operation.
ian@0 64 * But VFS will not use f->target after iput() has been called.
ian@0 65 */
ian@0 66 return NULL;
ian@0 67 }
ian@0 68