* Laboratoire MASI - Institut Blaise Pascal
* Universite Pierre et Marie Curie (Paris VI)
*
- * from
- *
- * linux/fs/minix/symlink.c
- *
* Copyright (C) 1991, 1992 Linus Torvalds
*
* ext2 symlink handling code
#include <linux/mm.h>
#include <linux/stat.h>
#include <linux/locks.h>
-#include <linux/obd_support.h> /* for ENTRY and EXIT only */
-#include <linux/obdfs.h>
-
-static int obdfs_fast_readlink(struct dentry *dentry, char *buffer, int buflen)
-{
- char *s = obdfs_i2info(dentry->d_inode)->oi_inline;
- return vfs_readlink(dentry, buffer, buflen, s);
-}
-static int obdfs_fast_follow_link(struct dentry *dentry, struct nameidata *nd)
-{
- char *s = obdfs_i2info(dentry->d_inode)->oi_inline;
- return vfs_follow_link(nd, s);
-}
+#define DEBUG_SUBSYSTEM S_LLITE
-extern int obdfs_setattr(struct dentry *de, struct iattr *attr);
-struct inode_operations obdfs_fast_symlink_inode_operations = {
- readlink: obdfs_fast_readlink,
- follow_link: obdfs_fast_follow_link,
- setattr: obdfs_setattr
-};
+#include <linux/obd_support.h> /* for ENTRY and EXIT only */
+#include <linux/lustre_lite.h>
-static int obdfs_readlink(struct dentry *dentry, char *buffer, int buflen)
+static int ll_readlink(struct dentry *dentry, char *buffer, int buflen)
{
- struct page *page = NULL;
- int res;
-
+ struct ll_sb_info *sbi = ll_i2sbi(dentry->d_inode);
+ struct ptlrpc_request *request;
+ char *tmp;
+ int rc, size;
ENTRY;
- OIDEBUG(dentry->d_inode);
- page = obdfs_getpage(dentry->d_inode, 0, 0, 0);
- /* PDEBUG(page, "readlink"); */
- if (!page) {
- EXIT;
- return 0;
+
+ rc = mdc_getattr(&sbi->ll_mdc_conn, dentry->d_inode->i_ino, S_IFLNK,
+ OBD_MD_LINKNAME, dentry->d_inode->i_size, &request);
+ if (rc) {
+ CERROR("failure %d inode %ld\n", rc,
+ (long)dentry->d_inode->i_ino);
+ ptlrpc_free_req(request);
+ RETURN(rc);
}
- res = vfs_readlink(dentry, buffer, buflen, (char *)page_address(page));
- page_cache_release(page);
- EXIT;
- return res;
-} /* obdfs_readlink */
-static int obdfs_follow_link(struct dentry * dentry,
- struct nameidata *nd)
-{
- struct page *page = NULL;
- int res;
+ tmp = lustre_msg_buf(request->rq_repmsg, 1);
+ size = MIN(request->rq_repmsg->buflens[1], buflen);
+ rc = copy_to_user(buffer, tmp, size);
+ if (rc == 0)
+ rc = size;
- ENTRY;
- OIDEBUG(dentry->d_inode);
- page = obdfs_getpage(dentry->d_inode, 0, 0, 0);
- /* PDEBUG(page, "follow_link"); */
- if (!page) {
- dput(nd->dentry);
- EXIT;
- return -EIO;
- }
- res = vfs_follow_link(nd, (char *)page_address(page));
- page_cache_release(page);
- EXIT;
- return res;
+ ptlrpc_free_req(request);
+ RETURN(rc);
}
-struct inode_operations obdfs_symlink_inode_operations = {
- readlink: obdfs_readlink,
- follow_link: obdfs_follow_link,
- setattr: obdfs_setattr
+extern int ll_setattr(struct dentry *de, struct iattr *attr);
+struct inode_operations ll_fast_symlink_inode_operations = {
+ readlink: ll_readlink,
+ setattr: ll_setattr
};