1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
4 * Copyright (C) 2004 Cluster File Systems, Inc.
6 * This file is part of Lustre, http://www.lustre.org.
8 * Lustre is free software; you can redistribute it and/or
9 * modify it under the terms of version 2 of the GNU General Public
10 * License as published by the Free Software Foundation.
12 * Lustre is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Lustre; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 #define DEBUG_SUBSYSTEM S_SM
25 #include <linux/kmod.h>
26 #include <linux/init.h>
28 #include <linux/slab.h>
29 #include <linux/string.h>
30 #include <linux/obd_class.h>
31 #include <linux/obd_support.h>
32 #include <linux/lustre_lib.h>
33 #include <linux/lustre_idl.h>
34 #include <linux/lustre_smfs.h>
36 #include "smfs_internal.h"
38 static int smfs_readlink(struct dentry *dentry, char *buffer, int buflen)
40 struct inode *cache_inode = I2CI(dentry->d_inode);
41 struct dentry *cache_dentry;
48 cache_dentry = pre_smfs_dentry(NULL, cache_inode, dentry);
50 GOTO(exit, rc = -ENOMEM);
51 if (cache_inode->i_op && cache_inode->i_op->readlink)
52 rc = cache_inode->i_op->readlink(cache_dentry, buffer, buflen);
55 post_smfs_dentry(cache_dentry);
59 static int smfs_follow_link(struct dentry *dentry, struct nameidata *nd)
61 struct inode *cache_inode = I2CI(dentry->d_inode);
62 struct dentry *cache_dentry;
69 cache_dentry = pre_smfs_dentry(NULL, cache_inode, dentry);
71 GOTO(exit, rc = -ENOMEM);
73 if (cache_inode->i_op && cache_inode->i_op->follow_link)
74 rc = cache_inode->i_op->follow_link(cache_dentry, nd);
76 post_smfs_dentry(cache_dentry);
80 struct inode_operations smfs_sym_iops = {
81 readlink: smfs_readlink,
82 follow_link: smfs_follow_link,
83 setxattr: smfs_setxattr, /* BKL held */
84 getxattr: smfs_getxattr, /* BKL held */
85 listxattr: smfs_listxattr, /* BKL held */
86 removexattr: smfs_removexattr, /* BKL held */
89 struct file_operations smfs_sym_fops = {