^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Symlink inode operations for Coda filesystem
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * Original version: (C) 1996 P. Braam and M. Callahan
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Rewritten for Linux 2.1. (C) 1997 Carnegie Mellon University
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) * Carnegie Mellon encourages users to contribute improvements to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) * the Coda project. Contact Peter Braam (coda@cs.cmu.edu).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/time.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <linux/fs.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <linux/stat.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include <linux/errno.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include <linux/pagemap.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #include <linux/coda.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #include "coda_psdev.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #include "coda_linux.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) static int coda_symlink_filler(struct file *file, struct page *page)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) struct inode *inode = page->mapping->host;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) int error;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) struct coda_inode_info *cii;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) unsigned int len = PAGE_SIZE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) char *p = page_address(page);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) cii = ITOC(inode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) error = venus_readlink(inode->i_sb, &cii->c_fid, p, &len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) if (error)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) goto fail;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) SetPageUptodate(page);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) unlock_page(page);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) fail:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) SetPageError(page);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) unlock_page(page);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) return error;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) const struct address_space_operations coda_symlink_aops = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) .readpage = coda_symlink_filler,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) };