1b2441318SGreg Kroah-Hartman// SPDX-License-Identifier: GPL-2.0
21da177e4SLinus Torvalds/*
31da177e4SLinus Torvalds * Symlink inode operations for Coda filesystem
41da177e4SLinus Torvalds * Original version: (C) 1996 P. Braam and M. Callahan
51da177e4SLinus Torvalds * Rewritten for Linux 2.1. (C) 1997 Carnegie Mellon University
61da177e4SLinus Torvalds *
71da177e4SLinus Torvalds * Carnegie Mellon encourages users to contribute improvements to
81da177e4SLinus Torvalds * the Coda project. Contact Peter Braam (coda@cs.cmu.edu).
91da177e4SLinus Torvalds */
101da177e4SLinus Torvalds
111da177e4SLinus Torvalds#include <linux/types.h>
121da177e4SLinus Torvalds#include <linux/kernel.h>
131da177e4SLinus Torvalds#include <linux/time.h>
141da177e4SLinus Torvalds#include <linux/fs.h>
151da177e4SLinus Torvalds#include <linux/stat.h>
161da177e4SLinus Torvalds#include <linux/errno.h>
171da177e4SLinus Torvalds#include <linux/pagemap.h>
181da177e4SLinus Torvalds
191da177e4SLinus Torvalds#include <linux/coda.h>
208fc8b9dfSDavid Howells#include "coda_psdev.h"
2131a203dfSAl Viro#include "coda_linux.h"
221da177e4SLinus Torvalds
231da177e4SLinus Torvaldsstatic int coda_symlink_filler(struct file *file, struct page *page)
241da177e4SLinus Torvalds{
251da177e4SLinus Torvalds	struct inode *inode = page->mapping->host;
261da177e4SLinus Torvalds	int error;
271da177e4SLinus Torvalds	struct coda_inode_info *cii;
281da177e4SLinus Torvalds	unsigned int len = PAGE_SIZE;
2921fc61c7SAl Viro	char *p = page_address(page);
301da177e4SLinus Torvalds
311da177e4SLinus Torvalds	cii = ITOC(inode);
321da177e4SLinus Torvalds
331da177e4SLinus Torvalds	error = venus_readlink(inode->i_sb, &cii->c_fid, p, &len);
341da177e4SLinus Torvalds	if (error)
351da177e4SLinus Torvalds		goto fail;
361da177e4SLinus Torvalds	SetPageUptodate(page);
371da177e4SLinus Torvalds	unlock_page(page);
381da177e4SLinus Torvalds	return 0;
391da177e4SLinus Torvalds
401da177e4SLinus Torvaldsfail:
411da177e4SLinus Torvalds	SetPageError(page);
421da177e4SLinus Torvalds	unlock_page(page);
431da177e4SLinus Torvalds	return error;
441da177e4SLinus Torvalds}
451da177e4SLinus Torvalds
46f5e54d6eSChristoph Hellwigconst struct address_space_operations coda_symlink_aops = {
471da177e4SLinus Torvalds	.readpage	= coda_symlink_filler,
481da177e4SLinus Torvalds};
49