1 // SPDX-License-Identifier: GPL-2.0
3 * linux/fs/affs/symlink.c
5 * 1995 Hans-Joachim Widmaier - Modified for affs.
7 * Copyright (C) 1991, 1992 Linus Torvalds
9 * affs symlink handling code
14 static int affs_symlink_read_folio(struct file *file, struct folio *folio)
16 struct buffer_head *bh;
17 struct inode *inode = folio->mapping->host;
18 char *link = folio_address(folio);
19 struct slink_front *lf;
24 pr_debug("get_link(ino=%lu)\n", inode->i_ino);
26 bh = affs_bread(inode->i_sb, inode->i_ino);
31 lf = (struct slink_front *)bh->b_data;
34 if (strchr(lf->symname,':')) { /* Handle assign or volume name */
35 struct affs_sb_info *sbi = AFFS_SB(inode->i_sb);
37 spin_lock(&sbi->symlink_lock);
38 pf = sbi->s_prefix ? sbi->s_prefix : "/";
39 while (i < 1023 && (c = pf[i]))
41 spin_unlock(&sbi->symlink_lock);
42 while (i < 1023 && lf->symname[j] != ':')
43 link[i++] = lf->symname[j++];
49 while (i < 1023 && (c = lf->symname[j])) {
50 if (c == '/' && lc == '/' && i < 1020) { /* parent dir */
60 folio_mark_uptodate(folio);
68 const struct address_space_operations affs_symlink_aops = {
69 .read_folio = affs_symlink_read_folio,
72 const struct inode_operations affs_symlink_inode_operations = {
73 .get_link = page_get_link,
74 .setattr = affs_notify_change,