-/*
- * fs/snap/snap.c
+/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
+ * vim:expandtab:shiftwidth=8:tabstop=8:
*
- * A snap shot file system.
+ * lustre/smfs/symlink.c
+ * Lustre filesystem abstraction routines
*
+ * Copyright (C) 2002, 2003 Cluster File Systems, Inc.
+ *
+ * This file is part of Lustre, http://www.lustre.org.
+ *
+ * Lustre is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * Lustre is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Lustre; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#define DEBUG_SUBSYSTEM S_SNAP
+
+#define DEBUG_SUBSYSTEM S_SM
#include <linux/kmod.h>
#include <linux/init.h>
#include <linux/fs.h>
#include <linux/slab.h>
#include <linux/string.h>
+#include <linux/obd_class.h>
+#include <linux/obd_support.h>
+#include <linux/lustre_lib.h>
+#include <linux/lustre_idl.h>
+#include <linux/lustre_fsfilt.h>
+#include <linux/lustre_smfs.h>
+
+#include "smfs_internal.h"
+
+static int smfs_readlink(struct dentry *dentry, char *buffer, int buflen)
+{
+ struct inode *cache_inode = I2CI(dentry->d_inode);
+ struct dentry *cache_dentry;
+ int rc = 0;
+ ENTRY;
+
+ if (!cache_inode)
+ RETURN(-ENOENT);
+
+ cache_dentry = pre_smfs_dentry(NULL, cache_inode, dentry);
+ if (!cache_dentry)
+ GOTO(exit, rc = -ENOMEM);
+ if (cache_inode->i_op && cache_inode->i_op->readlink)
+ rc = cache_inode->i_op->readlink(cache_dentry, buffer, buflen);
+ GOTO(exit, rc);
+exit:
+ post_smfs_dentry(cache_dentry);
+ return rc;
+}
+
+static int smfs_follow_link(struct dentry *dentry, struct nameidata *nd)
+{
+ struct inode *cache_inode = I2CI(dentry->d_inode);
+ struct dentry *cache_dentry;
+ int rc = 0;
+ ENTRY;
+
+ if (!cache_inode)
+ RETURN(-ENOENT);
+
+ cache_dentry = pre_smfs_dentry(NULL, cache_inode, dentry);
+ if (!cache_dentry)
+ GOTO(exit, rc = -ENOMEM);
-#include "smfs_internal.h"
+ if (cache_inode->i_op && cache_inode->i_op->follow_link)
+ rc = cache_inode->i_op->follow_link(cache_dentry, nd);
+exit:
+ post_smfs_dentry(cache_dentry);
+ return rc;
+}
struct inode_operations smfs_sym_iops = {
+ readlink: smfs_readlink,
+ follow_link: smfs_follow_link,
+ setxattr: smfs_setxattr, /* BKL held */
+ getxattr: smfs_getxattr, /* BKL held */
+ listxattr: smfs_listxattr, /* BKL held */
+ removexattr: smfs_removexattr, /* BKL held */
};
struct file_operations smfs_sym_fops = {