5 * Symlink handling routines for the OSTA-UDF(tm) filesystem.
8 * E-mail regarding any portion of the Linux UDF file system should be
9 * directed to the development team mailing list (run by majordomo):
10 * linux_udf@hpesjro.fc.hp.com
13 * This file is distributed under the terms of the GNU General Public
14 * License (GPL). Copies of the GPL can be obtained from:
15 * ftp://prep.ai.mit.edu/pub/gnu/GPL
16 * Each contributing author retains all rights to their own work.
18 * (C) 1998-2001 Ben Fennema
19 * (C) 1999 Stelias Computing Inc
23 * 04/16/99 blf Created.
28 #include <asm/uaccess.h>
29 #include <linux/errno.h>
31 #include <linux/udf_fs.h>
32 #include <linux/time.h>
34 #include <linux/stat.h>
35 #include <linux/slab.h>
36 #include <linux/pagemap.h>
37 #include <linux/smp_lock.h>
38 #include <linux/buffer_head.h>
41 static void udf_pc_to_char(struct super_block *sb, char *from, int fromlen, char *to)
43 struct pathComponent *pc;
47 while (elen < fromlen)
49 pc = (struct pathComponent *)(from + elen);
50 switch (pc->componentType)
53 if (pc->lengthComponentIdent == 0)
66 /* that would be . - just ignore */
69 p += udf_get_filename(sb, pc->componentIdent, p, pc->lengthComponentIdent);
73 elen += sizeof(struct pathComponent) + pc->lengthComponentIdent;
81 static int udf_symlink_filler(struct file *file, struct page *page)
83 struct inode *inode = page->mapping->host;
84 struct buffer_head *bh = NULL;
90 if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_IN_ICB)
91 symlink = UDF_I_DATA(inode) + UDF_I_LENEATTR(inode);
94 bh = sb_bread(inode->i_sb, udf_block_map(inode, 0));
102 udf_pc_to_char(inode->i_sb, symlink, inode->i_size, p);
103 udf_release_data(bh);
106 SetPageUptodate(page);
119 * symlinks can't do much...
121 struct address_space_operations udf_symlink_aops = {
122 .readpage = udf_symlink_filler,