2 * linux/fs/affs/symlink.c
4 * 1995 Hans-Joachim Widmaier - Modified for affs.
6 * Copyright (C) 1991, 1992 Linus Torvalds
8 * affs symlink handling code
11 #include <linux/errno.h>
13 #include <linux/stat.h>
14 #include <linux/affs_fs.h>
15 #include <linux/amigaffs.h>
16 #include <linux/pagemap.h>
17 #include <linux/smp_lock.h>
19 static int affs_symlink_readpage(struct file *file, struct page *page)
21 struct buffer_head *bh;
22 struct inode *inode = page->mapping->host;
23 char *link = kmap(page);
24 struct slink_front *lf;
31 pr_debug("AFFS: follow_link(ino=%lu)\n",inode->i_ino);
35 bh = affs_bread(inode->i_sb, inode->i_ino);
41 lf = (struct slink_front *)bh->b_data;
43 pf = inode->i_sb->u.affs_sb.s_prefix ? inode->i_sb->u.affs_sb.s_prefix : "/";
45 if (strchr(lf->symname,':')) { /* Handle assign or volume name */
46 while (i < 1023 && (c = pf[i]))
48 while (i < 1023 && lf->symname[j] != ':')
49 link[i++] = lf->symname[j++];
55 while (i < 1023 && (c = lf->symname[j])) {
56 if (c == '/' && lc == '/' && i < 1020) { /* parent dir */
68 SetPageUptodate(page);
79 struct address_space_operations affs_symlink_aops = {
80 readpage: affs_symlink_readpage,
83 struct inode_operations affs_symlink_inode_operations = {
84 readlink: page_readlink,
85 follow_link: page_follow_link,
86 setattr: affs_notify_change,