aboutsummaryrefslogtreecommitdiffstats
path: root/fs/udf/symlink.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/udf/symlink.c')
-rw-r--r--fs/udf/symlink.c56
1 files changed, 27 insertions, 29 deletions
diff --git a/fs/udf/symlink.c b/fs/udf/symlink.c
index 12613b680cc4..c4b82a920082 100644
--- a/fs/udf/symlink.c
+++ b/fs/udf/symlink.c
@@ -33,41 +33,40 @@
33#include <linux/buffer_head.h> 33#include <linux/buffer_head.h>
34#include "udf_i.h" 34#include "udf_i.h"
35 35
36static void udf_pc_to_char(struct super_block *sb, char *from, int fromlen, char *to) 36static void udf_pc_to_char(struct super_block *sb, char *from, int fromlen,
37 char *to)
37{ 38{
38 struct pathComponent *pc; 39 struct pathComponent *pc;
39 int elen = 0; 40 int elen = 0;
40 char *p = to; 41 char *p = to;
41 42
42 while (elen < fromlen) 43 while (elen < fromlen) {
43 {
44 pc = (struct pathComponent *)(from + elen); 44 pc = (struct pathComponent *)(from + elen);
45 switch (pc->componentType) 45 switch (pc->componentType) {
46 { 46 case 1:
47 case 1: 47 if (pc->lengthComponentIdent == 0) {
48 if (pc->lengthComponentIdent == 0) 48 p = to;
49 {
50 p = to;
51 *p++ = '/';
52 }
53 break;
54 case 3:
55 memcpy(p, "../", 3);
56 p += 3;
57 break;
58 case 4:
59 memcpy(p, "./", 2);
60 p += 2;
61 /* that would be . - just ignore */
62 break;
63 case 5:
64 p += udf_get_filename(sb, pc->componentIdent, p, pc->lengthComponentIdent);
65 *p++ = '/'; 49 *p++ = '/';
66 break; 50 }
51 break;
52 case 3:
53 memcpy(p, "../", 3);
54 p += 3;
55 break;
56 case 4:
57 memcpy(p, "./", 2);
58 p += 2;
59 /* that would be . - just ignore */
60 break;
61 case 5:
62 p += udf_get_filename(sb, pc->componentIdent, p,
63 pc->lengthComponentIdent);
64 *p++ = '/';
65 break;
67 } 66 }
68 elen += sizeof(struct pathComponent) + pc->lengthComponentIdent; 67 elen += sizeof(struct pathComponent) + pc->lengthComponentIdent;
69 } 68 }
70 if (p > to+1) 69 if (p > to + 1)
71 p[-1] = '\0'; 70 p[-1] = '\0';
72 else 71 else
73 p[0] = '\0'; 72 p[0] = '\0';
@@ -84,8 +83,7 @@ static int udf_symlink_filler(struct file *file, struct page *page)
84 lock_kernel(); 83 lock_kernel();
85 if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_IN_ICB) 84 if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_IN_ICB)
86 symlink = UDF_I_DATA(inode) + UDF_I_LENEATTR(inode); 85 symlink = UDF_I_DATA(inode) + UDF_I_LENEATTR(inode);
87 else 86 else {
88 {
89 bh = sb_bread(inode->i_sb, udf_block_map(inode, 0)); 87 bh = sb_bread(inode->i_sb, udf_block_map(inode, 0));
90 88
91 if (!bh) 89 if (!bh)
@@ -102,7 +100,7 @@ static int udf_symlink_filler(struct file *file, struct page *page)
102 kunmap(page); 100 kunmap(page);
103 unlock_page(page); 101 unlock_page(page);
104 return 0; 102 return 0;
105out: 103 out:
106 unlock_kernel(); 104 unlock_kernel();
107 SetPageError(page); 105 SetPageError(page);
108 kunmap(page); 106 kunmap(page);
@@ -114,5 +112,5 @@ out:
114 * symlinks can't do much... 112 * symlinks can't do much...
115 */ 113 */
116const struct address_space_operations udf_symlink_aops = { 114const struct address_space_operations udf_symlink_aops = {
117 .readpage = udf_symlink_filler, 115 .readpage = udf_symlink_filler,
118}; 116};