aboutsummaryrefslogtreecommitdiffstats
path: root/fs/isofs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/isofs')
-rw-r--r--fs/isofs/rock.c39
1 files changed, 22 insertions, 17 deletions
diff --git a/fs/isofs/rock.c b/fs/isofs/rock.c
index 283e92197bb1..aafe356ec1b7 100644
--- a/fs/isofs/rock.c
+++ b/fs/isofs/rock.c
@@ -37,18 +37,23 @@ static int check_sp(struct rock_ridge *rr, struct inode *inode)
37 return 0; 37 return 0;
38} 38}
39 39
40#define SETUP_ROCK_RIDGE(DE,CHR,LEN) \ 40static void setup_rock_ridge(struct iso_directory_record *de,
41 {LEN= sizeof(struct iso_directory_record) + DE->name_len[0]; \ 41 struct inode *inode, unsigned char **chr, int *len)
42 if(LEN & 1) LEN++; \ 42{
43 CHR = ((unsigned char *) DE) + LEN; \ 43 *len = sizeof(struct iso_directory_record) + de->name_len[0];
44 LEN = *((unsigned char *) DE) - LEN; \ 44 if (*len & 1)
45 if (LEN<0) LEN=0; \ 45 (*len)++;
46 if (ISOFS_SB(inode->i_sb)->s_rock_offset!=-1) \ 46 *chr = (unsigned char *)de + *len;
47 { \ 47 *len = *((unsigned char *)de) - *len;
48 LEN-=ISOFS_SB(inode->i_sb)->s_rock_offset; \ 48 if (*len < 0)
49 CHR+=ISOFS_SB(inode->i_sb)->s_rock_offset; \ 49 *len = 0;
50 if (LEN<0) LEN=0; \ 50
51 } \ 51 if (ISOFS_SB(inode->i_sb)->s_rock_offset != -1) {
52 *len -= ISOFS_SB(inode->i_sb)->s_rock_offset;
53 *chr += ISOFS_SB(inode->i_sb)->s_rock_offset;
54 if (*len < 0)
55 *len = 0;
56 }
52} 57}
53 58
54#define MAYBE_CONTINUE(LABEL,DEV) \ 59#define MAYBE_CONTINUE(LABEL,DEV) \
@@ -98,7 +103,7 @@ int get_rock_ridge_filename(struct iso_directory_record *de,
98 return 0; 103 return 0;
99 *retname = 0; 104 *retname = 0;
100 105
101 SETUP_ROCK_RIDGE(de, chr, len); 106 setup_rock_ridge(de, inode, &chr, &len);
102repeat: 107repeat:
103 108
104 while (len > 2) { /* There may be one byte for padding somewhere */ 109 while (len > 2) { /* There may be one byte for padding somewhere */
@@ -188,7 +193,7 @@ parse_rock_ridge_inode_internal(struct iso_directory_record *de,
188 if (!ISOFS_SB(inode->i_sb)->s_rock) 193 if (!ISOFS_SB(inode->i_sb)->s_rock)
189 return 0; 194 return 0;
190 195
191 SETUP_ROCK_RIDGE(de, chr, len); 196 setup_rock_ridge(de, inode, &chr, &len);
192 if (regard_xa) { 197 if (regard_xa) {
193 chr += 14; 198 chr += 14;
194 len -= 14; 199 len -= 14;
@@ -527,7 +532,7 @@ static int rock_ridge_symlink_readpage(struct file *file, struct page *page)
527 struct buffer_head *bh; 532 struct buffer_head *bh;
528 char *rpnt = link; 533 char *rpnt = link;
529 unsigned char *pnt; 534 unsigned char *pnt;
530 struct iso_directory_record *raw_inode; 535 struct iso_directory_record *raw_de;
531 int cont_extent = 0; 536 int cont_extent = 0;
532 int cont_offset = 0; 537 int cont_offset = 0;
533 int cont_size = 0; 538 int cont_size = 0;
@@ -550,7 +555,7 @@ static int rock_ridge_symlink_readpage(struct file *file, struct page *page)
550 offset = ei->i_iget5_offset; 555 offset = ei->i_iget5_offset;
551 pnt = (unsigned char *)bh->b_data + offset; 556 pnt = (unsigned char *)bh->b_data + offset;
552 557
553 raw_inode = (struct iso_directory_record *)pnt; 558 raw_de = (struct iso_directory_record *)pnt;
554 559
555 /* 560 /*
556 * If we go past the end of the buffer, there is some sort of error. 561 * If we go past the end of the buffer, there is some sort of error.
@@ -561,7 +566,7 @@ static int rock_ridge_symlink_readpage(struct file *file, struct page *page)
561 /* Now test for possible Rock Ridge extensions which will override 566 /* Now test for possible Rock Ridge extensions which will override
562 some of these numbers in the inode structure. */ 567 some of these numbers in the inode structure. */
563 568
564 SETUP_ROCK_RIDGE(raw_inode, chr, len); 569 setup_rock_ridge(raw_de, inode, &chr, &len);
565 570
566repeat: 571repeat:
567 while (len > 2) { /* There may be one byte for padding somewhere */ 572 while (len > 2) { /* There may be one byte for padding somewhere */