aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/isofs/rock.c647
1 files changed, 356 insertions, 291 deletions
diff --git a/fs/isofs/rock.c b/fs/isofs/rock.c
index 089e79c65585..bbc348f0189a 100644
--- a/fs/isofs/rock.c
+++ b/fs/isofs/rock.c
@@ -20,8 +20,7 @@
20 * returns a symbolic link name, and a fourth one returns the extent number 20 * returns a symbolic link name, and a fourth one returns the extent number
21 * for the file. */ 21 * for the file. */
22 22
23#define SIG(A,B) ((A) | ((B) << 8)) /* isonum_721() */ 23#define SIG(A,B) ((A) | ((B) << 8)) /* isonum_721() */
24
25 24
26/* This is a way of ensuring that we have something in the system 25/* This is a way of ensuring that we have something in the system
27 use fields that is compatible with Rock Ridge */ 26 use fields that is compatible with Rock Ridge */
@@ -54,7 +53,7 @@
54 CHR+=ISOFS_SB(inode->i_sb)->s_rock_offset; \ 53 CHR+=ISOFS_SB(inode->i_sb)->s_rock_offset; \
55 if (LEN<0) LEN=0; \ 54 if (LEN<0) LEN=0; \
56 } \ 55 } \
57} 56}
58 57
59#define MAYBE_CONTINUE(LABEL,DEV) \ 58#define MAYBE_CONTINUE(LABEL,DEV) \
60 {if (buffer) { kfree(buffer); buffer = NULL; } \ 59 {if (buffer) { kfree(buffer); buffer = NULL; } \
@@ -85,280 +84,348 @@
85 }} 84 }}
86 85
87/* return length of name field; 0: not found, -1: to be ignored */ 86/* return length of name field; 0: not found, -1: to be ignored */
88int get_rock_ridge_filename(struct iso_directory_record * de, 87int get_rock_ridge_filename(struct iso_directory_record *de,
89 char * retname, struct inode * inode) 88 char *retname, struct inode *inode)
90{ 89{
91 int len; 90 int len;
92 unsigned char * chr; 91 unsigned char *chr;
93 CONTINUE_DECLS; 92 CONTINUE_DECLS;
94 int retnamlen = 0, truncate=0; 93 int retnamlen = 0, truncate = 0;
95
96 if (!ISOFS_SB(inode->i_sb)->s_rock) return 0;
97 *retname = 0;
98
99 SETUP_ROCK_RIDGE(de, chr, len);
100 repeat:
101 {
102 struct rock_ridge * rr;
103 int sig;
104
105 while (len > 2){ /* There may be one byte for padding somewhere */
106 rr = (struct rock_ridge *) chr;
107 if (rr->len < 3) goto out; /* Something got screwed up here */
108 sig = isonum_721(chr);
109 chr += rr->len;
110 len -= rr->len;
111 if (len < 0) goto out; /* corrupted isofs */
112
113 switch(sig){
114 case SIG('R','R'):
115 if((rr->u.RR.flags[0] & RR_NM) == 0) goto out;
116 break;
117 case SIG('S','P'):
118 CHECK_SP(goto out);
119 break;
120 case SIG('C','E'):
121 CHECK_CE;
122 break;
123 case SIG('N','M'):
124 if (truncate) break;
125 if (rr->len < 5) break;
126 /*
127 * If the flags are 2 or 4, this indicates '.' or '..'.
128 * We don't want to do anything with this, because it
129 * screws up the code that calls us. We don't really
130 * care anyways, since we can just use the non-RR
131 * name.
132 */
133 if (rr->u.NM.flags & 6) {
134 break;
135 }
136 94
137 if (rr->u.NM.flags & ~1) { 95 if (!ISOFS_SB(inode->i_sb)->s_rock)
138 printk("Unsupported NM flag settings (%d)\n",rr->u.NM.flags); 96 return 0;
139 break; 97 *retname = 0;
140 } 98
141 if((strlen(retname) + rr->len - 5) >= 254) { 99 SETUP_ROCK_RIDGE(de, chr, len);
142 truncate = 1; 100 repeat:
143 break; 101 {
102 struct rock_ridge *rr;
103 int sig;
104
105 while (len > 2) { /* There may be one byte for padding somewhere */
106 rr = (struct rock_ridge *)chr;
107 if (rr->len < 3)
108 goto out; /* Something got screwed up here */
109 sig = isonum_721(chr);
110 chr += rr->len;
111 len -= rr->len;
112 if (len < 0)
113 goto out; /* corrupted isofs */
114
115 switch (sig) {
116 case SIG('R', 'R'):
117 if ((rr->u.RR.flags[0] & RR_NM) == 0)
118 goto out;
119 break;
120 case SIG('S', 'P'):
121 CHECK_SP(goto out);
122 break;
123 case SIG('C', 'E'):
124 CHECK_CE;
125 break;
126 case SIG('N', 'M'):
127 if (truncate)
128 break;
129 if (rr->len < 5)
130 break;
131 /*
132 * If the flags are 2 or 4, this indicates '.' or '..'.
133 * We don't want to do anything with this, because it
134 * screws up the code that calls us. We don't really
135 * care anyways, since we can just use the non-RR
136 * name.
137 */
138 if (rr->u.NM.flags & 6) {
139 break;
140 }
141
142 if (rr->u.NM.flags & ~1) {
143 printk
144 ("Unsupported NM flag settings (%d)\n",
145 rr->u.NM.flags);
146 break;
147 }
148 if ((strlen(retname) + rr->len - 5) >= 254) {
149 truncate = 1;
150 break;
151 }
152 strncat(retname, rr->u.NM.name, rr->len - 5);
153 retnamlen += rr->len - 5;
154 break;
155 case SIG('R', 'E'):
156 if (buffer)
157 kfree(buffer);
158 return -1;
159 default:
160 break;
161 }
162 }
144 } 163 }
145 strncat(retname, rr->u.NM.name, rr->len - 5); 164 MAYBE_CONTINUE(repeat, inode);
146 retnamlen += rr->len - 5; 165 if (buffer)
147 break; 166 kfree(buffer);
148 case SIG('R','E'): 167 return retnamlen; /* If 0, this file did not have a NM field */
149 if (buffer) kfree(buffer); 168 out:
150 return -1; 169 if (buffer)
151 default: 170 kfree(buffer);
152 break; 171 return 0;
153 }
154 }
155 }
156 MAYBE_CONTINUE(repeat,inode);
157 if (buffer) kfree(buffer);
158 return retnamlen; /* If 0, this file did not have a NM field */
159 out:
160 if(buffer) kfree(buffer);
161 return 0;
162} 172}
163 173
164static int 174static int
165parse_rock_ridge_inode_internal(struct iso_directory_record *de, 175parse_rock_ridge_inode_internal(struct iso_directory_record *de,
166 struct inode *inode, int regard_xa) 176 struct inode *inode, int regard_xa)
167{ 177{
168 int len; 178 int len;
169 unsigned char * chr; 179 unsigned char *chr;
170 int symlink_len = 0; 180 int symlink_len = 0;
171 CONTINUE_DECLS; 181 CONTINUE_DECLS;
172 182
173 if (!ISOFS_SB(inode->i_sb)->s_rock) return 0; 183 if (!ISOFS_SB(inode->i_sb)->s_rock)
174 184 return 0;
175 SETUP_ROCK_RIDGE(de, chr, len); 185
176 if (regard_xa) 186 SETUP_ROCK_RIDGE(de, chr, len);
177 { 187 if (regard_xa) {
178 chr+=14; 188 chr += 14;
179 len-=14; 189 len -= 14;
180 if (len<0) len=0; 190 if (len < 0)
181 } 191 len = 0;
182 192 }
183 repeat: 193
184 { 194 repeat:
185 int cnt, sig; 195 {
186 struct inode * reloc; 196 int cnt, sig;
187 struct rock_ridge * rr; 197 struct inode *reloc;
188 int rootflag; 198 struct rock_ridge *rr;
189 199 int rootflag;
190 while (len > 2){ /* There may be one byte for padding somewhere */ 200
191 rr = (struct rock_ridge *) chr; 201 while (len > 2) { /* There may be one byte for padding somewhere */
192 if (rr->len < 3) goto out; /* Something got screwed up here */ 202 rr = (struct rock_ridge *)chr;
193 sig = isonum_721(chr); 203 if (rr->len < 3)
194 chr += rr->len; 204 goto out; /* Something got screwed up here */
195 len -= rr->len; 205 sig = isonum_721(chr);
196 if (len < 0) goto out; /* corrupted isofs */ 206 chr += rr->len;
197 207 len -= rr->len;
198 switch(sig){ 208 if (len < 0)
209 goto out; /* corrupted isofs */
210
211 switch (sig) {
199#ifndef CONFIG_ZISOFS /* No flag for SF or ZF */ 212#ifndef CONFIG_ZISOFS /* No flag for SF or ZF */
200 case SIG('R','R'): 213 case SIG('R', 'R'):
201 if((rr->u.RR.flags[0] & 214 if ((rr->u.RR.flags[0] &
202 (RR_PX | RR_TF | RR_SL | RR_CL)) == 0) goto out; 215 (RR_PX | RR_TF | RR_SL | RR_CL)) == 0)
203 break; 216 goto out;
217 break;
204#endif 218#endif
205 case SIG('S','P'): 219 case SIG('S', 'P'):
206 CHECK_SP(goto out); 220 CHECK_SP(goto out);
207 break; 221 break;
208 case SIG('C','E'): 222 case SIG('C', 'E'):
209 CHECK_CE; 223 CHECK_CE;
210 break; 224 break;
211 case SIG('E','R'): 225 case SIG('E', 'R'):
212 ISOFS_SB(inode->i_sb)->s_rock = 1; 226 ISOFS_SB(inode->i_sb)->s_rock = 1;
213 printk(KERN_DEBUG "ISO 9660 Extensions: "); 227 printk(KERN_DEBUG "ISO 9660 Extensions: ");
214 { int p; 228 {
215 for(p=0;p<rr->u.ER.len_id;p++) printk("%c",rr->u.ER.data[p]); 229 int p;
216 } 230 for (p = 0; p < rr->u.ER.len_id; p++)
217 printk("\n"); 231 printk("%c", rr->u.ER.data[p]);
218 break; 232 }
219 case SIG('P','X'): 233 printk("\n");
220 inode->i_mode = isonum_733(rr->u.PX.mode); 234 break;
221 inode->i_nlink = isonum_733(rr->u.PX.n_links); 235 case SIG('P', 'X'):
222 inode->i_uid = isonum_733(rr->u.PX.uid); 236 inode->i_mode = isonum_733(rr->u.PX.mode);
223 inode->i_gid = isonum_733(rr->u.PX.gid); 237 inode->i_nlink = isonum_733(rr->u.PX.n_links);
224 break; 238 inode->i_uid = isonum_733(rr->u.PX.uid);
225 case SIG('P','N'): 239 inode->i_gid = isonum_733(rr->u.PX.gid);
226 { int high, low; 240 break;
227 high = isonum_733(rr->u.PN.dev_high); 241 case SIG('P', 'N'):
228 low = isonum_733(rr->u.PN.dev_low); 242 {
229 /* 243 int high, low;
230 * The Rock Ridge standard specifies that if sizeof(dev_t) <= 4, 244 high = isonum_733(rr->u.PN.dev_high);
231 * then the high field is unused, and the device number is completely 245 low = isonum_733(rr->u.PN.dev_low);
232 * stored in the low field. Some writers may ignore this subtlety, 246 /*
233 * and as a result we test to see if the entire device number is 247 * The Rock Ridge standard specifies that if sizeof(dev_t) <= 4,
234 * stored in the low field, and use that. 248 * then the high field is unused, and the device number is completely
235 */ 249 * stored in the low field. Some writers may ignore this subtlety,
236 if((low & ~0xff) && high == 0) { 250 * and as a result we test to see if the entire device number is
237 inode->i_rdev = MKDEV(low >> 8, low & 0xff); 251 * stored in the low field, and use that.
238 } else { 252 */
239 inode->i_rdev = MKDEV(high, low); 253 if ((low & ~0xff) && high == 0) {
240 } 254 inode->i_rdev =
241 } 255 MKDEV(low >> 8, low & 0xff);
242 break; 256 } else {
243 case SIG('T','F'): 257 inode->i_rdev =
244 /* Some RRIP writers incorrectly place ctime in the TF_CREATE field. 258 MKDEV(high, low);
245 Try to handle this correctly for either case. */ 259 }
246 cnt = 0; /* Rock ridge never appears on a High Sierra disk */ 260 }
247 if(rr->u.TF.flags & TF_CREATE) { 261 break;
248 inode->i_ctime.tv_sec = iso_date(rr->u.TF.times[cnt++].time, 0); 262 case SIG('T', 'F'):
249 inode->i_ctime.tv_nsec = 0; 263 /* Some RRIP writers incorrectly place ctime in the TF_CREATE field.
250 } 264 Try to handle this correctly for either case. */
251 if(rr->u.TF.flags & TF_MODIFY) { 265 cnt = 0; /* Rock ridge never appears on a High Sierra disk */
252 inode->i_mtime.tv_sec = iso_date(rr->u.TF.times[cnt++].time, 0); 266 if (rr->u.TF.flags & TF_CREATE) {
253 inode->i_mtime.tv_nsec = 0; 267 inode->i_ctime.tv_sec =
254 } 268 iso_date(rr->u.TF.times[cnt++].time,
255 if(rr->u.TF.flags & TF_ACCESS) { 269 0);
256 inode->i_atime.tv_sec = iso_date(rr->u.TF.times[cnt++].time, 0); 270 inode->i_ctime.tv_nsec = 0;
257 inode->i_atime.tv_nsec = 0; 271 }
258 } 272 if (rr->u.TF.flags & TF_MODIFY) {
259 if(rr->u.TF.flags & TF_ATTRIBUTES) { 273 inode->i_mtime.tv_sec =
260 inode->i_ctime.tv_sec = iso_date(rr->u.TF.times[cnt++].time, 0); 274 iso_date(rr->u.TF.times[cnt++].time,
261 inode->i_ctime.tv_nsec = 0; 275 0);
262 } 276 inode->i_mtime.tv_nsec = 0;
263 break; 277 }
264 case SIG('S','L'): 278 if (rr->u.TF.flags & TF_ACCESS) {
265 {int slen; 279 inode->i_atime.tv_sec =
266 struct SL_component * slp; 280 iso_date(rr->u.TF.times[cnt++].time,
267 struct SL_component * oldslp; 281 0);
268 slen = rr->len - 5; 282 inode->i_atime.tv_nsec = 0;
269 slp = &rr->u.SL.link; 283 }
270 inode->i_size = symlink_len; 284 if (rr->u.TF.flags & TF_ATTRIBUTES) {
271 while (slen > 1){ 285 inode->i_ctime.tv_sec =
272 rootflag = 0; 286 iso_date(rr->u.TF.times[cnt++].time,
273 switch(slp->flags &~1){ 287 0);
274 case 0: 288 inode->i_ctime.tv_nsec = 0;
275 inode->i_size += slp->len; 289 }
276 break; 290 break;
277 case 2: 291 case SIG('S', 'L'):
278 inode->i_size += 1; 292 {
279 break; 293 int slen;
280 case 4: 294 struct SL_component *slp;
281 inode->i_size += 2; 295 struct SL_component *oldslp;
282 break; 296 slen = rr->len - 5;
283 case 8: 297 slp = &rr->u.SL.link;
284 rootflag = 1; 298 inode->i_size = symlink_len;
285 inode->i_size += 1; 299 while (slen > 1) {
286 break; 300 rootflag = 0;
287 default: 301 switch (slp->flags & ~1) {
288 printk("Symlink component flag not implemented\n"); 302 case 0:
289 } 303 inode->i_size +=
290 slen -= slp->len + 2; 304 slp->len;
291 oldslp = slp; 305 break;
292 slp = (struct SL_component *) (((char *) slp) + slp->len + 2); 306 case 2:
293 307 inode->i_size += 1;
294 if(slen < 2) { 308 break;
295 if( ((rr->u.SL.flags & 1) != 0) 309 case 4:
296 && ((oldslp->flags & 1) == 0) ) inode->i_size += 1; 310 inode->i_size += 2;
297 break; 311 break;
298 } 312 case 8:
299 313 rootflag = 1;
300 /* 314 inode->i_size += 1;
301 * If this component record isn't continued, then append a '/'. 315 break;
302 */ 316 default:
303 if (!rootflag && (oldslp->flags & 1) == 0) 317 printk
304 inode->i_size += 1; 318 ("Symlink component flag not implemented\n");
305 } 319 }
306 } 320 slen -= slp->len + 2;
307 symlink_len = inode->i_size; 321 oldslp = slp;
308 break; 322 slp =
309 case SIG('R','E'): 323 (struct SL_component
310 printk(KERN_WARNING "Attempt to read inode for relocated directory\n"); 324 *)(((char *)slp) +
311 goto out; 325 slp->len + 2);
312 case SIG('C','L'): 326
313 ISOFS_I(inode)->i_first_extent = isonum_733(rr->u.CL.location); 327 if (slen < 2) {
314 reloc = isofs_iget(inode->i_sb, ISOFS_I(inode)->i_first_extent, 0); 328 if (((rr->u.SL.
315 if (!reloc) 329 flags & 1) != 0)
316 goto out; 330 &&
317 inode->i_mode = reloc->i_mode; 331 ((oldslp->
318 inode->i_nlink = reloc->i_nlink; 332 flags & 1) == 0))
319 inode->i_uid = reloc->i_uid; 333 inode->i_size +=
320 inode->i_gid = reloc->i_gid; 334 1;
321 inode->i_rdev = reloc->i_rdev; 335 break;
322 inode->i_size = reloc->i_size; 336 }
323 inode->i_blocks = reloc->i_blocks; 337
324 inode->i_atime = reloc->i_atime; 338 /*
325 inode->i_ctime = reloc->i_ctime; 339 * If this component record isn't continued, then append a '/'.
326 inode->i_mtime = reloc->i_mtime; 340 */
327 iput(reloc); 341 if (!rootflag
328 break; 342 && (oldslp->flags & 1) == 0)
343 inode->i_size += 1;
344 }
345 }
346 symlink_len = inode->i_size;
347 break;
348 case SIG('R', 'E'):
349 printk(KERN_WARNING
350 "Attempt to read inode for relocated directory\n");
351 goto out;
352 case SIG('C', 'L'):
353 ISOFS_I(inode)->i_first_extent =
354 isonum_733(rr->u.CL.location);
355 reloc =
356 isofs_iget(inode->i_sb,
357 ISOFS_I(inode)->i_first_extent,
358 0);
359 if (!reloc)
360 goto out;
361 inode->i_mode = reloc->i_mode;
362 inode->i_nlink = reloc->i_nlink;
363 inode->i_uid = reloc->i_uid;
364 inode->i_gid = reloc->i_gid;
365 inode->i_rdev = reloc->i_rdev;
366 inode->i_size = reloc->i_size;
367 inode->i_blocks = reloc->i_blocks;
368 inode->i_atime = reloc->i_atime;
369 inode->i_ctime = reloc->i_ctime;
370 inode->i_mtime = reloc->i_mtime;
371 iput(reloc);
372 break;
329#ifdef CONFIG_ZISOFS 373#ifdef CONFIG_ZISOFS
330 case SIG('Z','F'): 374 case SIG('Z', 'F'):
331 if ( !ISOFS_SB(inode->i_sb)->s_nocompress ) { 375 if (!ISOFS_SB(inode->i_sb)->s_nocompress) {
332 int algo; 376 int algo;
333 algo = isonum_721(rr->u.ZF.algorithm); 377 algo = isonum_721(rr->u.ZF.algorithm);
334 if ( algo == SIG('p','z') ) { 378 if (algo == SIG('p', 'z')) {
335 int block_shift = isonum_711(&rr->u.ZF.parms[1]); 379 int block_shift =
336 if ( block_shift < PAGE_CACHE_SHIFT || block_shift > 17 ) { 380 isonum_711(&rr->u.ZF.
337 printk(KERN_WARNING "isofs: Can't handle ZF block size of 2^%d\n", block_shift); 381 parms[1]);
338 } else { 382 if (block_shift <
339 /* Note: we don't change i_blocks here */ 383 PAGE_CACHE_SHIFT
340 ISOFS_I(inode)->i_file_format = isofs_file_compressed; 384 || block_shift > 17) {
341 /* Parameters to compression algorithm (header size, block size) */ 385 printk(KERN_WARNING
342 ISOFS_I(inode)->i_format_parm[0] = isonum_711(&rr->u.ZF.parms[0]); 386 "isofs: Can't handle ZF block size of 2^%d\n",
343 ISOFS_I(inode)->i_format_parm[1] = isonum_711(&rr->u.ZF.parms[1]); 387 block_shift);
344 inode->i_size = isonum_733(rr->u.ZF.real_size); 388 } else {
345 } 389 /* Note: we don't change i_blocks here */
346 } else { 390 ISOFS_I(inode)->
347 printk(KERN_WARNING "isofs: Unknown ZF compression algorithm: %c%c\n", 391 i_file_format =
348 rr->u.ZF.algorithm[0], rr->u.ZF.algorithm[1]); 392 isofs_file_compressed;
349 } 393 /* Parameters to compression algorithm (header size, block size) */
350 } 394 ISOFS_I(inode)->
351 break; 395 i_format_parm[0] =
396 isonum_711(&rr->u.
397 ZF.
398 parms
399 [0]);
400 ISOFS_I(inode)->
401 i_format_parm[1] =
402 isonum_711(&rr->u.
403 ZF.
404 parms
405 [1]);
406 inode->i_size =
407 isonum_733(rr->u.ZF.
408 real_size);
409 }
410 } else {
411 printk(KERN_WARNING
412 "isofs: Unknown ZF compression algorithm: %c%c\n",
413 rr->u.ZF.algorithm[0],
414 rr->u.ZF.algorithm[1]);
415 }
416 }
417 break;
352#endif 418#endif
353 default: 419 default:
354 break; 420 break;
355 } 421 }
356 } 422 }
357 } 423 }
358 MAYBE_CONTINUE(repeat,inode); 424 MAYBE_CONTINUE(repeat, inode);
359 out: 425 out:
360 if(buffer) kfree(buffer); 426 if (buffer)
361 return 0; 427 kfree(buffer);
428 return 0;
362} 429}
363 430
364static char *get_symlink_chunk(char *rpnt, struct rock_ridge *rr, char *plimit) 431static char *get_symlink_chunk(char *rpnt, struct rock_ridge *rr, char *plimit)
@@ -376,32 +443,32 @@ static char *get_symlink_chunk(char *rpnt, struct rock_ridge *rr, char *plimit)
376 if (slp->len > plimit - rpnt) 443 if (slp->len > plimit - rpnt)
377 return NULL; 444 return NULL;
378 memcpy(rpnt, slp->text, slp->len); 445 memcpy(rpnt, slp->text, slp->len);
379 rpnt+=slp->len; 446 rpnt += slp->len;
380 break; 447 break;
381 case 2: 448 case 2:
382 if (rpnt >= plimit) 449 if (rpnt >= plimit)
383 return NULL; 450 return NULL;
384 *rpnt++='.'; 451 *rpnt++ = '.';
385 break; 452 break;
386 case 4: 453 case 4:
387 if (2 > plimit - rpnt) 454 if (2 > plimit - rpnt)
388 return NULL; 455 return NULL;
389 *rpnt++='.'; 456 *rpnt++ = '.';
390 *rpnt++='.'; 457 *rpnt++ = '.';
391 break; 458 break;
392 case 8: 459 case 8:
393 if (rpnt >= plimit) 460 if (rpnt >= plimit)
394 return NULL; 461 return NULL;
395 rootflag = 1; 462 rootflag = 1;
396 *rpnt++='/'; 463 *rpnt++ = '/';
397 break; 464 break;
398 default: 465 default:
399 printk("Symlink component flag not implemented (%d)\n", 466 printk("Symlink component flag not implemented (%d)\n",
400 slp->flags); 467 slp->flags);
401 } 468 }
402 slen -= slp->len + 2; 469 slen -= slp->len + 2;
403 oldslp = slp; 470 oldslp = slp;
404 slp = (struct SL_component *) ((char *) slp + slp->len + 2); 471 slp = (struct SL_component *)((char *)slp + slp->len + 2);
405 472
406 if (slen < 2) { 473 if (slen < 2) {
407 /* 474 /*
@@ -412,7 +479,7 @@ static char *get_symlink_chunk(char *rpnt, struct rock_ridge *rr, char *plimit)
412 !(oldslp->flags & 1)) { 479 !(oldslp->flags & 1)) {
413 if (rpnt >= plimit) 480 if (rpnt >= plimit)
414 return NULL; 481 return NULL;
415 *rpnt++='/'; 482 *rpnt++ = '/';
416 } 483 }
417 break; 484 break;
418 } 485 }
@@ -423,24 +490,22 @@ static char *get_symlink_chunk(char *rpnt, struct rock_ridge *rr, char *plimit)
423 if (!rootflag && !(oldslp->flags & 1)) { 490 if (!rootflag && !(oldslp->flags & 1)) {
424 if (rpnt >= plimit) 491 if (rpnt >= plimit)
425 return NULL; 492 return NULL;
426 *rpnt++='/'; 493 *rpnt++ = '/';
427 } 494 }
428 } 495 }
429 return rpnt; 496 return rpnt;
430} 497}
431 498
432int parse_rock_ridge_inode(struct iso_directory_record * de, 499int parse_rock_ridge_inode(struct iso_directory_record *de, struct inode *inode)
433 struct inode * inode)
434{ 500{
435 int result=parse_rock_ridge_inode_internal(de,inode,0); 501 int result = parse_rock_ridge_inode_internal(de, inode, 0);
436 /* if rockridge flag was reset and we didn't look for attributes 502 /* if rockridge flag was reset and we didn't look for attributes
437 * behind eventual XA attributes, have a look there */ 503 * behind eventual XA attributes, have a look there */
438 if ((ISOFS_SB(inode->i_sb)->s_rock_offset==-1) 504 if ((ISOFS_SB(inode->i_sb)->s_rock_offset == -1)
439 &&(ISOFS_SB(inode->i_sb)->s_rock==2)) 505 && (ISOFS_SB(inode->i_sb)->s_rock == 2)) {
440 { 506 result = parse_rock_ridge_inode_internal(de, inode, 14);
441 result=parse_rock_ridge_inode_internal(de,inode,14); 507 }
442 } 508 return result;
443 return result;
444} 509}
445 510
446/* readpage() for symlinks: reads symlink contents into the page and either 511/* readpage() for symlinks: reads symlink contents into the page and either
@@ -449,7 +514,7 @@ int parse_rock_ridge_inode(struct iso_directory_record * de,
449static int rock_ridge_symlink_readpage(struct file *file, struct page *page) 514static int rock_ridge_symlink_readpage(struct file *file, struct page *page)
450{ 515{
451 struct inode *inode = page->mapping->host; 516 struct inode *inode = page->mapping->host;
452 struct iso_inode_info *ei = ISOFS_I(inode); 517 struct iso_inode_info *ei = ISOFS_I(inode);
453 char *link = kmap(page); 518 char *link = kmap(page);
454 unsigned long bufsize = ISOFS_BUFFER_SIZE(inode); 519 unsigned long bufsize = ISOFS_BUFFER_SIZE(inode);
455 struct buffer_head *bh; 520 struct buffer_head *bh;
@@ -472,10 +537,10 @@ static int rock_ridge_symlink_readpage(struct file *file, struct page *page)
472 if (!bh) 537 if (!bh)
473 goto out_noread; 538 goto out_noread;
474 539
475 offset = ei->i_iget5_offset; 540 offset = ei->i_iget5_offset;
476 pnt = (unsigned char *) bh->b_data + offset; 541 pnt = (unsigned char *)bh->b_data + offset;
477 542
478 raw_inode = (struct iso_directory_record *) pnt; 543 raw_inode = (struct iso_directory_record *)pnt;
479 544
480 /* 545 /*
481 * If we go past the end of the buffer, there is some sort of error. 546 * If we go past the end of the buffer, there is some sort of error.
@@ -489,8 +554,8 @@ static int rock_ridge_symlink_readpage(struct file *file, struct page *page)
489 SETUP_ROCK_RIDGE(raw_inode, chr, len); 554 SETUP_ROCK_RIDGE(raw_inode, chr, len);
490 555
491 repeat: 556 repeat:
492 while (len > 2) { /* There may be one byte for padding somewhere */ 557 while (len > 2) { /* There may be one byte for padding somewhere */
493 rr = (struct rock_ridge *) chr; 558 rr = (struct rock_ridge *)chr;
494 if (rr->len < 3) 559 if (rr->len < 3)
495 goto out; /* Something got screwed up here */ 560 goto out; /* Something got screwed up here */
496 sig = isonum_721(chr); 561 sig = isonum_721(chr);
@@ -555,5 +620,5 @@ static int rock_ridge_symlink_readpage(struct file *file, struct page *page)
555} 620}
556 621
557struct address_space_operations isofs_symlink_aops = { 622struct address_space_operations isofs_symlink_aops = {
558 .readpage = rock_ridge_symlink_readpage 623 .readpage = rock_ridge_symlink_readpage
559}; 624};